26 lines
718 B
Java
Executable File
26 lines
718 B
Java
Executable File
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吗?
|
||
}
|
||
}
|