p = appendp(p);
p->as = ABL;
p->scond = C_SCOND_LO;
- p->to.type = D_BRANCH;
+ p->to.type = D_BRANCH;
p->to.sym = symmorestack;
p->cond = pmorestack;
// MOVW.W R14,$-autosize(SP)
p = appendp(p);
p->as = AMOVW;
- p->scond |= C_WBIT;
+ p->scond |= C_WBIT;
p->from.type = D_REG;
p->from.reg = REGLINK;
p->to.type = D_OREG;
// BL runtime.morestack(SB) // modifies LR
p = appendp(p);
p->as = ABL;
- p->to.type = D_BRANCH;
+ p->to.type = D_BRANCH;
p->to.sym = symmorestack;
p->cond = pmorestack;
// MOVW.W R14,$-autosize(SP)
p = appendp(p);
p->as = AMOVW;
- p->scond |= C_WBIT;
+ p->scond |= C_WBIT;
p->from.type = D_REG;
p->from.reg = REGLINK;
p->to.type = D_OREG;
}
}
if(thumb){
+ diag("thumb not maintained");
+ errorexit();
if(cursym->text->mark & LEAF){
if(autosize){
p->as = AADD;
q->to.type = D_REG;
q->to.reg = REGSP;
q->link = p->link;
- p->link = q;
+ p->link = q;
}
else
q = p;
break;
}
if(foreign) {
+ diag("foreign not maintained");
+ errorexit();
// if(foreign) print("ABXRET 3 %s\n", cursym->name);
#define R 1
p->as = AMOVW;
p->from.reg = REGSP;
p->to.type = D_REG;
p->to.reg = REGPC;
- // no spadj because it doesn't fall through
+ // If there are instructions following
+ // this ARET, they come from a branch
+ // with the same stackframe, so no spadj.
}
break;
if(HEADTYPE == Hwindows) {
// Windows
// Convert
- // op n(GS), reg
+ // op n(GS), reg
// to
// MOVL 0x58(GS), reg
- // op n(reg), reg
+ // op n(reg), reg
// The purpose of this patch is to fix some accesses
// to extern register variables (TLS) on Windows, as
// a different method is used to access them.
p->spadj = -autoffset;
p = appendp(p);
p->as = ARET;
+ // If there are instructions following
+ // this ARET, they come from a branch
+ // with the same stackframe, so undo
+ // the cleanup.
+ p->spadj = +autoffset;
}
}
}
diag("unbalanced PUSH/POP");
if(autoffset) {
- q = p;
+ p->as = AADJSP;
+ p->from.type = D_CONST;
+ p->from.offset = -autoffset;
+ p->spadj = -autoffset;
p = appendp(p);
p->as = ARET;
-
- q->as = AADJSP;
- q->from.type = D_CONST;
- q->from.offset = -autoffset;
- p->spadj = -autoffset;
+ // If there are instructions following
+ // this ARET, they come from a branch
+ // with the same stackframe, so undo
+ // the cleanup.
+ p->spadj = +autoffset;
}
}
}