stage2: rename and move files related to LLVM backend
This commit is contained in:
@@ -541,6 +541,8 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/aarch64.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/arm.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/c.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/llvm.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/llvm/bindings.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/riscv64.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/spu-mk2.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/codegen/wasm.zig"
|
||||
@@ -562,8 +564,6 @@ set(ZIG_STAGE2_SOURCES
|
||||
"${CMAKE_SOURCE_DIR}/src/link/cbe.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/link/msdos-stub.bin"
|
||||
"${CMAKE_SOURCE_DIR}/src/liveness.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/llvm_backend.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/llvm_bindings.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/main.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/mingw.zig"
|
||||
"${CMAKE_SOURCE_DIR}/src/musl.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) {
|
||||
|
||||
@@ -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) {
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -31,7 +31,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
try @import("spu-ii.zig").addCases(ctx);
|
||||
try @import("arm.zig").addCases(ctx);
|
||||
try @import("aarch64.zig").addCases(ctx);
|
||||
try @import("llvm_backend.zig").addCases(ctx);
|
||||
try @import("llvm.zig").addCases(ctx);
|
||||
|
||||
{
|
||||
var case = ctx.exe("hello world with updates", linux_x64);
|
||||
|
||||
Reference in New Issue
Block a user