projects
/
uebersetzerbau-ss10.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gesamt: bugfix bei mehreren methodenaufrufen in einer Expr
[uebersetzerbau-ss10.git]
/
gesamt
/
code.bfe
diff --git
a/gesamt/code.bfe
b/gesamt/code.bfe
index 8e3dfde8eb1444485cf2824b265d089798c4236f..9e85ee17abafb47722511d155aef96b151dd9301 100644
(file)
--- a/
gesamt/code.bfe
+++ b/
gesamt/code.bfe
@@
-164,7
+164,9
@@
void gen_subspecial(struct treenode *bnode, short e)
KIDKIDREG2PARM(1,0);
if(e) {
KIDKIDREG2PARM(1,0);
if(e) {
- printf("\tsubq $%d, %%%s\n", KIDKID_VAL(1,0), BN_REG);
+ if(KIDKID_VAL(1,0) != 0) {
+ printf("\tsubq $%d, %%%s\n", KIDKID_VAL(1,0), BN_REG);
+ }
} else {
printf("\tsubq %%%s, %%%s\n", KIDKID_REG(1,0), BN_REG);
}
} else {
printf("\tsubq %%%s, %%%s\n", KIDKID_REG(1,0), BN_REG);
}
@@
-189,7
+191,21
@@
void make_call(struct treenode *bnode)
for(j = bnode->paramges; j < bnode->paramges + bnode->vars; j++) {
printf("\tpushq %%%s\n", param_reg(j));
}
for(j = bnode->paramges; j < bnode->paramges + bnode->vars; j++) {
printf("\tpushq %%%s\n", param_reg(j));
}
+ /* TODO: schoener machen... */
+ if(strcmp(BN_REG, "rax")!=0) {
+ printf("\tpushq %%rax\n");
+ if(strcmp(BN_REG, "r10")!=0) {
+ printf("\tpushq %%r10\n");
+ }
+ }
printf("\tcall %s\n", bnode->name);
printf("\tcall %s\n", bnode->name);
+ if(strcmp(BN_REG, "rax")!=0) {
+ move("rax", BN_REG);
+ if(strcmp(BN_REG, "r10")!=0) {
+ printf("\tpopq %%r10\n");
+ }
+ printf("\tpopq %%rax\n");
+ }
/* vars poppen */
for(j = bnode->paramges + bnode->vars - 1; j >= bnode->paramges; j--) {
/* vars poppen */
for(j = bnode->paramges + bnode->vars - 1; j >= bnode->paramges; j--) {