Commit 33502fa9 authored by lxq's avatar lxq

dry action for CmpInst

parent eda3505d
...@@ -302,31 +302,31 @@ CodeGen::IR2assem(CallInst *instr) { ...@@ -302,31 +302,31 @@ CodeGen::IR2assem(CallInst *instr) {
if (not instr->is_void()) if (not instr->is_void())
back2stack(instr); back2stack(instr);
} }
void /* void
CodeGen::IR2assem(CmpInst *instr) { * CodeGen::IR2assem(CmpInst *instr) {
value2reg(instr->get_operand(0), 0); * value2reg(instr->get_operand(0), 0);
value2reg(instr->get_operand(1), 1); * value2reg(instr->get_operand(1), 1);
string instr_ir; * string instr_ir;
switch (instr->get_cmp_op()) { * switch (instr->get_cmp_op()) {
case CmpInst::EQ: * case CmpInst::EQ:
break; * break;
case CmpInst::NE: * case CmpInst::NE:
// output.push_back("xor $a0, $a0, $a1"); * // output.push_back("xor $a0, $a0, $a1");
break; * break;
case CmpInst::GT: * case CmpInst::GT:
output.push_back("slt $a0, $a1, $a0"); * output.push_back("slt $a0, $a1, $a0");
break; * break;
case CmpInst::GE: * case CmpInst::GE:
break; * break;
case CmpInst::LT: * case CmpInst::LT:
output.push_back("slt $a0, $a0, $a1"); * output.push_back("slt $a0, $a0, $a1");
break; * break;
case CmpInst::LE: * case CmpInst::LE:
break; * break;
} * }
output.push_back(instr_ir + " $a0, $a0, $a1"); * output.push_back(instr_ir + " $a0, $a0, $a1");
back2stack(instr); * back2stack(instr);
} * } */
void void
CodeGen::IR2assem(BinaryInst *instr) { CodeGen::IR2assem(BinaryInst *instr) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment