summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-25 19:00:39 +0000
committerChris Lattner <sabre@nondot.org>2010-02-25 19:00:39 +0000
commitd6c84720df0b63e34081e0c7890f3074d8b110b9 (patch)
treef46552db5b37742ed3f49f1084681468b7222756 /utils/TableGen/DAGISelEmitter.cpp
parent2333655ed04637ffd049b9299685a0752aab8e8d (diff)
downloadllvm-d6c84720df0b63e34081e0c7890f3074d8b110b9.tar.gz
llvm-d6c84720df0b63e34081e0c7890f3074d8b110b9.tar.bz2
llvm-d6c84720df0b63e34081e0c7890f3074d8b110b9.tar.xz
change the scope node to include a list of children to be checked
instead of to have a chained series of scope nodes. This makes the generated table smaller, improves the efficiency of the interpreter, and make the factoring optimization much more reasonable to implement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.cpp')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index fbf3f86e08..5e2b07d0d4 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -1945,8 +1945,6 @@ void DAGISelEmitter::run(raw_ostream &OS) {
}
#ifdef ENABLE_NEW_ISEL
- Matcher *TheMatcher = 0;
-
// Add all the patterns to a temporary list so we can sort them.
std::vector<const PatternToMatch*> Patterns;
for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), E = CGP.ptm_end();
@@ -1960,20 +1958,13 @@ void DAGISelEmitter::run(raw_ostream &OS) {
PatternSortingPredicate2(CGP));
- // Walk the patterns backwards (since we append to the front of the generated
- // code), building a matcher for each and adding it to the matcher for the
- // whole target.
- while (!Patterns.empty()) {
- const PatternToMatch &Pattern = *Patterns.back();
- Patterns.pop_back();
-
- Matcher *N = ConvertPatternToMatcher(Pattern, CGP);
-
- if (TheMatcher == 0)
- TheMatcher = N;
- else
- TheMatcher = new ScopeMatcher(N, TheMatcher);
- }
+ // Convert each pattern into Matcher's.
+ std::vector<Matcher*> PatternMatchers;
+ for (unsigned i = 0, e = Patterns.size(); i != e; ++i)
+ PatternMatchers.push_back(ConvertPatternToMatcher(*Patterns[i], CGP));
+
+ Matcher *TheMatcher = new ScopeMatcher(&PatternMatchers[0],
+ PatternMatchers.size());
TheMatcher = OptimizeMatcher(TheMatcher);
//Matcher->dump();