[llvm-commits] [llvm] r53096 - /llvm/trunk/utils/TableGen/DAGISelEmitter.cpp

Evan Cheng evan.cheng at apple.com
Thu Jul 3 01:39:51 PDT 2008


Author: evancheng
Date: Thu Jul  3 03:39:51 2008
New Revision: 53096

URL: http://llvm.org/viewvc/llvm-project?rev=53096&view=rev
Log:
isel load folding is disabled at -fast. Now hoist the check up to the top level to save some time.

Modified:
    llvm/trunk/utils/TableGen/DAGISelEmitter.cpp

Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=53096&r1=53095&r2=53096&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Thu Jul  3 03:39:51 2008
@@ -206,6 +206,28 @@
   return false;
 }
 
+static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) {
+  return CGP.getSDNodeInfo(Op).getEnumName();
+}
+
+static
+bool DisablePatternForFastISel(TreePatternNode *N, CodeGenDAGPatterns &CGP) {
+  bool isStore = !N->isLeaf() &&
+    getOpcodeName(N->getOperator(), CGP) == "ISD::STORE";
+  if (!isStore && NodeHasProperty(N, SDNPHasChain, CGP))
+    return false;
+
+  bool HasChain = false;
+  for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) {
+    TreePatternNode *Child = N->getChild(i);
+    if (PatternHasProperty(Child, SDNPHasChain, CGP)) {
+      HasChain = true;
+      break;
+    }
+  }
+  return HasChain;
+}
+
 //===----------------------------------------------------------------------===//
 // Node Transformation emitter implementation.
 //
@@ -404,6 +426,9 @@
       // Record input varargs info.
       NumInputRootOps = N->getNumChildren();
 
+      if (DisablePatternForFastISel(N, CGP))
+        emitCheck("!FastISel");
+
       std::string PredicateCheck;
       for (unsigned i = 0, e = Predicates->getSize(); i != e; ++i) {
         if (DefInit *Pred = dynamic_cast<DefInit*>(Predicates->getElement(i))) {
@@ -480,10 +505,8 @@
           //      /        [YY]
           //      |         ^
           //     [XX]-------|
-          bool NeedCheck = false;
-          if (P != Pattern)
-            NeedCheck = true;
-          else {
+          bool NeedCheck = P != Pattern;
+          if (!NeedCheck) {
             const SDNodeInfo &PInfo = CGP.getSDNodeInfo(P->getOperator());
             NeedCheck =
               P->getOperator() == CGP.get_intrinsic_void_sdnode() ||
@@ -1548,10 +1571,6 @@
     OS << std::string(Indent-2, ' ') << "}\n";
 }
 
-static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) {
-  return CGP.getSDNodeInfo(Op).getEnumName();
-}
-
 static std::string getLegalCName(std::string OpName) {
   std::string::size_type pos = OpName.find("::");
   if (pos != std::string::npos)





More information about the llvm-commits mailing list