Rewrite tblgen handling of subtarget features so
authorDale Johannesen <dalej@apple.com>
Thu, 14 Feb 2008 23:35:16 +0000 (23:35 +0000)
committerDale Johannesen <dalej@apple.com>
Thu, 14 Feb 2008 23:35:16 +0000 (23:35 +0000)
it follows the order of the enum, not alphabetical.
The motivation is to make -mattr=+ssse3,+sse41
select SSE41 as it ought to.  Added "ignored"
enum values of 0 to PPC and SPU to avoid compiler
warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47143 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/CellSPU/SPUSubtarget.h
lib/Target/PowerPC/PPCAsmPrinter.cpp
lib/Target/PowerPC/PPCSubtarget.cpp
lib/Target/PowerPC/PPCSubtarget.h
utils/TableGen/SubtargetEmitter.cpp

index 2ee7bb8520b9a57d2f57377e15b85cdff876819d..51dd44c5f9da1b7e262c9789187679a31500a2f3 100644 (file)
@@ -26,6 +26,7 @@ namespace llvm {
 
   namespace SPU {
     enum {
+      PROC_NONE,
       DEFAULT_PROC
     };
   }
index 71ce14708cc3046689588fcae92885d3f34c511e..605dc128db4491a9e2d62c35c1b0ca65bbc571f9 100644 (file)
@@ -849,6 +849,7 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
 bool DarwinAsmPrinter::doInitialization(Module &M) {
   static const char *CPUDirectives[] = {
+    "",
     "ppc",
     "ppc601",
     "ppc602",
index dff53baa16b16d3257b968e8a2e9055dcb88a623..030dc7a17cae2dbe096edd887187c9736d0b035e 100644 (file)
@@ -60,6 +60,7 @@ PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M,
                            const std::string &FS, bool is64Bit)
   : TM(tm)
   , StackAlignment(16)
+  , DarwinDirective(PPC::DIR_NONE)
   , IsGigaProcessor(false)
   , Has64BitSupport(false)
   , Use64BitRegs(false)
index c55e09720b3441421d7844ed0ad5d6c884489a54..be4c21cd448ce45395e49750c1ae320ba78e2479 100644 (file)
@@ -27,6 +27,7 @@ namespace llvm {
 namespace PPC {
   // -m directive values.
   enum {
+    DIR_NONE,
     DIR_32,
     DIR_601, 
     DIR_602, 
index 1f34bcc2177ad9aa7628bb1f9b3733c45b3bb7ca..5e7688a61966d25863f4f0f3b490a2db9bfb0e10 100644 (file)
@@ -482,8 +482,12 @@ void SubtargetEmitter::ParseFeaturesFunction(std::ostream &OS) {
     const std::string &Value = R->getValueAsString("Value");
     const std::string &Attribute = R->getValueAsString("Attribute");
 
-    OS << "  if ((Bits & " << Instance << ") != 0) "
-       << Attribute << " = " << Value << ";\n";
+    if (Value=="true" || Value=="false")
+      OS << "  if ((Bits & " << Instance << ") != 0) "
+         << Attribute << " = " << Value << ";\n";
+    else
+      OS << "  if ((Bits & " << Instance << ") != 0 && " << Attribute << 
+            " < " << Value << ") " << Attribute << " = " << Value << ";\n";
   }
 
   if (HasItineraries) {