ors seem to work

This commit is contained in:
Annie
2025-05-06 23:14:11 -04:00
parent 05a1a671b6
commit 9d1217993d

View File

@ -527,7 +527,23 @@ int generateAssign(Instruction *inst) {
//add option for constant assignment (should be easy)
if (isConst(op1) == true) {
fprintf(cg_flag, "\tmovl\t$%d, %d(%%rbp)\t#constant assign\n", getConst(op1), getAddress(cg));
char *movtype;
char *reg;
TableNode *typetn = getTypeEntry(getResult(inst));
if (typetn == integ) {
movtype = "movl";
reg = "%eax";
} else if (typetn == boo) {
movtype = "movb";
reg = "%al";
} else if (typetn == chara) {
movtype = "movb";
reg = "%al";
} else {
movtype = "movq";
reg = "%rax";
}
fprintf(cg_flag, "\t%s\t$%d, %d(%%rbp)\t#constant assign\n",movtype, getConst(op1), getAddress(cg));
return 0;
}