Skip to content

Commit

Permalink
add some missing targets
Browse files Browse the repository at this point in the history
WIP: try to get a compilable zig, even with some todos
  • Loading branch information
gwenzek committed Mar 28, 2022
1 parent 5466e87 commit 1465510
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/codegen/llvm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ pub const Object = struct {
} else {
_ = self.llvm_module.addAlias(
llvm_global.typeOf(),
0, // TODO(gwenzek) addrSpace
llvm_global,
exp_name_z,
);
Expand Down
5 changes: 4 additions & 1 deletion src/codegen/llvm/bindings.zig
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@ pub const Builder = opaque {
pub const buildStore = LLVMBuildStore;
extern fn LLVMBuildStore(*const Builder, Val: *const Value, Ptr: *const Value) *const Value;

pub const buildLoad = LLVMBuildLoad2;
pub const buildLoad = LLVMBuildLoad;
extern fn LLVMBuildLoad(*const Builder, PointerVal: *const Value, Name: [*:0]const u8) *const Value;
// TODO(gwenzek): replace buildLoad with buildLoad2
pub const buildLoad2 = LLVMBuildLoad2;
extern fn LLVMBuildLoad2(*const Builder, Ty: *const Type, PointerVal: *const Value, Name: [*:0]const u8) *const Value;

pub const buildNeg = LLVMBuildNeg;
Expand Down
6 changes: 3 additions & 3 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4129,11 +4129,11 @@ pub fn punt_to_lld(arena: Allocator, args: []const []const u8) error{OutOfMemory
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);
break :rc llvm.LinkELF(argc, argv.ptr, true, false);
} else if (mem.eql(u8, args[1], "lld-link")) {
break :rc llvm.LinkCOFF(argc, argv.ptr, true);
break :rc llvm.LinkCOFF(argc, argv.ptr, true, false);
} else if (mem.eql(u8, args[1], "wasm-ld")) {
break :rc llvm.LinkWasm(argc, argv.ptr, true);
break :rc llvm.LinkWasm(argc, argv.ptr, true, false);
} else {
unreachable;
}
Expand Down
8 changes: 8 additions & 0 deletions src/stage1/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ uint32_t target_arch_pointer_bit_width(ZigLLVM_ArchType arch) {
case ZigLLVM_amdil:
case ZigLLVM_hsail:
case ZigLLVM_spir:
case ZigLLVM_spirv32:
case ZigLLVM_kalimba:
case ZigLLVM_lanai:
case ZigLLVM_shave:
Expand Down Expand Up @@ -551,6 +552,7 @@ uint32_t target_arch_pointer_bit_width(ZigLLVM_ArchType arch) {
case ZigLLVM_amdil64:
case ZigLLVM_hsail64:
case ZigLLVM_spir64:
case ZigLLVM_spirv64:
case ZigLLVM_wasm64:
case ZigLLVM_renderscript64:
case ZigLLVM_ve:
Expand Down Expand Up @@ -592,6 +594,7 @@ uint32_t target_arch_largest_atomic_bits(ZigLLVM_ArchType arch) {
case ZigLLVM_amdil:
case ZigLLVM_hsail:
case ZigLLVM_spir:
case ZigLLVM_spirv32:
case ZigLLVM_kalimba:
case ZigLLVM_lanai:
case ZigLLVM_shave:
Expand All @@ -618,6 +621,7 @@ uint32_t target_arch_largest_atomic_bits(ZigLLVM_ArchType arch) {
case ZigLLVM_amdil64:
case ZigLLVM_hsail64:
case ZigLLVM_spir64:
case ZigLLVM_spirv64:
case ZigLLVM_wasm64:
case ZigLLVM_renderscript64:
case ZigLLVM_ve:
Expand Down Expand Up @@ -849,6 +853,8 @@ const char *arch_stack_pointer_register_name(ZigLLVM_ArchType arch) {
case ZigLLVM_sparcv9:
case ZigLLVM_spir:
case ZigLLVM_spir64:
case ZigLLVM_spirv32:
case ZigLLVM_spirv64:
case ZigLLVM_systemz:
case ZigLLVM_tce:
case ZigLLVM_tcele:
Expand Down Expand Up @@ -909,6 +915,8 @@ bool target_is_arm(const ZigTarget *target) {
case ZigLLVM_sparcv9:
case ZigLLVM_spir:
case ZigLLVM_spir64:
case ZigLLVM_spirv32:
case ZigLLVM_spirv64:
case ZigLLVM_systemz:
case ZigLLVM_tce:
case ZigLLVM_tcele:
Expand Down
2 changes: 1 addition & 1 deletion src/translate_c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4788,7 +4788,7 @@ fn transType(c: *Context, scope: *Scope, ty: *const clang.Type, source_loc: clan
.rhs = try transQualType(c, scope, element_qt, source_loc),
});
},
.ExtInt, .ExtVector => {
.BitInt, .ExtVector => {
const type_name = c.str(ty.getTypeClassName());
return fail(c, error.UnsupportedType, source_loc, "TODO implement translation of type: '{s}'", .{type_name});
},
Expand Down

0 comments on commit 1465510

Please sign in to comment.