ref: 8f5c9ee749a797d0af3c8d2d96c9c3961f8f5544
parent: b42ed545c1ed74508795acf70986f2c848defeca
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Mar 20 13:33:25 EDT 2015
Simplify generate() Allmost all the functions will have stack frame, so it is better to remove test that we were doing.
--- a/cc2/cgen.c
+++ b/cc2/cgen.c
@@ -399,30 +399,24 @@
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);
}
/*