llvmir some opt
This commit is contained in:
21
midend/llvm/instr/AllocateInstr.java
Normal file
21
midend/llvm/instr/AllocateInstr.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package midend.llvm.instr;
|
||||
|
||||
import midend.llvm.type.IrPointerType;
|
||||
import midend.llvm.type.IrType;
|
||||
|
||||
public class AllocateInstr extends IrInstr {
|
||||
private IrType pointeeType;
|
||||
|
||||
public AllocateInstr(IrType pointeeType, String name) { // name即为局部变量的name,因为要声明一个局部变量
|
||||
super(new IrPointerType(pointeeType), name, IrInstrType.ALLOCA);
|
||||
this.pointeeType = pointeeType;
|
||||
}
|
||||
|
||||
public IrType getPointeeType() {
|
||||
return pointeeType;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getName() + " = alloca " + this.pointeeType;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user