aboutsummaryrefslogtreecommitdiff
path: root/lib/compiler/aro
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-07-27 03:52:19 +0200
committerAndrew Kelley <andrew@ziglang.org>2024-07-28 19:44:52 -0700
commitd1d95294fd657f771657ea671a6984b860347fb0 (patch)
treed54c1098e7f0ec8c2b65ba7a6207bf4095c4b20e /lib/compiler/aro
parentc15755092821c5c27727ebf416689084eab5b73e (diff)
downloadzig-d1d95294fd657f771657ea671a6984b860347fb0.tar.gz
zig-d1d95294fd657f771657ea671a6984b860347fb0.zip
std.Target.Cpu.Arch: Remove the `aarch64_32` tag.
This is a misfeature that we inherited from LLVM: * https://reviews.llvm.org/D61259 * https://reviews.llvm.org/D61939 (`aarch64_32` and `arm64_32` are equivalent.) I truly have no idea why this triple passed review in LLVM. It is, to date, the *only* tag in the architecture component that is not, in fact, an architecture. In reality, it is just an ILP32 ABI for AArch64 (*not* AArch32). The triples that use `aarch64_32` look like `aarch64_32-apple-watchos`. Yes, that triple is exactly what you think; it has no ABI component. They really, seriously did this. Since only Apple could come up with silliness like this, it should come as no surprise that no one else uses `aarch64_32`. Later on, a GNU ILP32 ABI for AArch64 was developed, and support was added to LLVM: * https://reviews.llvm.org/D94143 * https://reviews.llvm.org/D104931 Here, sanity seems to have prevailed, and a triple using this ABI looks like `aarch64-linux-gnu_ilp32` as you would expect. As can be seen from the diffs in this commit, there was plenty of confusion throughout the Zig codebase about what exactly `aarch64_32` was. So let's just remove it. In its place, we'll use `aarch64-watchos-ilp32`, `aarch64-linux-gnuilp32`, and so on. We'll then translate these appropriately when talking to LLVM. Hence, this commit adds the `ilp32` ABI tag (we already have `gnuilp32`).
Diffstat (limited to 'lib/compiler/aro')
-rw-r--r--lib/compiler/aro/aro/Attribute.zig2
-rw-r--r--lib/compiler/aro/aro/Compilation.zig2
-rw-r--r--lib/compiler/aro/aro/target.zig10
3 files changed, 5 insertions, 9 deletions
diff --git a/lib/compiler/aro/aro/Attribute.zig b/lib/compiler/aro/aro/Attribute.zig
index 2f99f48c0d..e6fcb8e8cf 100644
--- a/lib/compiler/aro/aro/Attribute.zig
+++ b/lib/compiler/aro/aro/Attribute.zig
@@ -892,7 +892,7 @@ pub fn applyFunctionAttributes(p: *Parser, ty: Type, attr_buf_start: usize) !Typ
else => try p.errStr(.callconv_not_supported, tok, p.tok_ids[tok].lexeme().?),
},
.vectorcall => switch (p.comp.target.cpu.arch) {
- .x86, .aarch64, .aarch64_be, .aarch64_32 => try p.attr_application_buf.append(p.gpa, attr),
+ .x86, .aarch64, .aarch64_be => try p.attr_application_buf.append(p.gpa, attr),
else => try p.errStr(.callconv_not_supported, tok, p.tok_ids[tok].lexeme().?),
},
},
diff --git a/lib/compiler/aro/aro/Compilation.zig b/lib/compiler/aro/aro/Compilation.zig
index d6b9b91780..d03f5dc997 100644
--- a/lib/compiler/aro/aro/Compilation.zig
+++ b/lib/compiler/aro/aro/Compilation.zig
@@ -663,7 +663,7 @@ fn generateBuiltinTypes(comp: *Compilation) !void {
.arm, .armeb, .thumb, .thumbeb => .{
.specifier = if (os != .windows and os != .netbsd and os != .openbsd) .uint else .int,
},
- .aarch64, .aarch64_be, .aarch64_32 => .{
+ .aarch64, .aarch64_be => .{
.specifier = if (!os.isDarwin() and os != .netbsd) .uint else .int,
},
.x86_64, .x86 => .{ .specifier = if (os == .windows) .ushort else .int },
diff --git a/lib/compiler/aro/aro/target.zig b/lib/compiler/aro/aro/target.zig
index 5541d4f67e..8a864eb0ad 100644
--- a/lib/compiler/aro/aro/target.zig
+++ b/lib/compiler/aro/aro/target.zig
@@ -132,7 +132,7 @@ pub fn int64Type(target: std.Target) Type {
pub fn defaultFunctionAlignment(target: std.Target) u8 {
return switch (target.cpu.arch) {
.arm, .armeb => 4,
- .aarch64, .aarch64_32, .aarch64_be => 4,
+ .aarch64, .aarch64_be => 4,
.sparc, .sparcel, .sparc64 => 4,
.riscv64 => 2,
else => 1,
@@ -322,7 +322,6 @@ pub const FPSemantics = enum {
pub fn halfPrecisionType(target: std.Target) ?FPSemantics {
switch (target.cpu.arch) {
.aarch64,
- .aarch64_32,
.aarch64_be,
.arm,
.armeb,
@@ -478,7 +477,6 @@ pub fn get32BitArchVariant(target: std.Target) ?std.Target {
.kalimba,
.lanai,
.wasm32,
- .aarch64_32,
.spirv32,
.loongarch32,
.dxil,
@@ -542,7 +540,6 @@ pub fn get64BitArchVariant(target: std.Target) ?std.Target {
.x86_64,
=> {}, // Already 64 bit
- .aarch64_32 => copy.cpu.arch = .aarch64,
.arm => copy.cpu.arch = .aarch64,
.armeb => copy.cpu.arch = .aarch64_be,
.loongarch32 => copy.cpu.arch = .loongarch64,
@@ -574,9 +571,8 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
const llvm_arch = switch (target.cpu.arch) {
.arm => "arm",
.armeb => "armeb",
- .aarch64 => "aarch64",
+ .aarch64 => if (target.abi == .ilp32) "aarch64_32" else "aarch64",
.aarch64_be => "aarch64_be",
- .aarch64_32 => "aarch64_32",
.arc => "arc",
.avr => "avr",
.bpfel => "bpfel",
@@ -687,7 +683,7 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
writer.writeByte('-') catch unreachable;
const llvm_abi = switch (target.abi) {
- .none => "unknown",
+ .none, .ilp32 => "unknown",
.gnu => "gnu",
.gnuabin32 => "gnuabin32",
.gnuabi64 => "gnuabi64",