ors seem to work
This commit is contained in:
@ -527,7 +527,23 @@ int generateAssign(Instruction *inst) {
|
|||||||
|
|
||||||
//add option for constant assignment (should be easy)
|
//add option for constant assignment (should be easy)
|
||||||
if (isConst(op1) == true) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user