Skip to content

Commit 0cd0ca9

Browse files
committed
Use MCSubtargetInfo::getAllProcessorFeatures()
This method is now available in upstream LLVM \o/
1 parent cc3b06f commit 0cd0ca9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

.gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
shallow = true
3333
[submodule "src/llvm-project"]
3434
path = src/llvm-project
35-
url = https://github.com/rust-lang/llvm-project.git
36-
branch = rustc/17.0-2023-12-14
35+
url = https://github.com/nikic/llvm-project.git
36+
branch = rust-llvm-18
3737
shallow = true
3838
[submodule "src/doc/embedded-book"]
3939
path = src/doc/embedded-book

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -368,10 +368,10 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM,
368368
}
369369

370370
extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) {
371-
#ifdef LLVM_RUSTLLVM
371+
#if LLVM_VERSION_GE(18, 0)
372372
const TargetMachine *Target = unwrap(TM);
373373
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
374-
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable();
374+
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getAllProcessorFeatures();
375375
return FeatTable.size();
376376
#else
377377
return 0;
@@ -380,10 +380,10 @@ extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) {
380380

381381
extern "C" void LLVMRustGetTargetFeature(LLVMTargetMachineRef TM, size_t Index,
382382
const char** Feature, const char** Desc) {
383-
#ifdef LLVM_RUSTLLVM
383+
#if LLVM_VERSION_GE(18, 0)
384384
const TargetMachine *Target = unwrap(TM);
385385
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
386-
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable();
386+
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getAllProcessorFeatures();
387387
const SubtargetFeatureKV Feat = FeatTable[Index];
388388
*Feature = Feat.Key;
389389
*Desc = Feat.Desc;

0 commit comments

Comments
 (0)