32 lines
732 B
Java
32 lines
732 B
Java
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();
|
|
}
|
|
}
|