mips without optimize
This commit is contained in:
43
midend/llvm/instr/GetIntInstr.java
Normal file → Executable file
43
midend/llvm/instr/GetIntInstr.java
Normal file → Executable file
@@ -1,17 +1,26 @@
|
||||
package midend.llvm.instr;
|
||||
|
||||
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()";
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user