Support for non-landing pad exception handling.
[oota-llvm.git] / include / llvm / Target / SubtargetFeature.h
index 590a6dbab78204535248a66107f91740da54c61b..f6a83dfbdbf21d8ae6bbac8be5ba56762ebf7635 100644 (file)
@@ -2,7 +2,7 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Jim Laskey and is distributed under the 
+// This file was developed by James M. Laskey and is distributed under the 
 // University of Illinois Open Source License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
@@ -36,8 +36,23 @@ struct SubtargetFeatureKV {
   uint32_t Value;                       // K-V integer value
   
   // Compare routine for std binary search
-  bool operator<(const std::string &S) const {
-    return strcmp(Key, S.c_str()) < 0;
+  bool operator<(const SubtargetFeatureKV &S) const {
+    return strcmp(Key, S.Key) < 0;
+  }
+};
+  
+//===----------------------------------------------------------------------===//
+///
+/// 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 SubtargetInfoKV &S) const {
+    return strcmp(Key, S.Key) < 0;
   }
 };
   
@@ -63,23 +78,27 @@ 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;
+  void print(std::ostream *OS) const { if (OS) print(*OS); }
   
   // Dump feature info.
   void dump() const;