diff options
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig index 4a62fd07ca..06976ae49c 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -6612,6 +6612,14 @@ pub fn enumValueFieldIndex(mod: *Module, ty: Type, field_index: u32) Allocator.E } })).toValue(); } +pub fn undefValue(mod: *Module, ty: Type) Allocator.Error!Value { + return (try mod.intern(.{ .undef = ty.toIntern() })).toValue(); +} + +pub fn undefRef(mod: *Module, ty: Type) Allocator.Error!Air.Inst.Ref { + return Air.internedToRef((try mod.undefValue(ty)).toIntern()); +} + pub fn intValue(mod: *Module, ty: Type, x: anytype) Allocator.Error!Value { if (std.math.cast(u64, x)) |casted| return intValue_u64(mod, ty, casted); if (std.math.cast(i64, x)) |casted| return intValue_i64(mod, ty, casted); @@ -6620,6 +6628,10 @@ pub fn intValue(mod: *Module, ty: Type, x: anytype) Allocator.Error!Value { return intValue_big(mod, ty, big_int.toConst()); } +pub fn intRef(mod: *Module, ty: Type, x: anytype) Allocator.Error!Air.Inst.Ref { + return Air.internedToRef((try mod.intValue(ty, x)).toIntern()); +} + pub fn intValue_big(mod: *Module, ty: Type, x: BigIntConst) Allocator.Error!Value { const i = try intern(mod, .{ .int = .{ .ty = ty.toIntern(), |
