LLVM  4.0.0
Public Member Functions | Static Public Member Functions | List of all members
llvm::SubtargetFeatures Class Reference

SubtargetFeatures - Manages the enabling and disabling of subtarget specific features. More...

#include <SubtargetFeature.h>

Public Member Functions

 SubtargetFeatures (StringRef Initial="")
 
std::string getString () const
 Features string accessors. More...
 
void AddFeature (StringRef String, bool Enable=true)
 Adding Features. More...
 
FeatureBitset getFeatureBits (StringRef CPU, ArrayRef< SubtargetFeatureKV > CPUTable, ArrayRef< SubtargetFeatureKV > FeatureTable)
 Get feature bits of a CPU. More...
 
void print (raw_ostream &OS) const
 Print feature string. More...
 
void dump () const
 dump - Dump feature info. More...
 
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)
 ToggleFeature - Toggle a feature and update the feature bits. More...
 
static void ApplyFeatureFlag (FeatureBitset &Bits, StringRef Feature, ArrayRef< SubtargetFeatureKV > FeatureTable)
 Apply the feature flag and update the feature bits. More...
 

Detailed Description

SubtargetFeatures - 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 96 of file SubtargetFeature.h.

Constructor & Destructor Documentation

SubtargetFeatures::SubtargetFeatures ( StringRef  Initial = "")
explicit

Definition at line 121 of file SubtargetFeature.cpp.

References Split().

Member Function Documentation

void SubtargetFeatures::AddFeature ( StringRef  String,
bool  Enable = true 
)
void SubtargetFeatures::ApplyFeatureFlag ( FeatureBitset Bits,
StringRef  Feature,
ArrayRef< SubtargetFeatureKV FeatureTable 
)
static

Apply the feature flag and update the feature bits.

Definition at line 191 of file SubtargetFeature.cpp.

References assert(), ClearImpliedBits(), llvm::errs(), Find(), hasFlag(), isEnabled(), SetImpliedBits(), StripFlag(), and llvm::SubtargetFeatureKV::Value.

Referenced by llvm::MCSubtargetInfo::ApplyFeatureFlag(), and getFeatureBits().

LLVM_DUMP_METHOD void SubtargetFeatures::dump ( ) const

dump - Dump feature info.

Definition at line 287 of file SubtargetFeature.cpp.

References llvm::dbgs(), and print().

void SubtargetFeatures::getDefaultSubtargetFeatures ( const Triple Triple)

Adds the default features for the specified target triple.

FIXME: This is an inelegant way of specifying the features of a subtarget. It would be better if we could encode this information into the IR. See <rdar://5972456>.

Definition at line 297 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().

FeatureBitset SubtargetFeatures::getFeatureBits ( StringRef  CPU,
ArrayRef< SubtargetFeatureKV CPUTable,
ArrayRef< SubtargetFeatureKV FeatureTable 
)
std::string SubtargetFeatures::getString ( ) const

Features string accessors.

Definition at line 127 of file SubtargetFeature.cpp.

References llvm::join().

Referenced by llvm::TargetMachineBuilder::create(), getFeaturesStr(), and llvm::EngineBuilder::selectTarget().

void SubtargetFeatures::print ( raw_ostream OS) const

Print feature string.

print - Print feature string.

Definition at line 279 of file SubtargetFeature.cpp.

References F.

Referenced by dump().

void SubtargetFeatures::ToggleFeature ( FeatureBitset Bits,
StringRef  String,
ArrayRef< SubtargetFeatureKV FeatureTable 
)
static

ToggleFeature - Toggle a feature and update the feature bits.

Definition at line 166 of file SubtargetFeature.cpp.

References ClearImpliedBits(), llvm::errs(), Find(), SetImpliedBits(), StripFlag(), and llvm::SubtargetFeatureKV::Value.

Referenced by llvm::MCSubtargetInfo::ToggleFeature().


The documentation for this class was generated from the following files: