package midend.llvm.instr; import midend.llvm.value.IrValue; import midend.llvm.type.IrInterType; public class CmpInstr extends IrInstr { private CmpType cmpType; public CmpInstr(String name, String op, IrValue lhs, IrValue rhs) { super(IrInterType.BOOL, name, IrInstrType.CMP); cmpType = CmpType.getCmpType(op); addUse(lhs); addUse(rhs); } public CmpType getCmpType() { return cmpType; } public IrValue getLhs() { return getUse(0); } public IrValue getRhs() { return getUse(1); } public String toString() { return getName() + " = " + "icmp " + cmpType.toString() + " i32 " + getLhs().getName() + ", " + getRhs().getName(); } }