mips without optimize
This commit is contained in:
39
backend/mips/instr/MipsAlu.java
Executable file
39
backend/mips/instr/MipsAlu.java
Executable file
@@ -0,0 +1,39 @@
|
||||
package backend.mips.instr;
|
||||
|
||||
import backend.mips.Register;
|
||||
import backend.mips.instr.type.MipsAluType;
|
||||
import backend.mips.instr.type.MipsType;
|
||||
|
||||
public class MipsAlu extends MipsInstr {
|
||||
private MipsAluType aluType;
|
||||
private Register rd;
|
||||
private Register rs;
|
||||
private Register rt;
|
||||
private int immediate;
|
||||
private boolean isImInstr;
|
||||
|
||||
public MipsAlu(MipsAluType aluType, Register rd, Register rs, Register rt) {
|
||||
super(MipsType.ALU);
|
||||
this.aluType = aluType;
|
||||
this.rd = rd;
|
||||
this.rs = rs;
|
||||
this.rt = rt;
|
||||
this.immediate = 0;
|
||||
this.isImInstr = false;
|
||||
}
|
||||
|
||||
public MipsAlu(MipsAluType aluType, Register rd, Register rs, int immediate) {
|
||||
super(MipsType.ALU);
|
||||
this.aluType = aluType;
|
||||
this.rd = rd;
|
||||
this.rs = rs;
|
||||
this.rt = null;
|
||||
this.immediate = immediate;
|
||||
this.isImInstr = true;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return isImInstr ? aluType.toString() + " " + rd + ", " + rs + ", " + immediate + "\n"
|
||||
: aluType.toString() + " " + rd + ", " + rs + ", " + rt + "\n";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user