llvmir some opt
This commit is contained in:
31
midend/llvm/instr/TruncInstr.java
Normal file
31
midend/llvm/instr/TruncInstr.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package midend.llvm.instr;
|
||||
|
||||
import midend.llvm.type.IrType;
|
||||
import midend.llvm.value.IrValue;
|
||||
|
||||
public class TruncInstr extends IrInstr {
|
||||
private IrType targetType;
|
||||
|
||||
public TruncInstr(IrType targetType, IrValue value, String name) {
|
||||
super(targetType, name, IrInstrType.TRUNC);
|
||||
addUse(value);
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
public IrValue getSrc() {
|
||||
return getUse(0);
|
||||
}
|
||||
|
||||
public IrType getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public IrType getSrcType() {
|
||||
return getSrc().getType();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getName() + " = trunc " + getSrcType()
|
||||
+ " " + getSrc().getName() + " to " + getTargetType();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user