From 078037ab9b410fa13a86eabdfc30918fc83cdcf3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 11 Mar 2022 00:04:42 -0700 Subject: stage2: passing threadlocal tests for x86_64-linux * use the real start code for LLVM backend with x86_64-linux - there is still a check for zig_backend after initializing the TLS area to skip some stuff. * introduce new AIR instructions and implement them for the LLVM backend. They are the same as `call` except with a modifier. - call_always_tail - call_never_tail - call_never_inline * LLVM backend calls hasRuntimeBitsIgnoringComptime in more places to avoid unnecessarily depending on comptimeOnly being resolved for some types. * LLVM backend: remove duplicate code for setting linkage and value name. The canonical place for this is in `updateDeclExports`. * LLVM backend: do some assembly template massaging to make `%%` rendered as `%`. More hacks will be needed to make inline assembly catch up with stage1. --- src/type.zig | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/type.zig') diff --git a/src/type.zig b/src/type.zig index e35006d930..ae9ca31e9f 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2187,7 +2187,8 @@ pub const Type = extern union { if (fn_info.is_generic) return false; if (fn_info.is_var_args) return true; switch (fn_info.cc) { - // If there was a comptime calling convention, it should also return false here. + // If there was a comptime calling convention, + // it should also return false here. .Inline => return false, else => {}, } @@ -2198,6 +2199,14 @@ pub const Type = extern union { } } + /// Same as `isFnOrHasRuntimeBits` but comptime-only types may return a false positive. + pub fn isFnOrHasRuntimeBitsIgnoreComptime(ty: Type) bool { + return switch (ty.zigTypeTag()) { + .Fn => true, + else => return ty.hasRuntimeBitsIgnoreComptime(), + }; + } + pub fn isNoReturn(self: Type) bool { const definitely_correct_result = self.tag_if_small_enough != .bound_fn and -- cgit v1.2.3