LLVM  3.7.0
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 ToggleFeature (FeatureBitset Bits, StringRef String, ArrayRef< SubtargetFeatureKV > FeatureTable)
 ToggleFeature - Toggle a feature and returns the newly updated feature bits. More...
 
FeatureBitset ApplyFeatureFlag (FeatureBitset Bits, StringRef Feature, ArrayRef< SubtargetFeatureKV > FeatureTable)
 Apply the feature flag and return the newly updated feature bits. 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...
 

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

Constructor & Destructor Documentation

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

Definition at line 120 of file SubtargetFeature.cpp.

References Split().

Member Function Documentation

void SubtargetFeatures::AddFeature ( StringRef  String,
bool  Enable = true 
)

Adding Features.

Adding features.

Definition at line 64 of file SubtargetFeature.cpp.

References llvm::StringRef::empty(), hasFlag(), and llvm::StringRef::lower().

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

FeatureBitset SubtargetFeatures::ApplyFeatureFlag ( FeatureBitset  Bits,
StringRef  Feature,
ArrayRef< SubtargetFeatureKV FeatureTable 
)

Apply the feature flag and return the newly updated feature bits.

Definition at line 194 of file SubtargetFeature.cpp.

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

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

void SubtargetFeatures::dump ( ) const

dump - Dump feature info.

Definition at line 297 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 308 of file SubtargetFeature.cpp.

References AddFeature(), llvm::Triple::Apple, llvm::Triple::getArch(), llvm::Triple::getVendor(), llvm::Triple::ppc, and llvm::Triple::ppc64.

FeatureBitset SubtargetFeatures::getFeatureBits ( StringRef  CPU,
ArrayRef< SubtargetFeatureKV CPUTable,
ArrayRef< SubtargetFeatureKV FeatureTable 
)

Get feature bits of a CPU.

getFeatureBits - Get feature bits a CPU.

Definition at line 229 of file SubtargetFeature.cpp.

References ApplyFeatureFlag(), llvm::tgtok::Bits, llvm::StringRef::empty(), llvm::ArrayRef< T >::empty(), llvm::errs(), Find(), Help(), SetImpliedBits(), llvm::ArrayRef< T >::size(), and llvm::SubtargetFeatureKV::Value.

Referenced by getFeatures().

std::string SubtargetFeatures::getString ( ) const

Features string accessors.

Definition at line 126 of file SubtargetFeature.cpp.

References llvm::join().

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

void SubtargetFeatures::print ( raw_ostream OS) const

Print feature string.

print - Print feature string.

Definition at line 288 of file SubtargetFeature.cpp.

References F().

Referenced by dump().

FeatureBitset SubtargetFeatures::ToggleFeature ( FeatureBitset  Bits,
StringRef  Feature,
ArrayRef< SubtargetFeatureKV FeatureTable 
)

ToggleFeature - Toggle a feature and returns the newly updated feature bits.

Definition at line 166 of file SubtargetFeature.cpp.

References llvm::tgtok::Bits, 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: