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