LLVM
8.0.1
|
Manages the enabling and disabling of subtarget specific features. More...
#include "llvm/MC/SubtargetFeature.h"
Public Member Functions | |
SubtargetFeatures (StringRef Initial="") | |
std::string | getString () const |
Returns features as a string. More... | |
void | AddFeature (StringRef String, bool Enable=true) |
Adds Features. More... | |
FeatureBitset | getFeatureBits (StringRef CPU, ArrayRef< SubtargetFeatureKV > CPUTable, ArrayRef< SubtargetFeatureKV > FeatureTable) |
Returns feature bits of a CPU. More... | |
const std::vector< std::string > & | getFeatures () const |
Returns the vector of individual subtarget features. More... | |
void | print (raw_ostream &OS) const |
Prints feature string. More... | |
void | dump () const |
void | getDefaultSubtargetFeatures (const Triple &Triple) |
Adds the default features for the specified target triple. More... | |
Static Public Member Functions | |
static void | ToggleFeature (FeatureBitset &Bits, StringRef String, ArrayRef< SubtargetFeatureKV > FeatureTable) |
Toggles a feature and update the feature bits. More... | |
static void | ApplyFeatureFlag (FeatureBitset &Bits, StringRef Feature, ArrayRef< SubtargetFeatureKV > FeatureTable) |
Applies the feature flag and update the feature bits. More... | |
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 93 of file SubtargetFeature.h.
|
explicit |
Definition at line 115 of file SubtargetFeature.cpp.
References Split().
Adds Features.
Definition at line 65 of file SubtargetFeature.cpp.
References llvm::StringRef::empty(), hasFlag(), and llvm::StringRef::lower().
Referenced by llvm::orc::JITTargetMachineBuilder::addFeatures(), llvm::lto::Config::addSaveTemps(), llvm::object::ELFObjectFileBase::getARMFeatures(), getDefaultSubtargetFeatures(), llvm::object::ELFObjectFileBase::getMIPSFeatures(), llvm::object::ELFObjectFileBase::getRISCVFeatures(), LLVMGetHostCPUFeatures(), and llvm::EngineBuilder::selectTarget().
|
static |
Applies the feature flag and update the feature bits.
Definition at line 177 of file SubtargetFeature.cpp.
References assert(), ClearImpliedBits(), llvm::errs(), Find(), hasFlag(), isEnabled(), SetImpliedBits(), StripFlag(), and llvm::SubtargetFeatureKV::Value.
Referenced by llvm::MCSubtargetInfo::ApplyFeatureFlag(), llvm::MCSubtargetInfo::checkFeatures(), and getFeatureBits().
LLVM_DUMP_METHOD void SubtargetFeatures::dump | ( | ) | const |
Definition at line 261 of file SubtargetFeature.cpp.
References llvm::dbgs(), and print().
Adds the default features for the specified target triple.
Definition at line 266 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::lto::Config::addSaveTemps(), llvm::LTOCodeGenerator::compile(), llvm::TargetMachineBuilder::create(), and parseBitcodeFileImpl().
FeatureBitset SubtargetFeatures::getFeatureBits | ( | StringRef | CPU, |
ArrayRef< SubtargetFeatureKV > | CPUTable, | ||
ArrayRef< SubtargetFeatureKV > | FeatureTable | ||
) |
Returns feature bits of a CPU.
Definition at line 205 of file SubtargetFeature.cpp.
References ApplyFeatureFlag(), assert(), llvm::sys::path::begin(), llvm::tgtok::Bits, llvm::StringRef::empty(), llvm::ArrayRef< T >::empty(), llvm::sys::path::end(), llvm::errs(), Find(), Help(), SetImpliedBits(), and llvm::SubtargetFeatureKV::Value.
Referenced by getFeatures().
|
inline |
Returns the vector of individual subtarget features.
Definition at line 119 of file SubtargetFeature.h.
References llvm::dump(), Features, and print().
Referenced by llvm::MCSubtargetInfo::checkFeatures().
std::string SubtargetFeatures::getString | ( | ) | const |
Returns features as a string.
Definition at line 120 of file SubtargetFeature.cpp.
References llvm::join().
Referenced by llvm::lto::Config::addSaveTemps(), llvm::LTOCodeGenerator::compile(), llvm::TargetMachineBuilder::create(), llvm::orc::JITTargetMachineBuilder::createTargetMachine(), LLVMGetHostCPUFeatures(), parseBitcodeFileImpl(), and llvm::EngineBuilder::selectTarget().
void SubtargetFeatures::print | ( | raw_ostream & | OS | ) | const |
Prints feature string.
Definition at line 254 of file SubtargetFeature.cpp.
References F().
Referenced by dump().
|
static |
Toggles a feature and update the feature bits.
Definition at line 154 of file SubtargetFeature.cpp.
References ClearImpliedBits(), llvm::errs(), Find(), SetImpliedBits(), StripFlag(), and llvm::SubtargetFeatureKV::Value.
Referenced by llvm::MCSubtargetInfo::ToggleFeature().