package backend.mips.instr; import backend.mips.instr.type.MipsLsType; import backend.mips.instr.type.MipsType; import backend.mips.Register; public class MipsLs extends MipsInstr { private MipsLsType lsType; private Register rd; private Register rt; private int offset; private String label; public MipsLs(MipsLsType lsType, Register rd, Register rt, int offset) { super(MipsType.LS); this.lsType = lsType; this.rd = rd; this.rt = rt; this.offset = offset; this.label = null; } public MipsLs(MipsLsType lsType, Register rd, int offset, String label) { super(MipsType.LS); this.lsType = lsType; this.rd = rd; this.rt = null; this.offset = offset; this.label = label; } public String toString() { if (this.label == null) { return this.lsType.toString() + " " + this.rd + ", " + this.offset + "(" + this.rt + ")\n"; } else { return this.lsType.toString() + " " + this.rd + ", " + this.label + " + " + this.offset + "\n"; } } }