diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-12-13 18:28:00 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-01-01 17:51:19 -0700 |
| commit | 33cdf33b95676dca9f91216e0f8742f9cf7e84fb (patch) | |
| tree | 59ccf012a4fc839def23bce321c1735b6bdf5651 /src/Package/Module.zig | |
| parent | b162c3c820d8a6446bbdfba90b3c135ebcd76fcb (diff) | |
| download | zig-33cdf33b95676dca9f91216e0f8742f9cf7e84fb.tar.gz zig-33cdf33b95676dca9f91216e0f8742f9cf7e84fb.zip | |
compiler: update many references to bin_file.options
Diffstat (limited to 'src/Package/Module.zig')
| -rw-r--r-- | src/Package/Module.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Package/Module.zig b/src/Package/Module.zig index f1e7091855..0916742876 100644 --- a/src/Package/Module.zig +++ b/src/Package/Module.zig @@ -30,6 +30,8 @@ sanitize_c: bool, sanitize_thread: bool, unwind_tables: bool, cc_argv: []const []const u8, +/// (SPIR-V) whether to generate a structured control flow graph or not +structured_cfg: bool, /// The contents of `@import("builtin")` for this module. generated_builtin_source: []const u8, @@ -82,6 +84,7 @@ pub const CreateOptions = struct { unwind_tables: ?bool = null, sanitize_c: ?bool = null, sanitize_thread: ?bool = null, + structured_cfg: ?bool = null, }; }; @@ -268,6 +271,17 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { break :sp target_util.default_stack_protector_buffer_size; }; + const structured_cfg = b: { + if (options.inherited.structured_cfg) |x| break :b x; + if (options.parent) |p| break :b p.structured_cfg; + // We always want a structured control flow in shaders. This option is + // only relevant for OpenCL kernels. + break :b switch (target.os.tag) { + .opencl => false, + else => true, + }; + }; + const llvm_cpu_features: ?[*:0]const u8 = b: { if (resolved_target.llvm_cpu_features) |x| break :b x; if (!options.global.use_llvm) break :b null; @@ -350,6 +364,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { .sanitize_thread = sanitize_thread, .unwind_tables = unwind_tables, .cc_argv = &.{}, + .structured_cfg = structured_cfg, }; break :b new; }; @@ -381,6 +396,7 @@ pub fn create(arena: Allocator, options: CreateOptions) !*Package.Module { .sanitize_thread = sanitize_thread, .unwind_tables = unwind_tables, .cc_argv = options.cc_argv, + .structured_cfg = structured_cfg, }; try mod.deps.ensureUnusedCapacity(arena, 1); @@ -422,6 +438,7 @@ pub fn createLimited(gpa: Allocator, options: LimitedOptions) Allocator.Error!*P .unwind_tables = undefined, .cc_argv = undefined, .generated_builtin_source = undefined, + .structured_cfg = undefined, }; return mod; } |
