#ifndef LLVM_MC_SUBTARGETFEATURE_H
#define LLVM_MC_SUBTARGETFEATURE_H
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Support/DataTypes.h"
-#include <vector>
namespace llvm {
class raw_ostream;
class SubtargetFeatures {
std::vector<std::string> Features; // Subtarget features as a vector
public:
- explicit SubtargetFeatures(const StringRef Initial = "");
+ explicit SubtargetFeatures(StringRef Initial = "");
/// Features string accessors.
std::string getString() const;
/// Adding Features.
- void AddFeature(const StringRef String, bool IsEnabled = true);
+ void AddFeature(StringRef String);
/// ToggleFeature - Toggle a feature and returns the newly updated feature
/// bits.
- uint64_t ToggleFeature(uint64_t Bits, const StringRef String,
- const SubtargetFeatureKV *FeatureTable,
- size_t FeatureTableSize);
+ uint64_t ToggleFeature(uint64_t Bits, StringRef String,
+ ArrayRef<SubtargetFeatureKV> FeatureTable);
/// Get feature bits of a CPU.
- uint64_t getFeatureBits(const StringRef CPU,
- const SubtargetFeatureKV *CPUTable,
- size_t CPUTableSize,
- const SubtargetFeatureKV *FeatureTable,
- size_t FeatureTableSize);
+ uint64_t getFeatureBits(StringRef CPU,
+ ArrayRef<SubtargetFeatureKV> CPUTable,
+ ArrayRef<SubtargetFeatureKV> FeatureTable);
/// Print feature string.
void print(raw_ostream &OS) const;
/// Adds the default features for the specified target triple.
void getDefaultSubtargetFeatures(const Triple& Triple);
-
- /// Find KV in array using binary search.
- /// T should be either SubtargetFeatureKV or SubtargetInfoKV
- template<typename T>
- static const T *Find(StringRef Key, const T *Array, size_t Length,
- const char* KeyType);
};
} // End namespace llvm