将部分 | t.CPtr 修正为 rawptr[T]
This commit is contained in:
1 parent
eb01a45024
commit
9e2ccbfab7
58 files changed
+3543
-3564
No files matched your search
@@ -249,7 +249,7 @@ class VarGenMixin:
|
||||
"""由 alloca 的值类型构造 TypeSpec,不适用/失败返回 None"""
|
||||
if alloca is None or alloca.Ty is None:
|
||||
return None
|
||||
ty: llvmlite.LLVMType | t.CPtr = alloca.Ty
|
||||
ty: rawptr[llvmlite.LLVMType] = alloca.Ty
|
||||
if self.Gen.ExprGenBase.is_ptr_type(ty) != 0:
|
||||
ty = ty.Pointee
|
||||
arena: TSpec.TypeSpecArena | t.CPtr = self.Gen.TypeGenBase.ensure_spec_arena()
|
||||
@@ -261,7 +261,7 @@ class VarGenMixin:
|
||||
# LLVM IR 要求指令支配所有使用点,故所有 alloca 须在函数入口块生成。
|
||||
# 实现:临时切换 builder.CurBlock 到入口块,生成 alloca 后恢复。
|
||||
def _alloca_at_entry(self, builder: llvmlite.IRBuilder | t.CPtr,
|
||||
ty: llvmlite.LLVMType | t.CPtr) -> llvmlite.Value | t.CPtr:
|
||||
ty: rawptr[llvmlite.LLVMType]) -> llvmlite.Value | t.CPtr:
|
||||
"""在函数入口块生成 alloca,返回 alloca 值
|
||||
|
||||
使用 llvmlite.build_alloca_at_entry 在入口块终止指令之前插入 alloca,
|
||||
@@ -277,7 +277,7 @@ class VarGenMixin:
|
||||
vars_ptr: GenTypes.VarEntry | t.CPtr,
|
||||
var_count: int,
|
||||
name: str,
|
||||
ty: llvmlite.LLVMType | t.CPtr) -> llvmlite.Value | t.CPtr:
|
||||
ty: rawptr[llvmlite.LLVMType]) -> llvmlite.Value | t.CPtr:
|
||||
"""查找或创建变量 alloca"""
|
||||
existing: llvmlite.Value | t.CPtr = self.find_var(vars_ptr, var_count, name)
|
||||
if existing is not None:
|
||||
@@ -482,7 +482,7 @@ class VarGenMixin:
|
||||
pool: rawptr[memhub.MemBuddy],
|
||||
builder: llvmlite.IRBuilder | t.CPtr,
|
||||
name: str,
|
||||
ty: llvmlite.LLVMType | t.CPtr) -> llvmlite.Value | t.CPtr:
|
||||
ty: rawptr[llvmlite.LLVMType]) -> llvmlite.Value | t.CPtr:
|
||||
"""查找或创建变量 alloca(在当前作用域)"""
|
||||
existing: llvmlite.Value | t.CPtr = self.lookup_current(symtab, name)
|
||||
if existing is not None:
|
||||
|
||||
Reference in new issue
Block a user