diff options
author | Jim Laskey <jlaskey@mac.com> | 2005-10-25 15:15:28 +0000 |
---|---|---|
committer | Jim Laskey <jlaskey@mac.com> | 2005-10-25 15:15:28 +0000 |
commit | 34bd5d5d876212611d8b66a18f4c8604b342c6eb (patch) | |
tree | b65e1b0e1660aa3cdbbc7b1639fce08b82eb411c /include/llvm/Target/SubtargetFeature.h | |
parent | e9c6d3637752b940a3c280196b0f594b65725e54 (diff) | |
download | external_llvm-34bd5d5d876212611d8b66a18f4c8604b342c6eb.zip external_llvm-34bd5d5d876212611d8b66a18f4c8604b342c6eb.tar.gz external_llvm-34bd5d5d876212611d8b66a18f4c8604b342c6eb.tar.bz2 |
Preparation of supporting scheduling info. Need to find info based on selected
CPU.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23974 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/SubtargetFeature.h')
-rw-r--r-- | include/llvm/Target/SubtargetFeature.h | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/include/llvm/Target/SubtargetFeature.h b/include/llvm/Target/SubtargetFeature.h index 590a6dba..aab8688 100644 --- a/include/llvm/Target/SubtargetFeature.h +++ b/include/llvm/Target/SubtargetFeature.h @@ -43,6 +43,21 @@ struct SubtargetFeatureKV { //===----------------------------------------------------------------------===// /// +/// SubtargetInfoKV - Used to provide key value pairs for CPU and arbitrary +/// pointers. +// +struct SubtargetInfoKV { + const char *Key; // K-V key string + void *Value; // K-V pointer value + + // Compare routine for std binary search + bool operator<(const std::string &S) const { + return strcmp(Key, S.c_str()) < 0; + } +}; + +//===----------------------------------------------------------------------===// +/// /// SubtargetFeatures - Manages the enabling and disabling of subtarget /// specific features. Features are encoded as a string of the form /// "cpu,+attr1,+attr2,-attr3,...,+attrN" @@ -63,20 +78,23 @@ public: std::string getString() const; void setString(const std::string &Initial); - /// Setting CPU string. Replaces previous setting. Setting to "" clears CPU. - /// + /// Set the CPU string. Replaces previous setting. Setting to "" clears CPU. void setCPU(const std::string &String); + /// Setting CPU string only if no string is set. + void setCPUIfNone(const std::string &String); + /// Adding Features. void AddFeature(const std::string &String, bool IsEnabled = true); - /// Parse feature string for quick usage. - static uint32_t Parse(const std::string &String, - const std::string &DefaultCPU, - const SubtargetFeatureKV *CPUTable, - size_t CPUTableSize, - const SubtargetFeatureKV *FeatureTable, - size_t FeatureTableSize); + /// Get feature bits. + uint32_t getBits(const SubtargetFeatureKV *CPUTable, + size_t CPUTableSize, + const SubtargetFeatureKV *FeatureTable, + size_t FeatureTableSize); + + /// Get info pointer + void *getInfo(const SubtargetInfoKV *Table, size_t TableSize); /// Print feature string. void print(std::ostream &OS) const; |