| author | |
| committer | |
| log | 35d6ee08c468642969b594b711dd6448bbaefa89 |
| tree | b1f7bd48fdf271568b791221d1213659a46c5ad1 |
| parent | 76b382072ae632d8f113bcf151976f140566e699 |
on targets for which self-hosted backends are not up to par.
See #892 files changed, 19 insertions(+), 3 deletions(-)
src/Compilation.zig+10-3| ... | ... | @@ -943,11 +943,18 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 943 | 943 | if (use_stage1) |
| 944 | 944 | break :blk true; |
| 945 | 945 | |
| 946 | // Prefer LLVM for release builds as long as it supports the target architecture. | |
| 947 | if (options.optimize_mode != .Debug and target_util.hasLlvmSupport(options.target)) | |
| 946 | // If LLVM does not support the target, then we can't use it. | |
| 947 | if (!target_util.hasLlvmSupport(options.target)) | |
| 948 | break :blk false; | |
| 949 | ||
| 950 | // Prefer LLVM for release builds. | |
| 951 | if (options.optimize_mode != .Debug) | |
| 948 | 952 | break :blk true; |
| 949 | 953 | |
| 950 | break :blk false; | |
| 954 | // At this point we would prefer to use our own self-hosted backend, | |
| 955 | // because the compilation speed is better than LLVM. But only do it if | |
| 956 | // we are confident in the robustness of the backend. | |
| 957 | break :blk !target_util.selfHostedBackendIsAsRobustAsLlvm(options.target); | |
| 951 | 958 | }; |
| 952 | 959 | if (!use_llvm) { |
| 953 | 960 | if (options.use_llvm == true) { |
src/target.zig+9| ... | ... | @@ -268,6 +268,15 @@ pub fn hasLlvmSupport(target: std.Target) bool { |
| 268 | 268 | }; |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | /// The set of targets that our own self-hosted backends have robust support for. | |
| 272 | /// Used to select between LLVM backend and self-hosted backend when compiling in | |
| 273 | /// debug mode. A given target should only return true here if it is passing greater | |
| 274 | /// than or equal to the number of behavior tests as the respective LLVM backend. | |
| 275 | pub fn selfHostedBackendIsAsRobustAsLlvm(target: std.Target) bool { | |
| 276 | _ = target; | |
| 277 | return false; | |
| 278 | } | |
| 279 | ||
| 271 | 280 | pub fn supportsStackProbing(target: std.Target) bool { |
| 272 | 281 | return target.os.tag != .windows and target.os.tag != .uefi and |
| 273 | 282 | (target.cpu.arch == .i386 or target.cpu.arch == .x86_64); |