aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2024-03-28 20:41:58 -0400
committerJacob Young <jacobly0@users.noreply.github.com>2024-03-30 20:50:48 -0400
commit5a41704f7ec2c472897f955ecfe1feafa697ff68 (patch)
tree62984e96e61c367ce7ad304fc532051c10e6921d /src/codegen/llvm.zig
parent6f10b11658c002b26341bff10e1dd522f2465b5a (diff)
downloadzig-5a41704f7ec2c472897f955ecfe1feafa697ff68.tar.gz
zig-5a41704f7ec2c472897f955ecfe1feafa697ff68.zip
cbe: rewrite `CType`
Closes #14904
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 8ddacbe11c..7419e778a1 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -2033,7 +2033,7 @@ pub const Object = struct {
owner_decl.src_node + 1, // Line
try o.lowerDebugType(int_ty),
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(enumerators),
);
@@ -2120,7 +2120,7 @@ pub const Object = struct {
0, // Line
try o.lowerDebugType(ptr_ty),
ptr_size * 8,
- ptr_align.toByteUnits(0) * 8,
+ (ptr_align.toByteUnits() orelse 0) * 8,
0, // Offset
);
@@ -2131,7 +2131,7 @@ pub const Object = struct {
0, // Line
try o.lowerDebugType(len_ty),
len_size * 8,
- len_align.toByteUnits(0) * 8,
+ (len_align.toByteUnits() orelse 0) * 8,
len_offset * 8,
);
@@ -2142,7 +2142,7 @@ pub const Object = struct {
line,
.none, // Underlying type
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(&.{
debug_ptr_type,
debug_len_type,
@@ -2170,7 +2170,7 @@ pub const Object = struct {
0, // Line
debug_elem_ty,
target.ptrBitWidth(),
- ty.ptrAlignment(mod).toByteUnits(0) * 8,
+ (ty.ptrAlignment(mod).toByteUnits() orelse 0) * 8,
0, // Offset
);
@@ -2217,7 +2217,7 @@ pub const Object = struct {
0, // Line
try o.lowerDebugType(ty.childType(mod)),
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(&.{
try o.builder.debugSubrange(
try o.builder.debugConstant(try o.builder.intConst(.i64, 0)),
@@ -2260,7 +2260,7 @@ pub const Object = struct {
0, // Line
debug_elem_type,
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(&.{
try o.builder.debugSubrange(
try o.builder.debugConstant(try o.builder.intConst(.i64, 0)),
@@ -2316,7 +2316,7 @@ pub const Object = struct {
0, // Line
try o.lowerDebugType(child_ty),
payload_size * 8,
- payload_align.toByteUnits(0) * 8,
+ (payload_align.toByteUnits() orelse 0) * 8,
0, // Offset
);
@@ -2327,7 +2327,7 @@ pub const Object = struct {
0,
try o.lowerDebugType(non_null_ty),
non_null_size * 8,
- non_null_align.toByteUnits(0) * 8,
+ (non_null_align.toByteUnits() orelse 0) * 8,
non_null_offset * 8,
);
@@ -2338,7 +2338,7 @@ pub const Object = struct {
0, // Line
.none, // Underlying type
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(&.{
debug_data_type,
debug_some_type,
@@ -2396,7 +2396,7 @@ pub const Object = struct {
0, // Line
try o.lowerDebugType(Type.anyerror),
error_size * 8,
- error_align.toByteUnits(0) * 8,
+ (error_align.toByteUnits() orelse 0) * 8,
error_offset * 8,
);
fields[payload_index] = try o.builder.debugMemberType(
@@ -2406,7 +2406,7 @@ pub const Object = struct {
0, // Line
try o.lowerDebugType(payload_ty),
payload_size * 8,
- payload_align.toByteUnits(0) * 8,
+ (payload_align.toByteUnits() orelse 0) * 8,
payload_offset * 8,
);
@@ -2417,7 +2417,7 @@ pub const Object = struct {
0, // Line
.none, // Underlying type
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(&fields),
);
@@ -2485,7 +2485,7 @@ pub const Object = struct {
0,
try o.lowerDebugType(Type.fromInterned(field_ty)),
field_size * 8,
- field_align.toByteUnits(0) * 8,
+ (field_align.toByteUnits() orelse 0) * 8,
field_offset * 8,
));
}
@@ -2497,7 +2497,7 @@ pub const Object = struct {
0, // Line
.none, // Underlying type
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(fields.items),
);
@@ -2566,7 +2566,7 @@ pub const Object = struct {
0, // Line
try o.lowerDebugType(field_ty),
field_size * 8,
- field_align.toByteUnits(0) * 8,
+ (field_align.toByteUnits() orelse 0) * 8,
field_offset * 8,
));
}
@@ -2578,7 +2578,7 @@ pub const Object = struct {
0, // Line
.none, // Underlying type
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(fields.items),
);
@@ -2621,7 +2621,7 @@ pub const Object = struct {
0, // Line
.none, // Underlying type
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(
&.{try o.lowerDebugType(Type.fromInterned(union_type.enum_tag_ty))},
),
@@ -2661,7 +2661,7 @@ pub const Object = struct {
0, // Line
try o.lowerDebugType(Type.fromInterned(field_ty)),
field_size * 8,
- field_align.toByteUnits(0) * 8,
+ (field_align.toByteUnits() orelse 0) * 8,
0, // Offset
));
}
@@ -2680,7 +2680,7 @@ pub const Object = struct {
0, // Line
.none, // Underlying type
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(fields.items),
);
@@ -2711,7 +2711,7 @@ pub const Object = struct {
0, // Line
try o.lowerDebugType(Type.fromInterned(union_type.enum_tag_ty)),
layout.tag_size * 8,
- layout.tag_align.toByteUnits(0) * 8,
+ (layout.tag_align.toByteUnits() orelse 0) * 8,
tag_offset * 8,
);
@@ -2722,7 +2722,7 @@ pub const Object = struct {
0, // Line
debug_union_type,
layout.payload_size * 8,
- layout.payload_align.toByteUnits(0) * 8,
+ (layout.payload_align.toByteUnits() orelse 0) * 8,
payload_offset * 8,
);
@@ -2739,7 +2739,7 @@ pub const Object = struct {
0, // Line
.none, // Underlying type
ty.abiSize(mod) * 8,
- ty.abiAlignment(mod).toByteUnits(0) * 8,
+ (ty.abiAlignment(mod).toByteUnits() orelse 0) * 8,
try o.builder.debugTuple(&full_fields),
);
@@ -4473,7 +4473,7 @@ pub const Object = struct {
// The value cannot be undefined, because we use the `nonnull` annotation
// for non-optional pointers. We also need to respect the alignment, even though
// the address will never be dereferenced.
- const int: u64 = ptr_ty.ptrInfo(mod).flags.alignment.toByteUnitsOptional() orelse
+ const int: u64 = ptr_ty.ptrInfo(mod).flags.alignment.toByteUnits() orelse
// Note that these 0xaa values are appropriate even in release-optimized builds
// because we need a well-defined value that is not null, and LLVM does not
// have an "undef_but_not_null" attribute. As an example, if this `alloc` AIR