Allow non zero_reg explicit values for OptionalDefOperands in aliases.
authorJim Grosbach <grosbach@apple.com>
Fri, 19 Aug 2011 20:33:06 +0000 (20:33 +0000)
committerJim Grosbach <grosbach@apple.com>
Fri, 19 Aug 2011 20:33:06 +0000 (20:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138073 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/CodeGenInstruction.cpp

index 751326c8ad2897018e4e3a3b9fd1dd0fd6d2339a..b4f9d150716be48c7346d0305829e024ad952ed7 100644 (file)
@@ -424,6 +424,13 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo,
 
   // Handle explicit registers.
   if (ADI && ADI->getDef()->isSubClassOf("Register")) {
+    if (InstOpRec->isSubClassOf("OptionalDefOperand")) {
+      DagInit *DI = InstOpRec->getValueAsDag("MIOperandInfo");
+      // The operand info should only have a single (register) entry. We
+      // want the register class of it.
+      InstOpRec = dynamic_cast<DefInit*>(DI->getArg(0))->getDef();
+    }
+
     if (InstOpRec->isSubClassOf("RegisterOperand"))
       InstOpRec = InstOpRec->getValueAsDef("RegClass");