Use MCSubtargetInfo::getAllProcessorFeatures()
This method is now available in upstream LLVM \o/
This commit is contained in:
parent
85eaadfc01
commit
a911c8ce23
@ -368,10 +368,10 @@ extern "C" void LLVMRustPrintTargetCPUs(LLVMTargetMachineRef TM,
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) {
|
extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) {
|
||||||
#ifdef LLVM_RUSTLLVM
|
#if LLVM_VERSION_GE(18, 0)
|
||||||
const TargetMachine *Target = unwrap(TM);
|
const TargetMachine *Target = unwrap(TM);
|
||||||
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
|
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
|
||||||
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable();
|
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getAllProcessorFeatures();
|
||||||
return FeatTable.size();
|
return FeatTable.size();
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
@ -380,10 +380,10 @@ extern "C" size_t LLVMRustGetTargetFeaturesCount(LLVMTargetMachineRef TM) {
|
|||||||
|
|
||||||
extern "C" void LLVMRustGetTargetFeature(LLVMTargetMachineRef TM, size_t Index,
|
extern "C" void LLVMRustGetTargetFeature(LLVMTargetMachineRef TM, size_t Index,
|
||||||
const char** Feature, const char** Desc) {
|
const char** Feature, const char** Desc) {
|
||||||
#ifdef LLVM_RUSTLLVM
|
#if LLVM_VERSION_GE(18, 0)
|
||||||
const TargetMachine *Target = unwrap(TM);
|
const TargetMachine *Target = unwrap(TM);
|
||||||
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
|
const MCSubtargetInfo *MCInfo = Target->getMCSubtargetInfo();
|
||||||
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getFeatureTable();
|
const ArrayRef<SubtargetFeatureKV> FeatTable = MCInfo->getAllProcessorFeatures();
|
||||||
const SubtargetFeatureKV Feat = FeatTable[Index];
|
const SubtargetFeatureKV Feat = FeatTable[Index];
|
||||||
*Feature = Feat.Key;
|
*Feature = Feat.Key;
|
||||||
*Desc = Feat.Desc;
|
*Desc = Feat.Desc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user