Commit 14b9032f authored by Luuk van Dijk's avatar Luuk van Dijk

5l/6l/8l: undo spadj cleanup at ARET for following instructions in the same stackframe.

5l was already correct, clarified comment and added diags for unmaintained code.

R=rsc
CC=golang-dev
https://golang.org/cl/4277070
parent 9d3b3998
......@@ -450,6 +450,8 @@ noops(void)
}
}
if(thumb){
diag("thumb not maintained");
errorexit();
if(cursym->text->mark & LEAF){
if(autosize){
p->as = AADD;
......@@ -492,6 +494,8 @@ noops(void)
break;
}
if(foreign) {
diag("foreign not maintained");
errorexit();
// if(foreign) print("ABXRET 3 %s\n", cursym->name);
#define R 1
p->as = AMOVW;
......@@ -530,7 +534,9 @@ noops(void)
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;
......
......@@ -674,6 +674,11 @@ dostkoff(void)
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;
}
}
}
......
......@@ -614,14 +614,17 @@ dostkoff(void)
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;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment