summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelMatcherGen.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-01 22:46:42 +0000
committerChris Lattner <sabre@nondot.org>2010-03-01 22:46:42 +0000
commit01bcd947bfd1830a9d301236a404138c9c97cd7e (patch)
treea99b4628940bfa034462457a6b293b8571e5436c /utils/TableGen/DAGISelMatcherGen.cpp
parent405f1252b9f3937b9c30edf683375cf261967c79 (diff)
downloadllvm-01bcd947bfd1830a9d301236a404138c9c97cd7e.tar.gz
llvm-01bcd947bfd1830a9d301236a404138c9c97cd7e.tar.bz2
llvm-01bcd947bfd1830a9d301236a404138c9c97cd7e.tar.xz
resolve a fixme and simplify code by moving insertion of the
EmitMergeInputChainsMatcher node up into EmitResultCode. This doesn't have much of an effect on the generated code, the X86 table is exactly the same size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelMatcherGen.cpp')
-rw-r--r--utils/TableGen/DAGISelMatcherGen.cpp26
1 files changed, 8 insertions, 18 deletions
diff --git a/utils/TableGen/DAGISelMatcherGen.cpp b/utils/TableGen/DAGISelMatcherGen.cpp
index 0c7456ef23..260d4df588 100644
--- a/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/utils/TableGen/DAGISelMatcherGen.cpp
@@ -80,10 +80,6 @@ namespace {
/// second is the recorded slot number the input pattern match saved it in.
SmallVector<std::pair<Record*, unsigned>, 2> PhysRegInputs;
- /// EmittedMergeInputChains - For nodes that match patterns involving
- /// chains, is set to true if we emitted the "MergeInputChains" operation.
- bool EmittedMergeInputChains;
-
/// Matcher - This is the top level of the generated matcher, the result.
Matcher *TheMatcher;
@@ -141,7 +137,7 @@ namespace {
MatcherGen::MatcherGen(const PatternToMatch &pattern,
const CodeGenDAGPatterns &cgp)
: Pattern(pattern), CGP(cgp), NextRecordedOperandNo(0),
- EmittedMergeInputChains(false), TheMatcher(0), CurPredicate(0) {
+ TheMatcher(0), CurPredicate(0) {
// We need to produce the matcher tree for the patterns source pattern. To do
// this we need to match the structure as well as the types. To do the type
// matching, we want to figure out the fewest number of type checks we need to
@@ -693,19 +689,6 @@ EmitResultInstructionAsOperand(const TreePatternNode *N,
++ChildNo;
}
- // Nodes that match patterns with (potentially multiple) chain inputs have to
- // merge them together into a token factor.
- if (NodeHasChain && !EmittedMergeInputChains) {
- // FIXME2: Move this out of emitresult to a top level place.
- assert(!MatchedChainNodes.empty() &&
- "How can this node have chain if no inputs do?");
- // Otherwise, we have to emit an operation to merge the input chains and
- // set this as the current input chain.
- AddMatcher(new EmitMergeInputChainsMatcher
- (MatchedChainNodes.data(), MatchedChainNodes.size()));
- EmittedMergeInputChains = true;
- }
-
// If this node has an input flag or explicitly specified input physregs, we
// need to add chained and flagged copyfromreg nodes and materialize the flag
// input.
@@ -819,6 +802,13 @@ void MatcherGen::EmitResultOperand(const TreePatternNode *N,
}
void MatcherGen::EmitResultCode() {
+ // Patterns that match nodes with (potentially multiple) chain inputs have to
+ // merge them together into a token factor. This informs the generated code
+ // what all the chained nodes are.
+ if (!MatchedChainNodes.empty())
+ AddMatcher(new EmitMergeInputChainsMatcher
+ (MatchedChainNodes.data(), MatchedChainNodes.size()));
+
// Codegen the root of the result pattern, capturing the resulting values.
SmallVector<unsigned, 8> Ops;
EmitResultOperand(Pattern.getDstPattern(), Ops);