27 lines
658 B
Java
Executable File
27 lines
658 B
Java
Executable File
package midend.llvm.instr;
|
|
|
|
import backend.mips.Register;
|
|
import backend.mips.instr.MipsSyscall;
|
|
import backend.mips.instr.fake.MipsLi;
|
|
import midend.llvm.type.IrInterType;
|
|
|
|
public class GetIntInstr extends IrInstr {
|
|
public GetIntInstr(String name) {
|
|
super(IrInterType.INT32, name, IrInstrType.IO);
|
|
}
|
|
|
|
public String toString() {
|
|
return getName() + " = call i32 @getint()";
|
|
}
|
|
|
|
public static String getIntDecl() {
|
|
return "declare i32 @getint()";
|
|
}
|
|
|
|
public void toMips() {
|
|
new MipsLi(Register.V0, 5);
|
|
new MipsSyscall();
|
|
saveResult(this, Register.V0);
|
|
}
|
|
}
|