KIDKIDREG2PARM(1,1);
KIDREG2PARM(0);
move(KID_REG(0), BN_REG);
- printf("\tsubq %%%s, %%%s", KIDKID_REG(1,1), BN_REG);
- printf("; subq %%%s, %%%s\n", KIDKID_REG(1,0), BN_REG);
+ printf("\tsubq %%%s, %%%s\n", KIDKID_REG(1,1), BN_REG);
+ printf("\tsubq %%%s, %%%s\n", KIDKID_REG(1,0), BN_REG);
}
void gen_e_field(struct treenode *bnode, char *instr)
if(e0 && e1) {
if(deep) {
KIDKIDREG2PARM(1,0);
- printf("\tcmp %d(%%%s), %%%s", bnode->kids[1]->soffset *8, KIDKID_REG(1,0), KID_REG(0));
+ printf("\tcmp %d(%%%s), %%%s\n", bnode->kids[1]->soffset *8, KIDKID_REG(1,0), KID_REG(0));
} else {
- printf("\tcmp %%%s, %%%s", KID_REG(1), KID_REG(0));
+ printf("\tcmp %%%s, %%%s\n", KID_REG(1), KID_REG(0));
}
} else if(e0 && !e1) {
if (deep == 0) {
- printf("\tcmp $%d, %%%s", KID_VAL(1), KID_REG(0));
+ printf("\tcmp $%d, %%%s\n", KID_VAL(1), KID_REG(0));
} else if (deep == 1) {
KIDKIDREG2PARM(0,0);
- printf("\tcmp $%d, %%%s", KID_VAL(1), KIDKID_REG(0,0));
+ printf("\tcmp $%d, %%%s\n", KID_VAL(1), KIDKID_REG(0,0));
} else if (deep == 2) {
KIDKIDKIDREG2PARM(0,0,0);
- printf("\tcmp $%d, %%%s", KID_VAL(1), KIDKIDKID_REG(0,0,0));
+ printf("\tcmp $%d, %%%s\n", KID_VAL(1), KIDKIDKID_REG(0,0,0));
}
} else if(!e0 && e1) {
- printf("\tcmp $%d, %%%s", KID_VAL(0), KID_REG(1));
+ printf("\tcmp $%d, %%%s\n", KID_VAL(0), KID_REG(1));
}
- printf("; set%s %%%s", op, reg_64to8l(BN_REG));
- printf("; and $1, %%%s\n", BN_REG);
+ printf("\tset%s %%%s\n", op, reg_64to8l(BN_REG));
+ printf("\tand $1, %%%s\n", BN_REG);
}
void gen_lea(struct treenode *bnode, short e)
if(e) {
if(KIDKID_VAL(1,0) != 0) {
- printf("\tsubq $%d, %%%s", KIDKID_VAL(1,0), BN_REG);
+ printf("\tsubq $%d, %%%s\n", KIDKID_VAL(1,0), BN_REG);
}
} else {
- printf("\tsubq %%%s, %%%s", KIDKID_REG(1,0), BN_REG);
+ printf("\tsubq %%%s, %%%s\n", KIDKID_REG(1,0), BN_REG);
}
if(e) KIDKIDREG2PARM(1,1);
- printf("; addq %%%s, %%%s\n", KIDKID_REG(1,1), BN_REG);
+ printf("\taddq %%%s, %%%s\n", KIDKID_REG(1,1), BN_REG);
}
void assign_var(struct treenode *bnode)
{
short *sc = bnode->sc;
int j, off = 0;
- printf("\t//params pushen (skippop: %d)\n\t", skippop);
+ printf("\t//params pushen (skippop: %d)\n", skippop);
for(j = 0; j < bnode->soffset; j++) {
if(sc[j] == 1)
- printf("xchg %%%s, %d(%%rsp); ", param_reg(j), (j - off)*8);
+ printf("\txchg %%%s, %d(%%rsp)\n", param_reg(j), (j - off)*8);
else {
if (sc[j] == 0) {
- printf("pushq %%%s; ", param_reg(j));
+ printf("\tpushq %%%s\n", param_reg(j));
off++;
}
}
}
- printf("\n\t//vars pushen\n\t");
+ printf("\t//vars pushen\n");
for(j = bnode->soffset; j < bnode->soffset + bnode->vars; j++) {
- printf("pushq %%%s; ", param_reg(j));
+ printf("\tpushq %%%s\n", param_reg(j));
}
- printf("\n");
/* TODO: schoener machen... */
if(strcmp(BN_REG, "rax")!=0) {
if(skippop)
goto cleanup;
- printf("\t//vars poppen\n\t");
+ printf("\t//vars poppen\n");
for(j = bnode->soffset + bnode->vars - 1; j > bnode->soffset - 1; j--) {
- printf("popq %%%s; ", param_reg(j));
+ printf("\tpopq %%%s\n", param_reg(j));
}
- printf("\t//params poppen (sc == 0)\n\t");
+ printf("\t//params poppen (sc == 0)\n");
for(j = bnode->soffset - 1; j >= 0; j--) {
if(sc[j] == 0)
- printf("popq %%%s; ", param_reg(j));
+ printf("\tpopq %%%s\n", param_reg(j));
}
- printf("\t//params poppen (sc != 0)\n\t");
+ printf("\t//params poppen (sc != 0)\n");
for(j = 0; j < bnode->soffset; j++) {
if(sc[j] > 0)
- printf("popq %%%s; ", param_reg(j));
+ printf("\tpopq %%%s\n", param_reg(j));
}
cleanup: