Files
MY_COMPILER/backend/mips/instr/MipsMd.java
2025-12-12 20:14:00 +08:00

34 lines
853 B
Java

package backend.mips.instr;
import backend.mips.instr.type.MipsMdType;
import backend.mips.instr.type.MipsType;
import backend.mips.Register;
public class MipsMd extends MipsInstr {
private MipsMdType mdType;
private Register rd;
private Register rt;
public MipsMd(MipsMdType mdType, Register rd, Register rt) {
super(MipsType.MD);
this.mdType = mdType;
this.rd = rd;
this.rt = rt;
}
public MipsMd(MipsMdType mdType, Register rd) {
super(MipsType.MD);
this.mdType = mdType;
this.rd = rd;
this.rt = null;
}
public String toString() {
if (this.rt == null) {
return this.mdType.toString() + " " + this.rd + "\n";
} else {
return this.mdType.toString() + " " + this.rd + ", " + this.rt + "\n";
}
}
}