[llvm-commits] CVS: llvm/lib/Target/SubtargetFeature.cpp Target.td

2007-05-04 Thread Bill Wendling


Changes in directory llvm/lib/Target:

SubtargetFeature.cpp updated: 1.12 - 1.13
Target.td updated: 1.98 - 1.99
---
Log message:

Add an implies field to features. This indicates that, if the current
feature is set, then the features in the implied list should be set also.
The opposite is also enforced: if a feature in the implied list isn't set,
then the feature that owns that implies list shouldn't be set either.


---
Diffs of the changes:  (+56 -3)

 SubtargetFeature.cpp |   51 +--
 Target.td|8 +++-
 2 files changed, 56 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/SubtargetFeature.cpp
diff -u llvm/lib/Target/SubtargetFeature.cpp:1.12 
llvm/lib/Target/SubtargetFeature.cpp:1.13
--- llvm/lib/Target/SubtargetFeature.cpp:1.12   Thu Dec  7 17:41:45 2006
+++ llvm/lib/Target/SubtargetFeature.cppFri May  4 15:38:40 2007
@@ -199,6 +199,43 @@
   if (Features[0].empty()) setCPU(String);
 }
 
+/// SetImpliedBits - For each feature that is (transitively) implied by this
+/// feature, set it.
+/// 
+static
+void SetImpliedBits(uint32_t Bits, const SubtargetFeatureKV *FeatureEntry,
+const SubtargetFeatureKV *FeatureTable,
+size_t FeatureTableSize) {
+  for (size_t i = 0; i  FeatureTableSize; ++i) {
+const SubtargetFeatureKV FE = FeatureTable[i];
+
+if (FeatureEntry-Value == FE.Value) continue;
+
+if (FeatureEntry-Implies  FE.Value) {
+  Bits |= FE.Value;
+  SetImpliedBits(Bits, FE, FeatureTable, FeatureTableSize);
+}
+  }
+}
+
+/// ClearImpliedBits - For each feature that (transitively) implies this
+/// feature, clear it.
+/// 
+static
+void ClearImpliedBits(uint32_t Bits, const SubtargetFeatureKV *FeatureEntry,
+  const SubtargetFeatureKV *FeatureTable,
+  size_t FeatureTableSize) {
+  for (size_t i = 0; i  FeatureTableSize; ++i) {
+const SubtargetFeatureKV FE = FeatureTable[i];
+
+if (FeatureEntry-Value == FE.Value) continue;
+
+if (FE.Implies  FeatureEntry-Value) {
+  Bits = ~FE.Value;
+  ClearImpliedBits(Bits, FE, FeatureTable, FeatureTableSize);
+}
+  }
+}
 
 /// getBits - Get feature bits.
 ///
@@ -251,8 +288,17 @@
 // If there is a match
 if (FeatureEntry) {
   // Enable/disable feature in bits
-  if (isEnabled(Feature)) Bits |=  FeatureEntry-Value;
-  elseBits = ~FeatureEntry-Value;
+  if (isEnabled(Feature)) {
+Bits |=  FeatureEntry-Value;
+
+// For each feature that this implies, set it.
+SetImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize);
+  } else {
+Bits = ~FeatureEntry-Value;
+
+// For each feature that implies this, clear it.
+ClearImpliedBits(Bits, FeatureEntry, FeatureTable, FeatureTableSize);
+  }
 } else {
   cerr  '  Feature
 ' is not a recognized feature for this target
@@ -260,6 +306,7 @@
 \n;
 }
   }
+
   return Bits;
 }
 


Index: llvm/lib/Target/Target.td
diff -u llvm/lib/Target/Target.td:1.98 llvm/lib/Target/Target.td:1.99
--- llvm/lib/Target/Target.td:1.98  Wed May  2 19:27:11 2007
+++ llvm/lib/Target/Target.td   Fri May  4 15:38:40 2007
@@ -338,7 +338,8 @@
 
//===--===//
 // SubtargetFeature - A characteristic of the chip set.
 //
