rustc_codegen_llvm: Filter out unavailable LLVM features
Convert to_llvm_features to return Option<LLVMFeature> so that it can return None if the requested feature is not available for the current LLVM version. Add match rules to filter out aarch64 features not available in LLVM 17.
This commit is contained in:
parent
4fc4019cbc
commit
3a0fbb5d4e
2 changed files with 63 additions and 38 deletions
|
@ -521,9 +521,10 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
|
|||
|
||||
let function_features = function_features
|
||||
.iter()
|
||||
.flat_map(|feat| {
|
||||
llvm_util::to_llvm_features(cx.tcx.sess, feat).into_iter().map(|f| format!("+{f}"))
|
||||
})
|
||||
// Convert to LLVMFeatures and filter out unavailable ones
|
||||
.flat_map(|feat| llvm_util::to_llvm_features(cx.tcx.sess, feat))
|
||||
// Convert LLVMFeatures & dependencies to +<feats>s
|
||||
.flat_map(|feat| feat.into_iter().map(|f| format!("+{f}")))
|
||||
.chain(codegen_fn_attrs.instruction_set.iter().map(|x| match x {
|
||||
InstructionSetAttr::ArmA32 => "-thumb-mode".to_string(),
|
||||
InstructionSetAttr::ArmT32 => "+thumb-mode".to_string(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue