[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp

Chris Lattner sabre at nondot.org
Tue Nov 14 13:50:42 PST 2006



Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.285 -> 1.286
---
Log message:

minimal hack to get patterns whose result type is iPTR to be selected.


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

 DAGISelEmitter.cpp |   16 ++++++++++++++++
 1 files changed, 16 insertions(+)


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.285 llvm/utils/TableGen/DAGISelEmitter.cpp:1.286
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.285	Tue Nov 14 15:41:35 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp	Tue Nov 14 15:50:27 2006
@@ -3725,15 +3725,31 @@
       OS << "    return Select_" << getLegalCName(OpName)
          << (VTStr != "" ? "_" : "") << VTStr << "(N);\n";
     } else {
+      // Keep track of whether we see a pattern that has an iPtr result.
+      bool HasPtrPattern = false;
+      
       OS << "    switch (NVT) {\n";
       for (unsigned i = 0, e = OpVTs.size(); i < e; ++i) {
         std::string &VTStr = OpVTs[i];
         assert(!VTStr.empty() && "Unset vtstr?");
+
+        // If this is a match on iPTR: don't emit it directly, we need special
+        // code.
+        if (VTStr == "iPTR") {
+          HasPtrPattern = true;
+          continue;
+        }
         OS << "    case MVT::" << VTStr << ":\n"
            << "      return Select_" << getLegalCName(OpName)
            << "_" << VTStr << "(N);\n";
       }
       OS << "    default:\n";
+      
+      // If there is an iPTR result version of this pattern, emit it here.
+      if (HasPtrPattern) {
+        OS << "      if (NVT == TLI.getPointerTy())\n";
+        OS << "        return Select_" << getLegalCName(OpName) <<"_iPTR(N);\n";
+      }
       OS << "      break;\n";
       OS << "    }\n";
       OS << "    break;\n";






More information about the llvm-commits mailing list