-class SubtargetFeaturestring n, string a,  string v, string d {
+class SubtargetFeaturestring n, string a,  string v, string d,
+   listSubtargetFeature i = [] {
   // Name - Feature name.  Used by command line (-mattr=) to determine the
   // appropriate target chip.
   //
@@ -356,6 +357,11 @@
   // information.
   //
   string Desc = d;
+
+  // Implies - Features that this feature implies are present. If one of those
+  // features isn't set, then this one shouldn't be set either.
+  //
+  listSubtargetFeature Implies = i;
 }
 
 
//===--===//



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/SubtargetFeature.cpp

2006-12-07 Thread Bill Wendling


Changes in directory llvm/lib/Target:

SubtargetFeature.cpp updated: 1.10 - 1.11
---
Log message:

What should be the last unnecessary iostreams in the library.


---
Diffs of the changes:  (+26 -26)

 SubtargetFeature.cpp |   52 +--
 1 files changed, 26 insertions(+), 26 deletions(-)


Index: llvm/lib/Target/SubtargetFeature.cpp
diff -u llvm/lib/Target/SubtargetFeature.cpp:1.10 
llvm/lib/Target/SubtargetFeature.cpp:1.11
--- llvm/lib/Target/SubtargetFeature.cpp:1.10   Fri Mar 24 04:00:56 2006
+++ llvm/lib/Target/SubtargetFeature.cppThu Dec  7 16:21:48 2006
@@ -13,10 +13,10 @@
 
 #include llvm/Target/SubtargetFeature.h
 #include llvm/ADT/StringExtras.h
+#include llvm/Support/Streams.h
 #include algorithm
 #include cassert
 #include cctype
-#include iostream
 using namespace llvm;
 
 
//===--===//
@@ -144,23 +144,23 @@
   unsigned MaxFeatLen = getLongestEntryLength(FeatTable, FeatTableSize);
 
   // Print the CPU table.
-  std::cerr  Available CPUs for this target:\n\n;
+  cerr  Available CPUs for this target:\n\n;
   for (size_t i = 0; i != CPUTableSize; i++)
-std::cerr  CPUTable[i].Key
-   std::string(MaxCPULen - std::strlen(CPUTable[i].Key), ' ')
--   CPUTable[i].Desc  .\n;
-  std::cerr  \n;
+cerr  CPUTable[i].Key
+  std::string(MaxCPULen - std::strlen(CPUTable[i].Key), ' ')
+   -   CPUTable[i].Desc  .\n;
+  cerr  \n;
   
   // Print the Feature table.
-  std::cerr  Available features for this target:\n\n;
+  cerr  Available features for this target:\n\n;
   for (size_t i = 0; i != FeatTableSize; i++)
-std::cerr  FeatTable[i].Key
-   std::string(MaxFeatLen - std::strlen(FeatTable[i].Key), ' ')
--   FeatTable[i].Desc  .\n;
-  std::cerr  \n;
+cerr  FeatTable[i].Key
+  std::string(MaxFeatLen - std::strlen(FeatTable[i].Key), ' ')
+   -   FeatTable[i].Desc  .\n;
+  cerr  \n;
   
-  std::cerr  Use +feature to enable a feature, or -feature to disable it.\n
- For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n;
+  cerr  Use +feature to enable a feature, or -feature to disable it.\n
+For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n;
   exit(1);
 }
 
@@ -231,10 +231,10 @@
 // Set base feature bits
 Bits = CPUEntry-Value;
   } else {
-std::cerr  '  Features[0]
-   ' is not a recognized processor for this target
-(ignoring processor)
-   \n;
+cerr  '  Features[0]
+  ' is not a recognized processor for this target
+   (ignoring processor)
+  \n;
   }
   // Iterate through each feature
   for (size_t i = 1; i  Features.size(); i++) {
@@ -253,10 +253,10 @@
   if (isEnabled(Feature)) Bits |=  FeatureEntry-Value;
   elseBits = ~FeatureEntry-Value;
 } else {
-  std::cerr  '  Feature
- ' is not a recognized feature for this target
-  (ignoring feature)
- \n;
+  cerr  '  Feature
+' is not a recognized feature for this target
+ (ignoring feature)
+\n;
 }
   }
   return Bits;
