authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-05 18:23:54-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-05 18:23:54-05:00
logb9c943b0667ed8253382cb787d4705f6619f7296
treeca7a8ca8de7c6475dbfd23c7d23a37dc62cbdaaa
parent0c88b1ce73a926e60464c96a5a3f8ac8d9f84a8c

tell LLVM the target sub arch type


3 files changed, 10 insertions(+), 24 deletions(-)

src/target.cpp+10-3
......@@ -5,9 +5,10 @@
55 * See http://opensource.org/licenses/MIT
66 */
77
8#include "buffer.hpp"
9#include "error.hpp"
810#include "target.hpp"
911#include "util.hpp"
10#include "error.hpp"
1112
1213#include <stdio.h>
1314
......@@ -282,8 +283,14 @@ void init_all_targets(void) {
282283}
283284
284285void get_target_triple(Buf *triple, const ZigTarget *target) {
285 ZigLLVMGetTargetTriple(triple, target->arch.arch, target->arch.sub_arch,
286 target->vendor, target->os, target->env_type, target->oformat);
286 char arch_name[50];
287 get_arch_name(arch_name, &target->arch);
288
289 buf_resize(triple, 0);
290 buf_appendf(triple, "%s-%s-%s-%s", arch_name,
291 ZigLLVMGetVendorTypeName(target->vendor),
292 ZigLLVMGetOSTypeName(target->os),
293 ZigLLVMGetEnvironmentTypeName(target->env_type));
287294}
288295
289296static bool is_os_darwin(ZigTarget *target) {
src/zig_llvm.cpp-18
......@@ -708,24 +708,6 @@ LLVMValueRef ZigLLVMBuildExactUDiv(LLVMBuilderRef B, LLVMValueRef LHS,
708708
709709#include "buffer.hpp"
710710
711void ZigLLVMGetTargetTriple(Buf *out_buf, ZigLLVM_ArchType arch_type, ZigLLVM_SubArchType sub_arch_type,
712 ZigLLVM_VendorType vendor_type, ZigLLVM_OSType os_type, ZigLLVM_EnvironmentType environ_type,
713 ZigLLVM_ObjectFormatType oformat)
714{
715 Triple triple;
716
717 triple.setArch((Triple::ArchType)arch_type);
718 // TODO how to set the sub arch?
719 triple.setVendor((Triple::VendorType)vendor_type);
720 triple.setOS((Triple::OSType)os_type);
721 triple.setEnvironment((Triple::EnvironmentType)environ_type);
722 // I guess it's a "triple" because we don't set the object format?
723 //triple.setObjectFormat((Triple::ObjectFormatType)oformat);
724
725 const std::string &str = triple.str();
726 buf_init_from_mem(out_buf, str.c_str(), str.size());
727}
728
729711enum FloatAbi {
730712 FloatAbiHard,
731713 FloatAbiSoft,
src/zig_llvm.hpp-3
......@@ -347,9 +347,6 @@ struct Buf;
347347void ZigLLVMGetNativeTarget(ZigLLVM_ArchType *arch_type, ZigLLVM_SubArchType *sub_arch_type,
348348 ZigLLVM_VendorType *vendor_type, ZigLLVM_OSType *os_type, ZigLLVM_EnvironmentType *environ_type,
349349 ZigLLVM_ObjectFormatType *oformat);
350void ZigLLVMGetTargetTriple(Buf *out_buf, ZigLLVM_ArchType arch_type, ZigLLVM_SubArchType sub_arch_type,
351 ZigLLVM_VendorType vendor_type, ZigLLVM_OSType os_type, ZigLLVM_EnvironmentType environ_type,
352 ZigLLVM_ObjectFormatType oformat);
353350
354351
355352Buf *get_dynamic_linker(LLVMTargetMachineRef target_machine);