From 4e811b51eb996e2fc55a4d48ff960b1c14850e33 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Fri, 19 Aug 2011 20:33:06 +0000 Subject: [PATCH] Allow non zero_reg explicit values for OptionalDefOperands in aliases. llvm-svn: 138073 --- utils/TableGen/CodeGenInstruction.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/TableGen/CodeGenInstruction.cpp b/utils/TableGen/CodeGenInstruction.cpp index 751326c8ad2..b4f9d150716 100644 --- a/utils/TableGen/CodeGenInstruction.cpp +++ b/utils/TableGen/CodeGenInstruction.cpp @@ -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(DI->getArg(0))->getDef(); + } + if (InstOpRec->isSubClassOf("RegisterOperand")) InstOpRec = InstOpRec->getValueAsDef("RegClass");