commit 8f5c9ee749a797d0af3c8d2d96c9c3961f8f5544
parent b42ed545c1ed74508795acf70986f2c848defeca
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 20 Mar 2015 17:33:25 -0400
Simplify generate()
Allmost all the functions will have stack frame, so it is
better to remove test that we were doing.
Diffstat:
1 file changed, 13 insertions(+), 19 deletions(-)
diff --git a/cc2/cgen.c b/cc2/cgen.c
@@ -399,30 +399,24 @@ applycgen(Node *np)
void
generate(void)
{
- extern char odebug;
uint8_t size = curfun->u.f.locals;
- char frame = size != 0 || odebug;
-
- if (frame) {
- code(PUSH, NULL, ®s[IX]);
- code(MOV, ®s[IX], ®s[SP]);
- if (size > 6) {
- code(MOV, ®s[HL], imm(-size));
- code(ADD, ®s[HL], ®s[SP]);
- code(MOV, ®s[SP], ®s[HL]);
- } else {
- for (; size != 0; size-= 2)
- code(PUSH, NULL, ®s[HL]);
- }
+
+ code(PUSH, NULL, ®s[IX]);
+ code(MOV, ®s[IX], ®s[SP]);
+ if (size > 6) {
+ code(MOV, ®s[HL], imm(-size));
+ code(ADD, ®s[HL], ®s[SP]);
+ code(MOV, ®s[SP], ®s[HL]);
+ } else {
+ for (; size != 0; size-= 2)
+ code(PUSH, NULL, ®s[HL]);
}
apply(applycgen);
- if (frame) {
- code(MOV, ®s[SP], ®s[IX]);
- code(POP, ®s[IX], NULL);
- code(RET, NULL, NULL);
- }
+ code(MOV, ®s[SP], ®s[IX]);
+ code(POP, ®s[IX], NULL);
+ code(RET, NULL, NULL);
}
/*