diff options
author | Chris Lattner <sabre@nondot.org> | 2010-02-15 08:04:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-02-15 08:04:42 +0000 |
commit | da272d1a704bd564272e88cbdbcf14712e3abbdc (patch) | |
tree | 0f0a021cb55a151c44523e3f593bbc347f3e7e7a /utils/TableGen/DAGISelEmitter.cpp | |
parent | 9f06cb4fe5214c93cbe68b5359b43891875b30e5 (diff) | |
download | llvm-da272d1a704bd564272e88cbdbcf14712e3abbdc.tar.gz llvm-da272d1a704bd564272e88cbdbcf14712e3abbdc.tar.bz2 llvm-da272d1a704bd564272e88cbdbcf14712e3abbdc.tar.xz |
Check in the first big step of rewriting DAGISelEmitter to
produce a table based matcher instead of gobs of C++ Code.
Though it's not done yet, the shrinkage seems promising,
the table for the X86 ISel is 75K and still has a lot of
optimization to come (compare to the ~1.5M of .o generated
the old way, much of which will go away).
The code is currently disabled by default (the #if 0 in
DAGISelEmitter.cpp). When enabled it generates a dead
SelectCode2 function in the DAGISel Header which will
eventually replace SelectCode.
There is still a lot of stuff left to do, which are
documented with a trail of FIXMEs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96215 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.cpp')
-rw-r--r-- | utils/TableGen/DAGISelEmitter.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index e8aa164302..0eb06bb541 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "DAGISelEmitter.h" +#include "DAGISelMatcher.h" #include "Record.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CommandLine.h" @@ -1609,7 +1610,7 @@ static std::string getLegalCName(std::string OpName) { void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) { const CodeGenTarget &Target = CGP.getTargetInfo(); - + // Get the namespace to insert instructions into. std::string InstNS = Target.getInstNamespace(); if (!InstNS.empty()) InstNS += "::"; @@ -1621,7 +1622,6 @@ void DAGISelEmitter::EmitInstructionSelector(raw_ostream &OS) { for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), E = CGP.ptm_end(); I != E; ++I) { const PatternToMatch &Pattern = *I; - TreePatternNode *Node = Pattern.getSrcPattern(); if (!Node->isLeaf()) { PatternsByOpcode[getOpcodeName(Node->getOperator(), CGP)]. @@ -2011,4 +2011,26 @@ void DAGISelEmitter::run(raw_ostream &OS) { // definitions. Emit the resultant instruction selector. EmitInstructionSelector(OS); +#if 0 + MatcherNode *Matcher = 0; + // Walk the patterns backwards, building a matcher for each and adding it to + // the matcher for the whole target. + for (CodeGenDAGPatterns::ptm_iterator I = CGP.ptm_begin(), + E = CGP.ptm_end(); I != E;) { + const PatternToMatch &Pattern = *--E; + MatcherNode *N = ConvertPatternToMatcher(Pattern, CGP); + + if (Matcher == 0) + Matcher = N; + else + Matcher = new PushMatcherNode(N, Matcher); + } + + + EmitMatcherTable(Matcher, OS); + + + //Matcher->dump(); + delete Matcher; +#endif } |