llvmir some opt
This commit is contained in:
32
midend/llvm/instr/CmpInstr.java
Normal file
32
midend/llvm/instr/CmpInstr.java
Normal file
@@ -0,0 +1,32 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user