Pass -DLLVM_RUSTLLVM to compile against rust llvm fork.
If using system llvm don't try use modifications made in the fork.
This commit is contained in:
parent
6aee1e2a67
commit
ce50bedd8c
2 changed files with 23 additions and 3 deletions
|
@ -32,6 +32,11 @@ RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
|
||||||
$$(call CFG_CC_INCLUDE_$(1),$$(S)src/rustllvm/include)
|
$$(call CFG_CC_INCLUDE_$(1),$$(S)src/rustllvm/include)
|
||||||
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
|
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=$(1)/rustllvm/%.o)
|
||||||
|
|
||||||
|
# Flag that we are building with Rust's llvm fork
|
||||||
|
ifeq ($(CFG_LLVM_ROOT),)
|
||||||
|
RUSTLLVM_CXXFLAGS_$(1) := -DLLVM_RUSTLLVM
|
||||||
|
endif
|
||||||
|
|
||||||
# Note that we appease `cl.exe` and its need for some sort of exception
|
# Note that we appease `cl.exe` and its need for some sort of exception
|
||||||
# handling flag with the `EHsc` argument here as well.
|
# handling flag with the `EHsc` argument here as well.
|
||||||
ifeq ($$(findstring msvc,$(1)),msvc)
|
ifeq ($$(findstring msvc,$(1)),msvc)
|
||||||
|
@ -55,6 +60,7 @@ $(1)/rustllvm/%.o: $(S)src/rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
|
||||||
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@,) \
|
$$(Q)$$(call CFG_COMPILE_CXX_$(1), $$@,) \
|
||||||
$$(subst /,//,$$(LLVM_CXXFLAGS_$(1))) \
|
$$(subst /,//,$$(LLVM_CXXFLAGS_$(1))) \
|
||||||
$$(RUSTLLVM_COMPONENTS_$(1)) \
|
$$(RUSTLLVM_COMPONENTS_$(1)) \
|
||||||
|
$$(RUSTLLVM_CXXFLAGS_$(1)) \
|
||||||
$$(EXTRA_RUSTLLVM_CXXFLAGS_$(1)) \
|
$$(EXTRA_RUSTLLVM_CXXFLAGS_$(1)) \
|
||||||
$$(RUSTLLVM_INCS_$(1)) \
|
$$(RUSTLLVM_INCS_$(1)) \
|
||||||
$$<
|
$$<
|
||||||
|
|
|
@ -162,6 +162,7 @@ LLVMRustHasFeature(LLVMTargetMachineRef TM,
|
||||||
return (Bits & FeatureEntry->Value) == FeatureEntry->Value;
|
return (Bits & FeatureEntry->Value) == FeatureEntry->Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LLVM_RUSTLLVM
|
||||||
/// getLongestEntryLength - Return the length of the longest entry in the table.
|
/// getLongestEntryLength - Return the length of the longest entry in the table.
|
||||||
///
|
///
|
||||||
static size_t getLongestEntryLength(ArrayRef<SubtargetFeatureKV> Table) {
|
static size_t getLongestEntryLength(ArrayRef<SubtargetFeatureKV> Table) {
|
||||||
|
@ -178,7 +179,7 @@ LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM) {
|
||||||
const ArrayRef<SubtargetFeatureKV> CPUTable = MCInfo->getCPUTable();
|
const ArrayRef<SubtargetFeatureKV> CPUTable = MCInfo->getCPUTable();
|
||||||
unsigned MaxCPULen = getLongestEntryLength(CPUTable);
|
unsigned MaxCPULen = getLongestEntryLength(CPUTable);
|
||||||
|
|
||||||
printf("Available CPUs for this target:\n\n");
|
printf("Available CPUs for this target:\n");
|
||||||
for (auto &CPU : CPUTable)
|
for (auto &CPU : CPUTable)
|
||||||
printf(" %-*s - %s.\n", MaxCPULen, CPU.Key, CPU.Desc);
|
printf(" %-*s - %s.\n", MaxCPULen, CPU.Key, CPU.Desc);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -191,15 +192,28 @@ LLVMRustPrintTargetFeatures(LLVMTargetMachineRef TM) {
|
||||||
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable();
|
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable();
|
||||||
unsigned MaxFeatLen = getLongestEntryLength(FeatTable);
|
unsigned MaxFeatLen = getLongestEntryLength(FeatTable);
|
||||||
|
|
||||||
printf("Available features for this target:\n\n");
|
printf("Available features for this target:\n");
|
||||||
for (auto &Feature : FeatTable)
|
for (auto &Feature : FeatTable)
|
||||||
printf(" %-*s - %s.\n", MaxFeatLen, Feature.Key, Feature.Desc);
|
printf(" %-*s - %s.\n", MaxFeatLen, Feature.Key, Feature.Desc);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
printf("Use +feature to enable a feature, or -feature to disable it.\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
|
extern "C" LLVMTargetMachineRef
|
||||||
LLVMRustCreateTargetMachine(const char *triple,
|
LLVMRustCreateTargetMachine(const char *triple,
|
||||||
const char *cpu,
|
const char *cpu,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue