diff options
| author | Robin Voetter <robin@voetter.nl> | 2023-11-24 23:01:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-24 23:01:32 +0100 |
| commit | 608b5d06eace0ccdce816725b8f0d7a6e9c12b81 (patch) | |
| tree | 10bcadb165648f599616789f995c1ec8406cdd93 /src/Compilation.zig | |
| parent | 3acb0e30a06d7ef7ece9257bc3423b9c85a12c06 (diff) | |
| parent | decff512383e8ea8a52583ba0e39617fa24dc79d (diff) | |
| download | zig-608b5d06eace0ccdce816725b8f0d7a6e9c12b81.tar.gz zig-608b5d06eace0ccdce816725b8f0d7a6e9c12b81.zip | |
Merge pull request #18097 from Snektron/spirv-structured-codegen
spirv: structured codegen
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 4917f40b29..7fa1adf528 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -1002,6 +1002,8 @@ pub const InitOptions = struct { /// (Windows) PDB output path pdb_out_path: ?[]const u8 = null, error_limit: ?Module.ErrorInt = null, + /// (SPIR-V) whether to generate a structured control flow graph or not + want_structured_cfg: ?bool = null, }; fn addModuleTableToCacheHash( @@ -1447,6 +1449,8 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { }; const formatted_panics = options.formatted_panics orelse (options.optimize_mode == .Debug); + const error_limit = options.error_limit orelse (std.math.maxInt(u16) - 1); + // We put everything into the cache hash that *cannot be modified // during an incremental update*. For example, one cannot change the // target between updates, but one can change source files, so the @@ -1545,6 +1549,9 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { hash.add(options.skip_linker_dependencies); hash.add(options.parent_compilation_link_libc); hash.add(formatted_panics); + hash.add(options.emit_h != null); + hash.add(error_limit); + hash.addOptional(options.want_structured_cfg); // In the case of incremental cache mode, this `zig_cache_artifact_directory` // is computed based on a hash of non-linker inputs, and it is where all @@ -1699,7 +1706,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .local_zir_cache = local_zir_cache, .emit_h = emit_h, .tmp_hack_arena = std.heap.ArenaAllocator.init(gpa), - .error_limit = options.error_limit orelse (std.math.maxInt(u16) - 1), + .error_limit = error_limit, }; try module.init(); @@ -1958,6 +1965,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .force_undefined_symbols = options.force_undefined_symbols, .pdb_source_path = options.pdb_source_path, .pdb_out_path = options.pdb_out_path, + .want_structured_cfg = options.want_structured_cfg, }); errdefer bin_file.destroy(); comp.* = .{ @@ -2732,6 +2740,7 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes man.hash.add(comp.bin_file.options.valgrind); man.hash.add(comp.bin_file.options.single_threaded); man.hash.add(comp.bin_file.options.use_llvm); + man.hash.add(comp.bin_file.options.use_lib_llvm); man.hash.add(comp.bin_file.options.dll_export_fns); man.hash.add(comp.bin_file.options.is_test); man.hash.add(comp.test_evented_io); @@ -2739,8 +2748,10 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes man.hash.addOptionalBytes(comp.test_name_prefix); man.hash.add(comp.bin_file.options.skip_linker_dependencies); man.hash.add(comp.bin_file.options.parent_compilation_link_libc); + man.hash.add(comp.formatted_panics); man.hash.add(mod.emit_h != null); man.hash.add(mod.error_limit); + man.hash.addOptional(comp.bin_file.options.want_structured_cfg); } try man.addOptionalFile(comp.bin_file.options.linker_script); @@ -6823,6 +6834,7 @@ fn buildOutputFromZig( .clang_passthrough_mode = comp.clang_passthrough_mode, .skip_linker_dependencies = true, .parent_compilation_link_libc = comp.bin_file.options.link_libc, + .want_structured_cfg = comp.bin_file.options.want_structured_cfg, }); defer sub_compilation.destroy(); @@ -6903,6 +6915,7 @@ pub fn build_crt_file( .clang_passthrough_mode = comp.clang_passthrough_mode, .skip_linker_dependencies = true, .parent_compilation_link_libc = comp.bin_file.options.link_libc, + .want_structured_cfg = comp.bin_file.options.want_structured_cfg, }); defer sub_compilation.destroy(); |
