From 23cfda719e059ce7d761b08fbfb89e676d6c9737 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 24 Feb 2010 20:15:25 +0000 Subject: contract movechild+checktype into a new checkchild node, shrinking the x86 table by 1200 bytes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97053 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/DAGISelMatcherOpt.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'utils/TableGen/DAGISelMatcherOpt.cpp') diff --git a/utils/TableGen/DAGISelMatcherOpt.cpp b/utils/TableGen/DAGISelMatcherOpt.cpp index 408bd63..796b815 100644 --- a/utils/TableGen/DAGISelMatcherOpt.cpp +++ b/utils/TableGen/DAGISelMatcherOpt.cpp @@ -26,12 +26,19 @@ static void ContractNodes(OwningPtr &Matcher) { // If we found a movechild node with a node that comes in a 'foochild' form, // transform it. if (MoveChildMatcherNode *MC = dyn_cast(N)) { - if (RecordMatcherNode *RM = dyn_cast(MC->getNext())) { - MatcherNode *New - = new RecordChildMatcherNode(MC->getChildNo(), RM->getWhatFor()); + MatcherNode *New = 0; + if (RecordMatcherNode *RM = dyn_cast(MC->getNext())) + New = new RecordChildMatcherNode(MC->getChildNo(), RM->getWhatFor()); + + if (CheckTypeMatcherNode *CT= dyn_cast(MC->getNext())) + New = new CheckChildTypeMatcherNode(MC->getChildNo(), CT->getType()); + + if (New) { + // Insert the new node. New->setNext(Matcher.take()); Matcher.reset(New); - MC->setNext(RM->takeNext()); + // Remove the old one. + MC->setNext(MC->getNext()->takeNext()); return ContractNodes(Matcher); } } -- cgit v1.1