X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=uebersetzerbau-ss10.git;a=blobdiff_plain;f=gesamt%2Fcode.bfe;h=1dc1e3f75e4546bf2e0d80f70fe12981cb312ed7;hp=9e85ee17abafb47722511d155aef96b151dd9301;hb=146b4d2c403e663e1fb454621bb5656e4798ce57;hpb=2c41106ae4fd8e8b01f3e9c4ffe58f11263b318f diff --git a/gesamt/code.bfe b/gesamt/code.bfe index 9e85ee1..1dc1e3f 100644 --- a/gesamt/code.bfe +++ b/gesamt/code.bfe @@ -187,10 +187,15 @@ void assign_var(struct treenode *bnode) void make_call(struct treenode *bnode) { int j; + /* params pushen */ + for(j = 0; j < bnode->soffset; j++) { + printf("\txchg %%%s, %d(%%rsp)\n", param_reg(j), j*8); + } /* vars pushen */ 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"); @@ -213,20 +218,23 @@ void make_call(struct treenode *bnode) } /* params poppen */ +#if 0 for(j = bnode->soffset - 1; j >= 0; j--) { +#else + for(j = 0; j < bnode->soffset; j++) { +#endif printf("\tpopq %%%s\n", param_reg(j)); } } void prep_arg(struct treenode *bnode, int moveit) { - printf("\t//args-nr.: %%%s to %%%s (moveit: %i)\n", BN_REG, param_reg(bnode->soffset), moveit); - printf("\tpushq %%%s\n", param_reg(bnode->soffset)); + printf("\t//args-nr.: %i (%%%s) [moveit: %i]\n", bnode->soffset, param_reg(bnode->soffset), moveit); if(moveit) { /* expr */ - move(BN_REG, param_reg(bnode->soffset)); + printf("\tpushq %%%s\n", BN_REG == (char *) NULL ? param_reg(bnode->soffset) : BN_REG); } else { /* just O_ID */ KIDREG2PARM(0); - move(KID_REG(0), param_reg(bnode->soffset)); + printf("\tpushq %%%s\n", KID_REG(0)); } } @@ -268,7 +276,7 @@ expr: O_ID # 0 # expr: imm # 1 # moveimm(BN_VAL, BN_REG); expr: O_BOOL(expr) # 0 # -expr: O_CALL(expr,expr) # 0 # make_call(bnode); +expr: O_CALL(expr) # 0 # make_call(bnode); expr: O_ARG(expr,expr) # 1 # prep_arg(bnode, 1); expr: O_ARG(O_ID,expr) # 1 # prep_arg(bnode, 0); expr: O_NOTHING # 0 #