mips without optimize
This commit is contained in:
45
midend/llvm/instr/JumpInstr.java
Normal file → Executable file
45
midend/llvm/instr/JumpInstr.java
Normal file → Executable file
@@ -1,20 +1,25 @@
|
||||
package midend.llvm.instr;
|
||||
|
||||
import midend.llvm.value.IrBasicBlock;
|
||||
import midend.llvm.type.IrInterType;
|
||||
|
||||
public class JumpInstr extends IrInstr {
|
||||
public JumpInstr(IrBasicBlock targetBlock) {
|
||||
super(IrInterType.VOID, "jump", IrInstrType.JUMP);
|
||||
addUse(targetBlock);
|
||||
}
|
||||
|
||||
public IrBasicBlock getTargetBlock() {
|
||||
return (IrBasicBlock) getUse(0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "br label " + "%" + getTargetBlock().getName();
|
||||
}
|
||||
}
|
||||
// TODO:所有的指令的基本块设置还需完善
|
||||
package midend.llvm.instr;
|
||||
|
||||
import midend.llvm.value.IrBasicBlock;
|
||||
import backend.mips.instr.MipsJump;
|
||||
import backend.mips.instr.type.MipsJumpType;
|
||||
import midend.llvm.type.IrInterType;
|
||||
|
||||
public class JumpInstr extends IrInstr {
|
||||
public JumpInstr(IrBasicBlock targetBlock) {
|
||||
super(IrInterType.VOID, "jump", IrInstrType.JUMP);
|
||||
addUse(targetBlock);
|
||||
}
|
||||
|
||||
public IrBasicBlock getTargetBlock() {
|
||||
return (IrBasicBlock) getUse(0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "br label " + "%" + getTargetBlock().getName();
|
||||
}
|
||||
|
||||
public void toMips() {
|
||||
new MipsJump(MipsJumpType.J, getTargetBlock().getMipsLabel()); //TODO: 该用JAL吗?
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user