| ... | @@ -3399,7 +3399,7 @@ pub const DeclGen = struct { | ... | @@ -3399,7 +3399,7 @@ pub const DeclGen = struct { |
| 3399 | const llvm_ptr_val = switch (ptr.addr) { | 3399 | const llvm_ptr_val = switch (ptr.addr) { |
| 3400 | .decl => |decl| try dg.lowerDeclRefValue(ptr_tv, decl), | 3400 | .decl => |decl| try dg.lowerDeclRefValue(ptr_tv, decl), |
| 3401 | .mut_decl => |mut_decl| try dg.lowerDeclRefValue(ptr_tv, mut_decl.decl), | 3401 | .mut_decl => |mut_decl| try dg.lowerDeclRefValue(ptr_tv, mut_decl.decl), |
| 3402 | .int => |int| try dg.lowerIntAsPtr(mod.intern_pool.indexToKey(int)), | 3402 | .int => |int| try dg.lowerIntAsPtr(int.toValue()), |
| 3403 | .eu_payload, | 3403 | .eu_payload, |
| 3404 | .opt_payload, | 3404 | .opt_payload, |
| 3405 | .elem, | 3405 | .elem, |
| ... | @@ -3800,15 +3800,15 @@ pub const DeclGen = struct { | ... | @@ -3800,15 +3800,15 @@ pub const DeclGen = struct { |
| 3800 | } | 3800 | } |
| 3801 | } | 3801 | } |
| 3802 | | 3802 | |
| 3803 | fn lowerIntAsPtr(dg: *DeclGen, int_key: InternPool.Key) Error!*llvm.Value { | 3803 | fn lowerIntAsPtr(dg: *DeclGen, val: Value) Error!*llvm.Value { |
| 3804 | switch (int_key) { | 3804 | switch (dg.module.intern_pool.indexToKey(val.toIntern())) { |
| 3805 | .undef => { | 3805 | .undef => { |
| 3806 | const llvm_usize = try dg.lowerType(Type.usize); | 3806 | const llvm_usize = try dg.lowerType(Type.usize); |
| 3807 | return llvm_usize.getUndef(); | 3807 | return llvm_usize.getUndef(); |
| 3808 | }, | 3808 | }, |
| 3809 | .int => |int| { | 3809 | .int => { |
| 3810 | var bigint_space: Value.BigIntSpace = undefined; | 3810 | var bigint_space: Value.BigIntSpace = undefined; |
| 3811 | const bigint = int.storage.toBigInt(&bigint_space); | 3811 | const bigint = val.toBigInt(&bigint_space, dg.module); |
| 3812 | const llvm_int = lowerBigInt(dg, Type.usize, bigint); | 3812 | const llvm_int = lowerBigInt(dg, Type.usize, bigint); |
| 3813 | return llvm_int.constIntToPtr(dg.context.pointerType(0)); | 3813 | return llvm_int.constIntToPtr(dg.context.pointerType(0)); |
| 3814 | }, | 3814 | }, |
| ... | @@ -3861,11 +3861,11 @@ pub const DeclGen = struct { | ... | @@ -3861,11 +3861,11 @@ pub const DeclGen = struct { |
| 3861 | const mod = dg.module; | 3861 | const mod = dg.module; |
| 3862 | const target = mod.getTarget(); | 3862 | const target = mod.getTarget(); |
| 3863 | return switch (mod.intern_pool.indexToKey(ptr_val.toIntern())) { | 3863 | return switch (mod.intern_pool.indexToKey(ptr_val.toIntern())) { |
| 3864 | .int => |int| dg.lowerIntAsPtr(.{ .int = int }), | 3864 | .int => dg.lowerIntAsPtr(ptr_val), |
| 3865 | .ptr => |ptr| switch (ptr.addr) { | 3865 | .ptr => |ptr| switch (ptr.addr) { |
| 3866 | .decl => |decl| dg.lowerParentPtrDecl(ptr_val, decl), | 3866 | .decl => |decl| dg.lowerParentPtrDecl(ptr_val, decl), |
| 3867 | .mut_decl => |mut_decl| dg.lowerParentPtrDecl(ptr_val, mut_decl.decl), | 3867 | .mut_decl => |mut_decl| dg.lowerParentPtrDecl(ptr_val, mut_decl.decl), |
| 3868 | .int => |int| dg.lowerIntAsPtr(mod.intern_pool.indexToKey(int)), | 3868 | .int => |int| dg.lowerIntAsPtr(int.toValue()), |
| 3869 | .eu_payload => |eu_ptr| { | 3869 | .eu_payload => |eu_ptr| { |
| 3870 | const parent_llvm_ptr = try dg.lowerParentPtr(eu_ptr.toValue(), true); | 3870 | const parent_llvm_ptr = try dg.lowerParentPtr(eu_ptr.toValue(), true); |
| 3871 | | 3871 | |