summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-24 20:15:25 +0000
committerChris Lattner <sabre@nondot.org>2010-02-24 20:15:25 +0000
commit0c95baa84872c7f128d883bd3662f3eeeede9707 (patch)
tree524c714493744bfebf79d7e38e115aaad8333bfa /llvm/utils/TableGen/DAGISelMatcherOpt.cpp
parent86ba44a4c723211642cb5292392fe7f773df944e (diff)
downloadbcm5719-llvm-0c95baa84872c7f128d883bd3662f3eeeede9707.tar.gz
bcm5719-llvm-0c95baa84872c7f128d883bd3662f3eeeede9707.zip
contract movechild+checktype into a new checkchild node, shrinking the
x86 table by 1200 bytes. llvm-svn: 97053
Diffstat (limited to 'llvm/utils/TableGen/DAGISelMatcherOpt.cpp')
-rw-r--r--llvm/utils/TableGen/DAGISelMatcherOpt.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
index 408bd63e331..796b815a93b 100644
--- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
@@ -26,12 +26,19 @@ static void ContractNodes(OwningPtr<MatcherNode> &Matcher) {
// If we found a movechild node with a node that comes in a 'foochild' form,
// transform it.
if (MoveChildMatcherNode *MC = dyn_cast<MoveChildMatcherNode>(N)) {
- if (RecordMatcherNode *RM = dyn_cast<RecordMatcherNode>(MC->getNext())) {
- MatcherNode *New
- = new RecordChildMatcherNode(MC->getChildNo(), RM->getWhatFor());
+ MatcherNode *New = 0;
+ if (RecordMatcherNode *RM = dyn_cast<RecordMatcherNode>(MC->getNext()))
+ New = new RecordChildMatcherNode(MC->getChildNo(), RM->getWhatFor());
+
+ if (CheckTypeMatcherNode *CT= dyn_cast<CheckTypeMatcherNode>(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);
}
}
OpenPOWER on IntegriCloud