diff options
| author | Timon Kruiper <timonkruiper@gmail.com> | 2021-01-06 01:27:06 +0100 |
|---|---|---|
| committer | Timon Kruiper <timonkruiper@gmail.com> | 2021-01-06 10:52:20 +0100 |
| commit | b1cfa923bee5210fd78c7508d1af92dde3361c8c (patch) | |
| tree | 78269824764b068cec780d0947e1e64f8c0abc8b /src | |
| parent | 31d1ec4c2fd0d1e07e0020b19b7bca8196d7879c (diff) | |
| download | zig-b1cfa923bee5210fd78c7508d1af92dde3361c8c.tar.gz zig-b1cfa923bee5210fd78c7508d1af92dde3361c8c.zip | |
stage2: rename and move files related to LLVM backend
Diffstat (limited to 'src')
| -rw-r--r-- | src/Compilation.zig | 2 | ||||
| -rw-r--r-- | src/codegen/llvm.zig (renamed from src/llvm_backend.zig) | 16 | ||||
| -rw-r--r-- | src/codegen/llvm/bindings.zig (renamed from src/llvm_bindings.zig) | 3 | ||||
| -rw-r--r-- | src/link.zig | 2 | ||||
| -rw-r--r-- | src/link/Coff.zig | 2 | ||||
| -rw-r--r-- | src/link/Elf.zig | 2 | ||||
| -rw-r--r-- | src/main.zig | 6 | ||||
| -rw-r--r-- | src/mingw.zig | 2 | ||||
| -rw-r--r-- | src/target.zig | 2 |
9 files changed, 17 insertions, 20 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 9912520437..77f9f79bae 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2116,7 +2116,7 @@ pub fn addCCArgs( try argv.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); } - const llvm_triple = try @import("llvm_backend.zig").targetTriple(arena, target); + const llvm_triple = try @import("codegen/llvm.zig").targetTriple(arena, target); try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); switch (ext) { diff --git a/src/llvm_backend.zig b/src/codegen/llvm.zig index 2bac4523c9..df97f7e0ef 100644 --- a/src/llvm_backend.zig +++ b/src/codegen/llvm.zig @@ -1,18 +1,18 @@ const std = @import("std"); const assert = std.debug.assert; const Allocator = std.mem.Allocator; -const Compilation = @import("Compilation.zig"); -const llvm = @import("llvm_bindings.zig"); -const link = @import("link.zig"); +const Compilation = @import("../Compilation.zig"); +const llvm = @import("llvm/bindings.zig"); +const link = @import("../link.zig"); const log = std.log.scoped(.codegen); -const Module = @import("Module.zig"); -const TypedValue = @import("TypedValue.zig"); -const ir = @import("ir.zig"); +const Module = @import("../Module.zig"); +const TypedValue = @import("../TypedValue.zig"); +const ir = @import("../ir.zig"); const Inst = ir.Inst; -const Value = @import("value.zig").Value; -const Type = @import("type.zig").Type; +const Value = @import("../value.zig").Value; +const Type = @import("../type.zig").Type; pub fn targetTriple(allocator: *Allocator, target: std.Target) ![:0]u8 { const llvm_arch = switch (target.cpu.arch) { diff --git a/src/llvm_bindings.zig b/src/codegen/llvm/bindings.zig index 1af64e85f6..cd928877b1 100644 --- a/src/llvm_bindings.zig +++ b/src/codegen/llvm/bindings.zig @@ -1,9 +1,6 @@ //! We do this instead of @cImport because the self-hosted compiler is easier //! to bootstrap if it does not depend on translate-c. -const std = @import("std"); -const assert = std.debug.assert; - const LLVMBool = bool; pub const AttributeIndex = c_uint; diff --git a/src/link.zig b/src/link.zig index 3dbfb3b922..7893e69cd5 100644 --- a/src/link.zig +++ b/src/link.zig @@ -567,7 +567,7 @@ pub const File = struct { std.debug.print("\n", .{}); } - const llvm = @import("llvm_bindings.zig"); + const llvm = @import("codegen/llvm/bindings.zig"); const os_type = @import("target.zig").osToLLVM(base.options.target.os.tag); const bad = llvm.WriteArchive(full_out_path_z, object_files.items.ptr, object_files.items.len, os_type); if (bad) return error.UnableToWriteArchive; diff --git a/src/link/Coff.zig b/src/link/Coff.zig index 117bdef4a7..f7d646356c 100644 --- a/src/link/Coff.zig +++ b/src/link/Coff.zig @@ -16,7 +16,7 @@ const link = @import("../link.zig"); const build_options = @import("build_options"); const Cache = @import("../Cache.zig"); const mingw = @import("../mingw.zig"); -const llvm_backend = @import("../llvm_backend.zig"); +const llvm_backend = @import("../codegen/llvm.zig"); const allocation_padding = 4 / 3; const minimum_text_block_size = 64 * allocation_padding; diff --git a/src/link/Elf.zig b/src/link/Elf.zig index b6b8fd7750..f3073824a5 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -24,7 +24,7 @@ const build_options = @import("build_options"); const target_util = @import("../target.zig"); const glibc = @import("../glibc.zig"); const Cache = @import("../Cache.zig"); -const llvm_backend = @import("../llvm_backend.zig"); +const llvm_backend = @import("../codegen/llvm.zig"); const default_entry_addr = 0x8000000; diff --git a/src/main.zig b/src/main.zig index f026b6b4b4..ac31437f85 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1703,7 +1703,7 @@ fn buildOutputType( if (build_options.have_llvm and emit_asm != .no) { // LLVM has no way to set this non-globally. const argv = [_][*:0]const u8{ "zig (LLVM option parsing)", "--x86-asm-syntax=intel" }; - @import("llvm_bindings.zig").ParseCommandLineOptions(argv.len, &argv); + @import("codegen/llvm/bindings.zig").ParseCommandLineOptions(argv.len, &argv); } gimmeMoreOfThoseSweetSweetFileDescriptors(); @@ -2890,7 +2890,7 @@ pub fn punt_to_lld(arena: *Allocator, args: []const []const u8) error{OutOfMemor argv[i] = try arena.dupeZ(u8, arg); // TODO If there was an argsAllocZ we could avoid this allocation. } const exit_code = rc: { - const llvm = @import("llvm_bindings.zig"); + const llvm = @import("codegen/llvm/bindings.zig"); const argc = @intCast(c_int, argv.len); if (mem.eql(u8, args[1], "ld.lld")) { break :rc llvm.LinkELF(argc, argv.ptr, true); @@ -3275,7 +3275,7 @@ fn detectNativeTargetInfo(gpa: *Allocator, cross_target: std.zig.CrossTarget) !s if (!build_options.have_llvm) fatal("CPU features detection is not yet available for {s} without LLVM extensions", .{@tagName(arch)}); - const llvm = @import("llvm_bindings.zig"); + const llvm = @import("codegen/llvm/bindings.zig"); const llvm_cpu_name = llvm.GetHostCPUName(); const llvm_cpu_features = llvm.GetNativeFeatures(); info.target.cpu = try detectNativeCpuWithLLVM(arch, llvm_cpu_name, llvm_cpu_features); diff --git a/src/mingw.zig b/src/mingw.zig index d55cc28b2b..0a7669f995 100644 --- a/src/mingw.zig +++ b/src/mingw.zig @@ -405,7 +405,7 @@ pub fn buildImportLib(comp: *Compilation, lib_name: []const u8) !void { }); errdefer comp.gpa.free(lib_final_path); - const llvm = @import("llvm_bindings.zig"); + const llvm = @import("codegen/llvm/bindings.zig"); const arch_type = @import("target.zig").archToLLVM(target.cpu.arch); const def_final_path_z = try arena.dupeZ(u8, def_final_path); const lib_final_path_z = try arena.dupeZ(u8, lib_final_path); diff --git a/src/target.zig b/src/target.zig index d33e8d06b0..daac577c7b 100644 --- a/src/target.zig +++ b/src/target.zig @@ -1,5 +1,5 @@ const std = @import("std"); -const llvm = @import("llvm_bindings.zig"); +const llvm = @import("codegen/llvm/bindings.zig"); pub const ArchOsAbi = struct { arch: std.Target.Cpu.Arch, |
