X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FMC%2FSubtargetFeature.h;h=40d4739fe9cba413472f68077dad9d8c23905637;hp=fd09638268619bee9e356df9bd21722b45efd0ea;hb=4d0731f50589c740744edcbc8af5250988c3e0ef;hpb=23dd089d8f040a952e2be1663ffc1555523f7470 diff --git a/include/llvm/MC/SubtargetFeature.h b/include/llvm/MC/SubtargetFeature.h index fd096382686..40d4739fe9c 100644 --- a/include/llvm/MC/SubtargetFeature.h +++ b/include/llvm/MC/SubtargetFeature.h @@ -30,7 +30,7 @@ namespace llvm { // A container class for subtarget features. // This is convenient because std::bitset does not have a constructor // with an initializer list of set bits. -const unsigned MAX_SUBTARGET_FEATURES = 64; +const unsigned MAX_SUBTARGET_FEATURES = 128; class FeatureBitset : public std::bitset { public: // Cannot inherit constructors because it's not supported by VC++.. @@ -39,8 +39,8 @@ public: FeatureBitset(const bitset& B) : bitset(B) {} FeatureBitset(std::initializer_list Init) : bitset() { - for (auto I = Init.begin() , E = Init.end(); I != E; ++I) - set(*I); + for (auto I : Init) + set(I); } }; @@ -59,6 +59,11 @@ struct SubtargetFeatureKV { bool operator<(StringRef S) const { return StringRef(Key) < S; } + + // Compare routine for std::is_sorted. + bool operator<(const SubtargetFeatureKV &Other) const { + return StringRef(Key) < StringRef(Other.Key); + } }; //===----------------------------------------------------------------------===// @@ -96,13 +101,17 @@ public: std::string getString() const; /// Adding Features. - void AddFeature(StringRef String); + void AddFeature(StringRef String, bool Enable = true); /// ToggleFeature - Toggle a feature and returns the newly updated feature /// bits. FeatureBitset ToggleFeature(FeatureBitset Bits, StringRef String, ArrayRef FeatureTable); + /// Apply the feature flag and return the newly updated feature bits. + FeatureBitset ApplyFeatureFlag(FeatureBitset Bits, StringRef Feature, + ArrayRef FeatureTable); + /// Get feature bits of a CPU. FeatureBitset getFeatureBits(StringRef CPU, ArrayRef CPUTable,