From ce50bedd8ce2bca3bde12f6397f6d13889d2dae1 Mon Sep 17 00:00:00 2001 From: Cameron Hart Date: Sun, 24 Jul 2016 19:49:10 +1000 Subject: Pass -DLLVM_RUSTLLVM to compile against rust llvm fork. If using system llvm don't try use modifications made in the fork. --- src/rustllvm/PassWrapper.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/rustllvm/PassWrapper.cpp') diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index 962e81b018b..b94e667701c 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -162,6 +162,7 @@ LLVMRustHasFeature(LLVMTargetMachineRef TM, return (Bits & FeatureEntry->Value) == FeatureEntry->Value; } +#if LLVM_RUSTLLVM /// getLongestEntryLength - Return the length of the longest entry in the table. /// static size_t getLongestEntryLength(ArrayRef Table) { @@ -178,7 +179,7 @@ LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) { const ArrayRef CPUTable = MCInfo->getCPUTable(); unsigned MaxCPULen = getLongestEntryLength(CPUTable); - printf("Available CPUs for this target:\n\n"); + printf("Available CPUs for this target:\n"); for (auto &CPU : CPUTable) printf(" %-*s - %s.\n", MaxCPULen, CPU.Key, CPU.Desc); printf("\n"); @@ -191,15 +192,28 @@ LLVMRustPrintTargetFeatures(LLVMTargetMachineRef TM) { const ArrayRef FeatTable = MCInfo->getFeatureTable(); unsigned MaxFeatLen = getLongestEntryLength(FeatTable); - printf("Available features for this target:\n\n"); + printf("Available features for this target:\n"); for (auto &Feature : FeatTable) printf(" %-*s - %s.\n", MaxFeatLen, Feature.Key, Feature.Desc); printf("\n"); printf("Use +feature to enable a feature, or -feature to disable it.\n" - "For example, rustc -C -target-cpu=mycpu -C target-feature=+feature1,-feature2\n"); + "For example, rustc -C -target-cpu=mycpu -C target-feature=+feature1,-feature2\n\n"); } +#else + +extern "C" void +LLVMRustPrintTargetCPUs(LLVMTargetMachineRef) { + printf("Target CPU help is not supported by this LLVM version.\n\n"); +} + +extern "C" void +LLVMRustPrintTargetFeatures(LLVMTargetMachineRef) { + printf("Target features help is not supported by this LLVM version.\n\n"); +} +#endif + extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(const char *triple, const char *cpu, -- cgit 1.4.1-3-g733a5