LLVM 20.0.0git
|
Manages the enabling and disabling of subtarget specific features. More...
#include "llvm/TargetParser/SubtargetFeature.h"
Public Member Functions | |
SubtargetFeatures (StringRef Initial="") | |
std::string | getString () const |
Returns features as a string. | |
void | AddFeature (StringRef String, bool Enable=true) |
Adds Features. | |
void | addFeaturesVector (const ArrayRef< std::string > OtherFeatures) |
const std::vector< std::string > & | getFeatures () const |
Returns the vector of individual subtarget features. | |
void | print (raw_ostream &OS) const |
Prints feature string. | |
void | dump () const |
void | getDefaultSubtargetFeatures (const Triple &Triple) |
Adds the default features for the specified target triple. | |
Static Public Member Functions | |
static bool | hasFlag (StringRef Feature) |
Determine if a feature has a flag; '+' or '-'. | |
static StringRef | StripFlag (StringRef Feature) |
Return string stripped of flag. | |
static bool | isEnabled (StringRef Feature) |
Return true if enable flag; '+'. | |
static void | Split (std::vector< std::string > &V, StringRef S) |
Splits a string of comma separated items in to a vector of strings. | |
Manages the enabling and disabling of subtarget specific features.
Features are encoded as a string of the form "+attr1,+attr2,-attr3,...,+attrN" A comma separates each feature from the next (all lowercase.) Each of the remaining features is prefixed with + or - indicating whether that feature should be enabled or disabled contrary to the cpu specification.
Definition at line 174 of file SubtargetFeature.h.
|
explicit |
Definition at line 50 of file SubtargetFeature.cpp.
References Split().
Adds Features.
Definition at line 37 of file SubtargetFeature.cpp.
References llvm::Enable, hasFlag(), and llvm::String.
Referenced by llvm::orc::JITTargetMachineBuilder::addFeatures(), createTargetMachine(), llvm::orc::JITTargetMachineBuilder::detectHost(), getDefaultSubtargetFeatures(), llvm::codegen::getFeatureList(), llvm::codegen::getFeaturesStr(), llvm::HexagonSubtarget::initializeSubtargetDependencies(), LLVMGetHostCPUFeatures(), and llvm::EngineBuilder::selectTarget().
Definition at line 45 of file SubtargetFeature.cpp.
References llvm::ArrayRef< T >::begin(), and llvm::ArrayRef< T >::end().
LLVM_DUMP_METHOD void SubtargetFeatures::dump | ( | ) | const |
Definition at line 66 of file SubtargetFeature.cpp.
References llvm::dbgs(), and print().
Adds the default features for the specified target triple.
Definition at line 71 of file SubtargetFeature.cpp.
References AddFeature(), llvm::Triple::Apple, llvm::Triple::getArch(), llvm::Triple::getVendor(), llvm::Triple::ppc, and llvm::Triple::ppc64.
Referenced by llvm::TargetMachineBuilder::create(), and createTargetMachine().
|
inline |
Returns the vector of individual subtarget features.
Definition at line 189 of file SubtargetFeature.h.
Referenced by llvm::codegen::getFeatureList(), getFeatures(), llvm::HexagonSubtarget::initializeSubtargetDependencies(), and llvm::AMDGPU::IsaInfo::AMDGPUTargetID::setTargetIDFromFeaturesString().
std::string SubtargetFeatures::getString | ( | ) | const |
Returns features as a string.
Definition at line 55 of file SubtargetFeature.cpp.
Referenced by llvm::TargetMachineBuilder::create(), llvm::orc::JITTargetMachineBuilder::createTargetMachine(), createTargetMachine(), llvm::codegen::getFeaturesStr(), llvm::HexagonSubtarget::initializeSubtargetDependencies(), LLVMGetHostCPUFeatures(), llvm::orc::JITTargetMachineBuilderPrinter::print(), and llvm::EngineBuilder::selectTarget().
Determine if a feature has a flag; '+' or '-'.
Definition at line 201 of file SubtargetFeature.h.
References assert(), and llvm::StringRef::empty().
Referenced by AddFeature(), ApplyFeatureFlag(), and StripFlag().
Return true if enable flag; '+'.
Definition at line 215 of file SubtargetFeature.h.
References assert(), and llvm::StringRef::empty().
Referenced by ApplyFeatureFlag().
void SubtargetFeatures::print | ( | raw_ostream & | OS | ) | const |
|
static |
Splits a string of comma separated items in to a vector of strings.
Definition at line 29 of file SubtargetFeature.cpp.
References llvm::SmallVectorBase< Size_T >::size(), and llvm::StringRef::split().
Referenced by SubtargetFeatures().
Return string stripped of flag.
Definition at line 210 of file SubtargetFeature.h.
References hasFlag(), and llvm::StringRef::substr().
Referenced by ApplyFeatureFlag(), and llvm::MCSubtargetInfo::ToggleFeature().