@@ -278,10 +278,10 @@
   if (Entry) {
 return Entry-Value;
   } else {
-std::cerr  '  Features[0]
-   ' is not a recognized processor for this target
-(ignoring processor)
-   \n;
+cerr  '  Features[0]
+  ' is not a recognized processor for this target
+   (ignoring processor)
+  \n;
 return NULL;
   }
 }
@@ -298,5 +298,5 @@
 /// dump - Dump feature info.
 ///
 void SubtargetFeatures::dump() const {
-  print(std::cerr);
+  print(*cerr.stream());
 }



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/SubtargetFeature.cpp

2006-12-07 Thread Bill Wendling


Changes in directory llvm/lib/Target:

SubtargetFeature.cpp updated: 1.11 - 1.12
---
Log message:

Don't use sstream in Streams.h but iosfwd instead.


---
Diffs of the changes:  (+1 -0)

 SubtargetFeature.cpp |1 +
 1 files changed, 1 insertion(+)


Index: llvm/lib/Target/SubtargetFeature.cpp
diff -u llvm/lib/Target/SubtargetFeature.cpp:1.11 
llvm/lib/Target/SubtargetFeature.cpp:1.12
--- llvm/lib/Target/SubtargetFeature.cpp:1.11   Thu Dec  7 16:21:48 2006
+++ llvm/lib/Target/SubtargetFeature.cppThu Dec  7 17:41:45 2006
@@ -15,6 +15,7 @@
 #include llvm/ADT/StringExtras.h
 #include llvm/Support/Streams.h
 #include algorithm
+#include ostream
 #include cassert
 #include cctype
 using namespace llvm;



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/SubtargetFeature.cpp

2006-03-24 Thread Jim Laskey


Changes in directory llvm/lib/Target:

SubtargetFeature.cpp updated: 1.9 - 1.10
---
Log message:

Clean up some commentary.


---
Diffs of the changes:  (+1 -1)

 SubtargetFeature.cpp |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


Index: llvm/lib/Target/SubtargetFeature.cpp
diff -u llvm/lib/Target/SubtargetFeature.cpp:1.9 
llvm/lib/Target/SubtargetFeature.cpp:1.10
--- llvm/lib/Target/SubtargetFeature.cpp:1.9Thu Jan 26 14:41:32 2006
+++ llvm/lib/Target/SubtargetFeature.cppFri Mar 24 04:00:56 2006
@@ -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.
 //
 
//===--===//



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] CVS: llvm/lib/Target/SubtargetFeature.cpp

2006-01-26 Thread Jeff Cohen


Changes in directory llvm/lib/Target:

SubtargetFeature.cpp updated: 1.8 - 1.9
---
Log message:

Improve compatibility with VC2005, patch by Morten Ofstad!

---
Diffs of the changes:  (+4 -1)

 SubtargetFeature.cpp |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Target/SubtargetFeature.cpp
diff -u llvm/lib/Target/SubtargetFeature.cpp:1.8 
llvm/lib/Target/SubtargetFeature.cpp:1.9
--- llvm/lib/Target/SubtargetFeature.cpp:1.8Tue Oct 25 10:15:28 2005
+++ llvm/lib/Target/SubtargetFeature.cppThu Jan 26 14:41:32 2006
@@ -112,10 +112,13 @@
 
 /// Find KV in array using binary search.
 templatetypename T const T *Find(const std::string S, const T *A, size_t L) 
{
+  // Make the lower bound element we're looking for
+  T KV;
+  KV.Key = S.c_str();
   // Determine the end of the array
   const T *Hi = A + L;
   // Binary search the array
-  const T *F = std::lower_bound(A, Hi, S);
+  const T *F = std::lower_bound(A, Hi, KV);
   // If not found then return NULL
   if (F == Hi || std::string(F-Key) != S) return NULL;
   // Return the found array item



___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits