Files
MY_COMPILER/midend/llvm/instr/AllocateInstr.java
2025-12-10 17:58:17 +08:00

22 lines
598 B
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;
}
}