[llvm-commits] CVS: llvm/include/llvm/Target/SubtargetFeature.h

Jim Laskey jlaskey at apple.com
Tue Oct 25 08:15:41 PDT 2005



Changes in directory llvm/include/llvm/Target:

SubtargetFeature.h updated: 1.4 -> 1.5
---
Log message:

Preparation of supporting scheduling info.  Need to find info based on selected
CPU.



---
Diffs of the changes:  (+27 -9)

 SubtargetFeature.h |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 deletions(-)


Index: llvm/include/llvm/Target/SubtargetFeature.h
diff -u llvm/include/llvm/Target/SubtargetFeature.h:1.4 llvm/include/llvm/Target/SubtargetFeature.h:1.5
--- llvm/include/llvm/Target/SubtargetFeature.h:1.4	Sun Oct 23 00:25:19 2005
+++ llvm/include/llvm/Target/SubtargetFeature.h	Tue Oct 25 10:15:28 2005
@@ -43,6 +43,21 @@
   
 //===----------------------------------------------------------------------===//
 ///
+/// 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 @@
   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;






More information about the llvm-commits mailing list