diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-08-30 17:13:35 +0300 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-08-30 12:22:07 -0700 |
| commit | 65d37239682b6418b6dd25f07187ae99088e67f0 (patch) | |
| tree | b8ea48551a149e889247f07a09353eb452ff4e1f /lib | |
| parent | c558de6655e2e9b72c5733b2d477ff18520d1c6b (diff) | |
| download | zig-65d37239682b6418b6dd25f07187ae99088e67f0.tar.gz zig-65d37239682b6418b6dd25f07187ae99088e67f0.zip | |
Sema: check that target supports tail calls
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/target.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/std/target.zig b/lib/std/target.zig index 64f9f97809..7b4a468a61 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -1440,6 +1440,16 @@ pub const Target = struct { return !self.cpu.arch.isWasm(); } + pub fn supportsTailCall(self: Target) bool { + switch (self.cpu.arch) { + .wasm32, .wasm64 => return wasm.featureSetHas(self.cpu.features, .tail_call), + // TODO these might not be true but LLVM doesn't seem to be able to handle them + .mips, .mipsel, .mips64, .mips64el => return false, + .powerpc, .powerpcle, .powerpc64, .powerpc64le => return false, + else => return true, + } + } + pub const FloatAbi = enum { hard, soft, |
