Add support for patterns that have physical registers in them. Testcase:
authorChris Lattner <sabre@nondot.org>
Wed, 19 Oct 2005 02:07:26 +0000 (02:07 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 19 Oct 2005 02:07:26 +0000 (02:07 +0000)
def : Pat<(trunc G8RC:$in),
          (OR8To4 G8RC:$in, X0)>;

Even though this doesn't make any sense on PPC :)

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

utils/TableGen/DAGISelEmitter.cpp

index 12ca95f7d0e5e076516f815ced6f92ea830afb18..0f9d30450ef965379d52a331475cdd5b6105b0e6 100644 (file)
@@ -1617,6 +1617,18 @@ CodeGenPatternResult(TreePatternNode *N, unsigned &Ctr,
   }
   
   if (N->isLeaf()) {
+    // If this is an explicit register reference, handle it.
+    if (DefInit *DI = dynamic_cast<DefInit*>(N->getLeafValue())) {
+      unsigned ResNo = Ctr++;
+      if (DI->getDef()->isSubClassOf("Register")) {
+        OS << "      SDOperand Tmp" << ResNo << " = CurDAG->getRegister("
+           << getQualifiedName(DI->getDef()) << ", MVT::"
+           << getEnumName(N->getType())
+           << ");\n";
+        return ResNo;
+      }
+    }
+    
     N->dump();
     assert(0 && "Unknown leaf type!");
     return ~0U;