Commit 68545eb4 authored by 可莉不知道呦's avatar 可莉不知道呦
Browse files

check it?

Showing with 10 additions and 10 deletions
+10 -10
......@@ -22,7 +22,7 @@ public:
}
static std::string getNewTamp(){
return "%t_" + std::to_string(tempCounter++);
return "%" + std::to_string(tempCounter++);
}
static std::string getNewLabel(const std::string& label){
......
......@@ -118,7 +118,7 @@ void BasicBlock::codegen(AsmBuilder *builder,
if(Type_Enum(arguments[i]->type) == INT32TYPE){
auto addArgument = new BinaryMInstruction(cur_block,
BinaryMInstruction::ADDI,
new MachineOperand(MachineOperand::VREG, "%t_" + to_string(i)), //x2(sp)
new MachineOperand(MachineOperand::VREG, "%" + to_string(i)), //x2(sp)
new MachineOperand(MachineOperand::REG, IREGISTER::A0+i),//x2(sp)
new MachineOperand(MachineOperand::IMM, 0));
cur_block->insertInst(addArgument);
......@@ -126,7 +126,7 @@ void BasicBlock::codegen(AsmBuilder *builder,
else if(Type_Enum(arguments[i]->type) == POINTERTYPE){
auto addArgument = new BinaryMInstruction(cur_block,
BinaryMInstruction::ADDI,
new MachineOperand(MachineOperand::VREG, "%t_" + to_string(i)),
new MachineOperand(MachineOperand::VREG, "%" + to_string(i)),
new MachineOperand(MachineOperand::REG, IREGISTER::A0+i),
new MachineOperand(MachineOperand::IMM, 0));
cur_block->insertInst(addArgument);
......@@ -139,25 +139,25 @@ void BasicBlock::codegen(AsmBuilder *builder,
if (offset <= 2032 && false) {
auto lw1 = new LoadMInstruction(cur_block,
LoadMInstruction::LW,
new MachineOperand(MachineOperand::VREG, "%t_" + to_string(i)),
new MachineOperand(MachineOperand::VREG, "%" + to_string(i)),
new MachineOperand(MachineOperand::IMM, offset),
new MachineOperand(MachineOperand::REG, IREGISTER::FP));
cur_block->insertInst(lw1);
} else {
auto li = new LoadImmInstruction(cur_block, LoadImmInstruction::LI,
new MachineOperand(MachineOperand::VREG, "%t_" + to_string(i)),
new MachineOperand(MachineOperand::VREG, "%" + to_string(i)),
new MachineOperand(MachineOperand::IMM, offset));
cur_block->insertInst(li);
auto add = new BinaryMInstruction(cur_block, BinaryMInstruction::ADD,
new MachineOperand(MachineOperand::VREG, "%t_" + to_string(i)),
new MachineOperand(MachineOperand::VREG, "%t_" + to_string(i)),
new MachineOperand(MachineOperand::VREG, "%" + to_string(i)),
new MachineOperand(MachineOperand::VREG, "%" + to_string(i)),
new MachineOperand(MachineOperand::REG, IREGISTER::FP));
cur_block->insertInst(add);
auto lw1 = new LoadMInstruction(cur_block,
LoadMInstruction::LW,
new MachineOperand(MachineOperand::VREG, "%t_" + to_string(i)),
new MachineOperand(MachineOperand::VREG, "%" + to_string(i)),
new MachineOperand(MachineOperand::IMM, 0),
new MachineOperand(MachineOperand::VREG, "%t_" + to_string(i)));
new MachineOperand(MachineOperand::VREG, "%" + to_string(i)));
cur_block->insertInst(lw1);
}
offset += 8;
......@@ -166,7 +166,7 @@ void BasicBlock::codegen(AsmBuilder *builder,
if (offset <= 2032) {
auto ld1 = new LoadMInstruction(cur_block,
LoadMInstruction::LD,
new MachineOperand(MachineOperand::VREG, "%t_" + to_string(i)),
new MachineOperand(MachineOperand::VREG, "%" + to_string(i)),
new MachineOperand(MachineOperand::IMM, offset),
new MachineOperand(MachineOperand::REG, IREGISTER::FP));
cur_block->insertInst(ld1);
......
Supports Markdown
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