From b22950df6cc6a980cd3fd4d6ee84f4ab8f5b9a1f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 16 Nov 2005 23:14:54 +0000 Subject: [PATCH] fix a tblgen bug that Evan ran into, where we would lose the '$src' name on patterns like "(set R32:$dst, (i32 imm:$src))" llvm-svn: 24383 --- llvm/utils/TableGen/DAGISelEmitter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp index 5cc1f273af3b..092fff83a923 100644 --- a/llvm/utils/TableGen/DAGISelEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelEmitter.cpp @@ -631,9 +631,7 @@ TreePatternNode *TreePattern::ParseTreePattern(DagInit *Dag) { if (R->isSubClassOf("SDNode") || R->isSubClassOf("PatFrag")) { Dag->setArg(0, new DagInit(R, std::vector >())); - TreePatternNode *TPN = ParseTreePattern(Dag); - TPN->setName(Dag->getArgName(0)); - return TPN; + return ParseTreePattern(Dag); } New = new TreePatternNode(DI); @@ -651,6 +649,7 @@ TreePatternNode *TreePattern::ParseTreePattern(DagInit *Dag) { // Apply the type cast. New->UpdateNodeType(getValueType(Operator), *this); + New->setName(Dag->getArgName(0)); return New; } @@ -672,7 +671,8 @@ TreePatternNode *TreePattern::ParseTreePattern(DagInit *Dag) { Init *Arg = Dag->getArg(i); if (DagInit *DI = dynamic_cast(Arg)) { Children.push_back(ParseTreePattern(DI)); - Children.back()->setName(Dag->getArgName(i)); + if (Children.back()->getName().empty()) + Children.back()->setName(Dag->getArgName(i)); } else if (DefInit *DefI = dynamic_cast(Arg)) { Record *R = DefI->getDef(); // Direct reference to a leaf DagNode or PatFrag? Turn it into a