22 lines
598 B
Java
22 lines
598 B
Java
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;
|
||
}
|
||
}
|