aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-17 19:03:37 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-17 19:03:37 -0700
commit35d6ee08c468642969b594b711dd6448bbaefa89 (patch)
treeb1f7bd48fdf271568b791221d1213659a46c5ad1 /src/Compilation.zig
parent76b382072ae632d8f113bcf151976f140566e699 (diff)
downloadzig-35d6ee08c468642969b594b711dd6448bbaefa89.tar.gz
zig-35d6ee08c468642969b594b711dd6448bbaefa89.zip
stage2: default to LLVM backend
on targets for which self-hosted backends are not up to par. See #89
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index c3d349b527..f6fe452951 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -943,11 +943,18 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
if (use_stage1)
break :blk true;
- // Prefer LLVM for release builds as long as it supports the target architecture.
- if (options.optimize_mode != .Debug and target_util.hasLlvmSupport(options.target))
+ // If LLVM does not support the target, then we can't use it.
+ if (!target_util.hasLlvmSupport(options.target))
+ break :blk false;
+
+ // Prefer LLVM for release builds.
+ if (options.optimize_mode != .Debug)
break :blk true;
- break :blk false;
+ // At this point we would prefer to use our own self-hosted backend,
+ // because the compilation speed is better than LLVM. But only do it if
+ // we are confident in the robustness of the backend.
+ break :blk !target_util.selfHostedBackendIsAsRobustAsLlvm(options.target);
};
if (!use_llvm) {
if (options.use_llvm == true) {