diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c06d24715..7a62cbe9c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -515,6 +515,7 @@ set(ZIG_STAGE2_SOURCES "${CMAKE_SOURCE_DIR}/lib/std/zig/system/NativePaths.zig" "${CMAKE_SOURCE_DIR}/lib/std/zig/system/x86.zig" "${CMAKE_SOURCE_DIR}/lib/std/zig/tokenizer.zig" + "${CMAKE_SOURCE_DIR}/lib/std/zig/Zir.zig" "${CMAKE_SOURCE_DIR}/src/Air.zig" "${CMAKE_SOURCE_DIR}/src/AstGen.zig" "${CMAKE_SOURCE_DIR}/src/Compilation.zig" @@ -527,7 +528,6 @@ set(ZIG_STAGE2_SOURCES "${CMAKE_SOURCE_DIR}/src/Sema.zig" "${CMAKE_SOURCE_DIR}/src/TypedValue.zig" "${CMAKE_SOURCE_DIR}/src/Value.zig" - "${CMAKE_SOURCE_DIR}/src/Zir.zig" "${CMAKE_SOURCE_DIR}/src/arch/aarch64/CodeGen.zig" "${CMAKE_SOURCE_DIR}/src/arch/aarch64/Emit.zig" "${CMAKE_SOURCE_DIR}/src/arch/aarch64/Mir.zig" diff --git a/lib/std/zig.zig b/lib/std/zig.zig index f8782d5c9b..38cad68c21 100644 --- a/lib/std/zig.zig +++ b/lib/std/zig.zig @@ -12,6 +12,7 @@ pub const string_literal = @import("zig/string_literal.zig"); pub const number_literal = @import("zig/number_literal.zig"); pub const primitives = @import("zig/primitives.zig"); pub const Ast = @import("zig/Ast.zig"); +pub const Zir = @import("zig/Zir.zig"); pub const system = @import("zig/system.zig"); /// Deprecated: use `std.Target.Query`. pub const CrossTarget = std.Target.Query; diff --git a/src/Zir.zig b/lib/std/zig/Zir.zig similarity index 100% rename from src/Zir.zig rename to lib/std/zig/Zir.zig diff --git a/src/AstGen.zig b/src/AstGen.zig index 375dafe880..20b1077420 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -12,7 +12,7 @@ const StringIndexContext = std.hash_map.StringIndexContext; const isPrimitive = std.zig.primitives.isPrimitive; -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const BuiltinFn = std.zig.BuiltinFn; const AstRlAnnotate = std.zig.AstRlAnnotate; diff --git a/src/Autodoc.zig b/src/Autodoc.zig index 6ede3637f8..f321fadbb7 100644 --- a/src/Autodoc.zig +++ b/src/Autodoc.zig @@ -9,7 +9,7 @@ const File = Zcu.File; const Module = @import("Package.zig").Module; const Tokenizer = std.zig.Tokenizer; const InternPool = @import("InternPool.zig"); -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const Ref = Zir.Inst.Ref; const log = std.log.scoped(.autodoc); const renderer = @import("autodoc/render_source.zig"); diff --git a/src/Compilation.zig b/src/Compilation.zig index 5fa93fa677..d4d2826880 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -35,7 +35,7 @@ const InternPool = @import("InternPool.zig"); const Cache = std.Build.Cache; const c_codegen = @import("codegen/c.zig"); const libtsan = @import("libtsan.zig"); -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const Autodoc = @import("Autodoc.zig"); const resinator = @import("resinator.zig"); const Builtin = @import("Builtin.zig"); diff --git a/src/InternPool.zig b/src/InternPool.zig index 70c332e9ac..5ff179cb74 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -338,7 +338,7 @@ const Hash = std.hash.Wyhash; const InternPool = @This(); const Module = @import("Module.zig"); const Zcu = Module; -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const KeyAdapter = struct { intern_pool: *const InternPool, diff --git a/src/Module.zig b/src/Module.zig index aef54be700..6316979f4c 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -26,7 +26,7 @@ const TypedValue = @import("TypedValue.zig"); const Package = @import("Package.zig"); const link = @import("link.zig"); const Air = @import("Air.zig"); -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const trace = @import("tracy.zig").trace; const AstGen = @import("AstGen.zig"); const Sema = @import("Sema.zig"); diff --git a/src/Sema.zig b/src/Sema.zig index 5c9d7cbb5c..8976848bef 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -148,7 +148,7 @@ const Value = @import("Value.zig"); const Type = @import("type.zig").Type; const TypedValue = @import("TypedValue.zig"); const Air = @import("Air.zig"); -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const Module = @import("Module.zig"); const trace = @import("tracy.zig").trace; const Namespace = Module.Namespace; diff --git a/src/codegen.zig b/src/codegen.zig index 7bcba80065..4856eff7d8 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -21,7 +21,7 @@ const Target = std.Target; const Type = @import("type.zig").Type; const TypedValue = @import("TypedValue.zig"); const Value = @import("Value.zig"); -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const Alignment = InternPool.Alignment; pub const Result = union(enum) { diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 7641da4a94..fb8d1e1e8e 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -10,7 +10,6 @@ const Type = @import("../type.zig").Type; const Value = @import("../Value.zig"); const LazySrcLoc = std.zig.LazySrcLoc; const Air = @import("../Air.zig"); -const Zir = @import("../Zir.zig"); const Liveness = @import("../Liveness.zig"); const InternPool = @import("../InternPool.zig"); diff --git a/src/crash_report.zig b/src/crash_report.zig index cedce84d94..0c2354af4e 100644 --- a/src/crash_report.zig +++ b/src/crash_report.zig @@ -8,7 +8,7 @@ const native_os = builtin.os.tag; const Module = @import("Module.zig"); const Sema = @import("Sema.zig"); -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const Decl = Module.Decl; pub const is_enabled = builtin.mode == .Debug; diff --git a/src/main.zig b/src/main.zig index bb8b25c60e..9522734dea 100644 --- a/src/main.zig +++ b/src/main.zig @@ -6655,7 +6655,7 @@ fn cmdAstCheck( arena: Allocator, args: []const []const u8, ) !void { - const Zir = @import("Zir.zig"); + const Zir = std.zig.Zir; var color: Color = .auto; var want_output_text = false; @@ -6817,7 +6817,7 @@ fn cmdDumpZir( args: []const []const u8, ) !void { _ = arena; - const Zir = @import("Zir.zig"); + const Zir = std.zig.Zir; const cache_file = args[0]; @@ -6877,7 +6877,7 @@ fn cmdChangelist( args: []const []const u8, ) !void { const color: Color = .auto; - const Zir = @import("Zir.zig"); + const Zir = std.zig.Zir; const old_source_file = args[0]; const new_source_file = args[1]; diff --git a/src/print_zir.zig b/src/print_zir.zig index b4c3a7ce24..42c2576ac5 100644 --- a/src/print_zir.zig +++ b/src/print_zir.zig @@ -5,7 +5,7 @@ const assert = std.debug.assert; const Ast = std.zig.Ast; const InternPool = @import("InternPool.zig"); -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const Module = @import("Module.zig"); const LazySrcLoc = std.zig.LazySrcLoc; diff --git a/src/reduce.zig b/src/reduce.zig index 027557bea5..35456fe7c3 100644 --- a/src/reduce.zig +++ b/src/reduce.zig @@ -6,7 +6,7 @@ const fatal = @import("./main.zig").fatal; const Ast = std.zig.Ast; const Walk = @import("reduce/Walk.zig"); const AstGen = @import("AstGen.zig"); -const Zir = @import("Zir.zig"); +const Zir = std.zig.Zir; const usage = \\zig reduce [options] ./checker root_source_file.zig [-- [argv]]