Function to_llvm_features

Source
pub(crate) fn to_llvm_features<'a>(
    sess: &Session,
    s: &'a str,
) -> Option<LLVMFeature<'a>>
Expand description

Convert a Rust feature name to an LLVM feature name. Returning None means the feature should be skipped, usually because it is not supported by the current LLVM version.

WARNING: the features after applying to_llvm_features must be known to LLVM or the feature detection code will walk past the end of the feature array, leading to crashes.

To find a list of LLVM’s names, see llvm-project/llvm/lib/Target/{ARCH}/*.td where {ARCH} is the architecture name. Look for instances of SubtargetFeature.

Check the current rustc fork of LLVM in the repo at https://github.com/rust-lang/llvm-project/. The commit in use can be found via the llvm-project submodule in https://github.com/rust-lang/rust/tree/master/src Though note that Rust can also be build with an external precompiled version of LLVM which might lead to failures if the oldest tested / supported LLVM version doesn’t yet support the relevant intrinsics.