From 206f96d474cb24cd8c00721b7ade96633b6b239f Mon Sep 17 00:00:00 2001 From: Koakuma Date: Sat, 22 Aug 2020 14:35:03 +0700 Subject: [PATCH] Add sparc64 linux C ABI --- src/stage1/analyze.cpp | 5 +++-- src/stage1/target.cpp | 4 ++++ src/stage1/target.hpp | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/stage1/analyze.cpp b/src/stage1/analyze.cpp index 04c064efe394a6be189047df5a26048a8f172494..d5f57aee815142f38724cb316be5907c5d47b861 100644 --- a/src/stage1/analyze.cpp +++ b/src/stage1/analyze.cpp @@ -1016,6 +1016,7 @@ bool want_first_arg_sret(CodeGen *g, FnTypeId *fn_type_id) { target_is_arm(g->zig_target) || target_is_riscv(g->zig_target) || target_is_wasm(g->zig_target) || + target_is_sparc(g->zig_target) || target_is_ppc(g->zig_target)) { X64CABIClass abi_class = type_c_abi_x86_64_class(g, fn_type_id->return_type); @@ -1988,7 +1989,7 @@ static ZigType *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *child_sc // behaviour when checking expected alignment with `@ptrToInt(fn_ptr)` // or similar. This commit proposes to make `align` expressions a // compile error when compiled to Wasm architecture. - // + // // Some references: // [1] [Mozilla: WebAssembly Tables](https://developer.mozilla.org/en-US/docs/WebAssembly/Understanding_the_text_format#WebAssembly_tables) // [2] [Sunfishcode's Wasm Ref Manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md#indirect-call) @@ -9044,7 +9045,7 @@ static void resolve_llvm_types_optional(CodeGen *g, ZigType *type, ResolveStatus 8 * child_type->abi_align, val_offset_in_bits, ZigLLVM_DIFlags_Zero, child_llvm_di_type); - di_element_types[maybe_null_index] = + di_element_types[maybe_null_index] = ZigLLVMCreateDebugMemberType(g->dbuilder, ZigLLVMTypeToScope(type->llvm_di_type), "maybe", di_file, line, 8*g->builtin_types.entry_bool->abi_size, diff --git a/src/stage1/target.cpp b/src/stage1/target.cpp index 433c988a01eb47231c05386f1122d59ea45d500d..f10e95d04ca3e811c990ab810b91d3076060b8b8 100644 --- a/src/stage1/target.cpp +++ b/src/stage1/target.cpp @@ -1196,6 +1196,10 @@ bool target_is_riscv(const ZigTarget *target) { return target->arch == ZigLLVM_riscv32 || target->arch == ZigLLVM_riscv64; } +bool target_is_sparc(const ZigTarget *target) { + return target->arch == ZigLLVM_sparc || target->arch == ZigLLVM_sparcv9; +} + bool target_is_mips(const ZigTarget *target) { return target->arch == ZigLLVM_mips || target->arch == ZigLLVM_mipsel || target->arch == ZigLLVM_mips64 || target->arch == ZigLLVM_mips64el; diff --git a/src/stage1/target.hpp b/src/stage1/target.hpp index d34c2aeae50da1897383f6ca09e606e1c42a994c..099c3c1e7898526b57754bed8af112c368fc793f 100644 --- a/src/stage1/target.hpp +++ b/src/stage1/target.hpp @@ -86,6 +86,7 @@ bool target_is_glibc(const ZigTarget *target); bool target_is_musl(const ZigTarget *target); bool target_is_wasm(const ZigTarget *target); bool target_is_riscv(const ZigTarget *target); +bool target_is_sparc(const ZigTarget *target); bool target_is_android(const ZigTarget *target); bool target_has_debug_info(const ZigTarget *target); const char *target_arch_musl_name(ZigLLVM_ArchType arch); -- 2.54.0