[llvm-commits] [llvm] r97314 - in /llvm/trunk/utils/TableGen: DAGISelMatcher.cpp DAGISelMatcher.h DAGISelMatcherOpt.cpp

Chris Lattner sabre at nondot.org
Sat Feb 27 00:11:16 PST 2010


Author: lattner
Date: Sat Feb 27 02:11:15 2010
New Revision: 97314

URL: http://llvm.org/viewvc/llvm-project?rev=97314&view=rev
Log:
teach the optimizer that opcode == ISD::STORE  is contradictory
with getType() == MVT::i32 etc.  Teach it that two different
integer constants are contradictory.  This cuts 1K off the X86
table, down to 98k


Modified:
    llvm/trunk/utils/TableGen/DAGISelMatcher.cpp
    llvm/trunk/utils/TableGen/DAGISelMatcher.h
    llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp

Modified: llvm/trunk/utils/TableGen/DAGISelMatcher.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcher.cpp?rev=97314&r1=97313&r2=97314&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcher.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcher.cpp Sat Feb 27 02:11:15 2010
@@ -267,7 +267,12 @@
   }
   
   // TODO: CheckMultiOpcodeMatcher?
-  // TODO: CheckType?
+  
+  // This is a special common case we see a lot in the X86 backend, we know that
+  // ISD::STORE nodes can't have non-void type.
+  if (const CheckTypeMatcher *CT = dyn_cast<CheckTypeMatcher>(M))
+    return getOpcodeName() == "ISD::STORE" && CT->getType() != MVT::isVoid;
+  
   return false;
 }
 
@@ -307,4 +312,8 @@
   return false;
 }
   
-
+bool CheckIntegerMatcher::isContradictoryImpl(const Matcher *M) const {
+  if (const CheckIntegerMatcher *CIM = dyn_cast<CheckIntegerMatcher>(M))
+    return CIM->getValue() != getValue();
+  return false;
+}

Modified: llvm/trunk/utils/TableGen/DAGISelMatcher.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcher.h?rev=97314&r1=97313&r2=97314&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcher.h (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcher.h Sat Feb 27 02:11:15 2010
@@ -511,6 +511,7 @@
     return cast<CheckIntegerMatcher>(M)->Value == Value;
   }
   virtual unsigned getHashImpl() const { return Value; }
+  virtual bool isContradictoryImpl(const Matcher *M) const;
 };
   
 /// CheckCondCodeMatcher - This checks to see if the current node is a

Modified: llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp?rev=97314&r1=97313&r2=97314&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherOpt.cpp Sat Feb 27 02:11:15 2010
@@ -202,14 +202,14 @@
     }
       
     if (Scan != e) {
-      DEBUG(errs() << "Couldn't merge this:\n  ";
-            Optn->printOne(errs());
-            errs() << "into this:\n  ";
-            OptionsToMatch[OptionIdx]->printOne(errs());
+      DEBUG(errs() << "Couldn't merge this:\n";
+            Optn->print(errs(), 4);
+            errs() << "into this:\n";
+            OptionsToMatch[Scan]->print(errs(), 4);
             if (OptionIdx+1 != e)
-              OptionsToMatch[OptionIdx+1]->printOne(errs());
+              OptionsToMatch[Scan+1]->printOne(errs());
             if (OptionIdx+2 < e)
-              OptionsToMatch[OptionIdx+2]->printOne(errs());
+              OptionsToMatch[Scan+2]->printOne(errs());
             errs() << "\n");
     }
     





More information about the llvm-commits mailing list