修正了种子编译器的错误
This commit is contained in:
@@ -207,6 +207,10 @@ def coerce_to_type(builder: llvmlite.IRBuilder | t.CPtr,
|
||||
# float → int
|
||||
if val_fbits != 0 and target_bits != 0:
|
||||
return llvmlite.build_fp2si(builder, val, target_ty)
|
||||
# 整数 → 指针: inttoptr
|
||||
# 适用于: 跨模块方法返回 i64(默认推断),目标变量是指针类型
|
||||
if val_bits != 0 and is_ptr_type(target_ty) != 0:
|
||||
return llvmlite.build_inttoptr(builder, val, target_ty)
|
||||
# 指针 → 非指针值: build_load 解引用
|
||||
# 适用于: 指针 → 整数 (如 i8* → i8), 指针 → 结构体值
|
||||
# 当构造器返回 Ptr(Struct) 但目标变量是 Struct 值类型时,需要 load
|
||||
|
||||
Reference in New Issue
Block a user