aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-10-03 08:34:19 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2024-11-03 09:29:30 +0100
commitc9e67e71c146d9a9c217d3f47e75258a1ffeedd9 (patch)
tree4c39477d16c9dc77dd53a254d11d601025fb3919 /src/codegen
parent4e843b4e2b8c7cd48ecbd80a59036f1f72a997ca (diff)
downloadzig-c9e67e71c146d9a9c217d3f47e75258a1ffeedd9.tar.gz
zig-c9e67e71c146d9a9c217d3f47e75258a1ffeedd9.zip
std.Target: Replace isARM() with isArmOrThumb() and rename it to isArm().
The old isARM() function was a portability trap. With the name it had, it seemed like the obviously correct function to use, but it didn't include Thumb. In the vast majority of cases where someone wants to ask "is the target Arm?", Thumb *should* be included. There are exactly 3 cases in the codebase where we do actually need to exclude Thumb, although one of those is in Aro and mirrors a check in Clang that is itself likely a bug. These rare cases can just add an extra isThumb() check.
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/c.zig2
-rw-r--r--src/codegen/llvm.zig6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 4d55637f27..41ec422959 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -5190,7 +5190,7 @@ fn asmInputNeedsLocal(f: *Function, constraint: []const u8, value: CValue) bool
return switch (constraint[0]) {
'{' => true,
'i', 'r' => false,
- 'I' => !target.cpu.arch.isArmOrThumb(),
+ 'I' => !target.cpu.arch.isArm(),
else => switch (value) {
.constant => |val| switch (dg.pt.zcu.intern_pool.indexToKey(val.toIntern())) {
.ptr => |ptr| if (ptr.byte_offset == 0) switch (ptr.base_addr) {
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index fc7d26a815..85a4062ed3 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -494,7 +494,7 @@ const DataLayoutBuilder = struct {
if (idx != size) try writer.print(":{d}", .{idx});
}
}
- if (self.target.cpu.arch.isArmOrThumb())
+ if (self.target.cpu.arch.isArm())
try writer.writeAll("-Fi8") // for thumb interwork
else if (self.target.cpu.arch == .powerpc64 and
self.target.os.tag != .freebsd and
@@ -761,7 +761,7 @@ const DataLayoutBuilder = struct {
else => {},
}
},
- .vector => if (self.target.cpu.arch.isArmOrThumb()) {
+ .vector => if (self.target.cpu.arch.isArm()) {
switch (size) {
128 => abi = 64,
else => {},
@@ -827,7 +827,7 @@ const DataLayoutBuilder = struct {
else => {},
},
.aggregate => if (self.target.os.tag == .uefi or self.target.os.tag == .windows or
- self.target.cpu.arch.isArmOrThumb())
+ self.target.cpu.arch.isArm())
{
pref = @min(pref, self.target.ptrBitWidth());
} else switch (self.target.cpu.arch) {