stage2 llvm backend: implement const inttoptr
This commit is contained in:
@@ -768,6 +768,11 @@ pub const DeclGen = struct {
|
||||
};
|
||||
return self.context.constStruct(&fields, fields.len, .False);
|
||||
},
|
||||
.int_u64 => {
|
||||
const llvm_usize = try self.llvmType(Type.initTag(.usize));
|
||||
const llvm_int = llvm_usize.constInt(tv.val.toUnsignedInt(), .False);
|
||||
return llvm_int.constIntToPtr(try self.llvmType(tv.ty));
|
||||
},
|
||||
else => |tag| return self.todo("implement const of pointer type '{}' ({})", .{ tv.ty, tag }),
|
||||
},
|
||||
.Array => {
|
||||
|
||||
@@ -130,6 +130,9 @@ pub const Value = opaque {
|
||||
|
||||
pub const constBitCast = LLVMConstBitCast;
|
||||
extern fn LLVMConstBitCast(ConstantVal: *const Value, ToType: *const Type) *const Value;
|
||||
|
||||
pub const constIntToPtr = LLVMConstIntToPtr;
|
||||
extern fn LLVMConstIntToPtr(ConstantVal: *const Value, ToType: *const Type) *const Value;
|
||||
};
|
||||
|
||||
pub const Type = opaque {
|
||||
|
||||
Reference in New Issue
Block a user