Target: pass and use locals by pointer instead of by value

This struct is larger than 256 bytes and code that copies it
consistently shows up in profiles of the compiler.
This commit is contained in:
Jacob Young
2025-06-13 04:46:30 -04:00
parent 16d78bc0c0
commit 917640810e
96 changed files with 400 additions and 401 deletions

View File

@@ -107,7 +107,7 @@ gpa: Allocator,
arena: std.heap.ArenaAllocator,
/// Target info
target: std.Target,
target: *const std.Target,
/// The target SPIR-V version
version: spec.Version,
@@ -187,7 +187,7 @@ decl_deps: std.ArrayListUnmanaged(Decl.Index) = .empty,
/// The list of entry points that should be exported from this module.
entry_points: std.AutoArrayHashMapUnmanaged(IdRef, EntryPoint) = .empty,
pub fn init(gpa: Allocator, target: std.Target) Module {
pub fn init(gpa: Allocator, target: *const std.Target) Module {
const version_minor: u8 = blk: {
// Prefer higher versions
if (target.cpu.has(.spirv, .v1_6)) break :blk 6;