summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-02 02:22:10 +0000
committerChris Lattner <sabre@nondot.org>2010-03-02 02:22:10 +0000
commitb884fe867e874cf8159cbbf7067fd1ce0e1aba27 (patch)
treecd0fb386a524495997b8ed38dfd789775af9908a /llvm/utils/TableGen
parent4cec5439522410706badcf73769cbce0195f8033 (diff)
downloadbcm5719-llvm-b884fe867e874cf8159cbbf7067fd1ce0e1aba27.tar.gz
bcm5719-llvm-b884fe867e874cf8159cbbf7067fd1ce0e1aba27.zip
Rewrite chain handling validation and input TokenFactor handling
stuff now that we don't care about emulating the old broken behavior of the old isel. This eliminates the 'CheckChainCompatible' check (along with IsChainCompatible) which did an incorrect and inefficient scan *up* the chain nodes which happened as the pattern was being formed and does the validation at the end in HandleMergeInputChains when it forms a structural pattern. This scans "down" the graph, which means that it is quickly bounded by nodes already selected. This also handles token factors that get "trapped" in the dag. Removing the CheckChainCompatible nodes also shrinks the generated tables by about 6K for X86 (down to 83K). There are two pieces remaining before I can nuke PreprocessRMW: 1. I xfailed a test because we're now producing worse code in a case that has nothing to do with the change: it turns out that our use of MorphNodeTo will leave dead nodes in the graph which (depending on how the graph is walked) end up causing bogus uses of chains and blocking matches. This is really bad for other reasons, so I'll fix this in a follow-up patch. 2. CheckFoldableChainNode needs to be improved to handle the TF. llvm-svn: 97539
Diffstat (limited to 'llvm/utils/TableGen')
-rw-r--r--llvm/utils/TableGen/DAGISelMatcher.cpp5
-rw-r--r--llvm/utils/TableGen/DAGISelMatcher.h25
-rw-r--r--llvm/utils/TableGen/DAGISelMatcherEmitter.cpp5
-rw-r--r--llvm/utils/TableGen/DAGISelMatcherGen.cpp23
4 files changed, 0 insertions, 58 deletions
diff --git a/llvm/utils/TableGen/DAGISelMatcher.cpp b/llvm/utils/TableGen/DAGISelMatcher.cpp
index 860165f7f4f..a2603e9683a 100644
--- a/llvm/utils/TableGen/DAGISelMatcher.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcher.cpp
@@ -137,11 +137,6 @@ void CheckFoldableChainNodeMatcher::printImpl(raw_ostream &OS,
OS.indent(indent) << "CheckFoldableChainNode\n";
}
-void CheckChainCompatibleMatcher::printImpl(raw_ostream &OS,
- unsigned indent) const {
- OS.indent(indent) << "CheckChainCompatible " << PreviousOp << "\n";
-}
-
void EmitIntegerMatcher::printImpl(raw_ostream &OS, unsigned indent) const {
OS.indent(indent) << "EmitInteger " << Val << " VT=" << VT << '\n';
}
diff --git a/llvm/utils/TableGen/DAGISelMatcher.h b/llvm/utils/TableGen/DAGISelMatcher.h
index 1634cd2ecdd..3eb6755674a 100644
--- a/llvm/utils/TableGen/DAGISelMatcher.h
+++ b/llvm/utils/TableGen/DAGISelMatcher.h
@@ -64,7 +64,6 @@ public:
CheckAndImm,
CheckOrImm,
CheckFoldableChainNode,
- CheckChainCompatible,
// Node creation/emisssion.
EmitInteger, // Create a TargetConstant
@@ -671,30 +670,6 @@ private:
virtual unsigned getHashImpl() const { return 0; }
};
-/// CheckChainCompatibleMatcher - Verify that the current node's chain
-/// operand is 'compatible' with the specified recorded node's.
-class CheckChainCompatibleMatcher : public Matcher {
- unsigned PreviousOp;
-public:
- CheckChainCompatibleMatcher(unsigned previousop)
- : Matcher(CheckChainCompatible), PreviousOp(previousop) {}
-
- unsigned getPreviousOp() const { return PreviousOp; }
-
- static inline bool classof(const Matcher *N) {
- return N->getKind() == CheckChainCompatible;
- }
-
- virtual bool isSafeToReorderWithPatternPredicate() const { return true; }
-
-private:
- virtual void printImpl(raw_ostream &OS, unsigned indent) const;
- virtual bool isEqualImpl(const Matcher *M) const {
- return cast<CheckChainCompatibleMatcher>(M)->PreviousOp == PreviousOp;
- }
- virtual unsigned getHashImpl() const { return PreviousOp; }
-};
-
/// EmitIntegerMatcher - This creates a new TargetConstant.
class EmitIntegerMatcher : public Matcher {
int64_t Val;
diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index fe92689cace..2e3e58d1735 100644
--- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -376,10 +376,6 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
case Matcher::CheckFoldableChainNode:
OS << "OPC_CheckFoldableChainNode,\n";
return 1;
- case Matcher::CheckChainCompatible:
- OS << "OPC_CheckChainCompatible, "
- << cast<CheckChainCompatibleMatcher>(N)->getPreviousOp() << ",\n";
- return 2;
case Matcher::EmitInteger: {
int64_t Val = cast<EmitIntegerMatcher>(N)->getValue();
@@ -686,7 +682,6 @@ void MatcherTableEmitter::EmitHistogram(formatted_raw_ostream &OS) {
case Matcher::CheckOrImm: OS << "OPC_CheckOrImm"; break;
case Matcher::CheckFoldableChainNode:
OS << "OPC_CheckFoldableChainNode"; break;
- case Matcher::CheckChainCompatible: OS << "OPC_CheckChainCompatible"; break;
case Matcher::EmitInteger: OS << "OPC_EmitInteger"; break;
case Matcher::EmitStringInteger: OS << "OPC_EmitStringInteger"; break;
case Matcher::EmitRegister: OS << "OPC_EmitRegister"; break;
diff --git a/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/llvm/utils/TableGen/DAGISelMatcherGen.cpp
index c0f04deb55f..448280345bc 100644
--- a/llvm/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherGen.cpp
@@ -267,16 +267,6 @@ void MatcherGen::EmitLeafMatchCode(const TreePatternNode *N) {
assert(NextRecordedOperandNo > 1 &&
"Should have recorded input/result chains at least!");
MatchedChainNodes.push_back(NextRecordedOperandNo-1);
-
- // If we need to check chains, do so, see comment for
- // "NodeHasProperty(SDNPHasChain" below.
- if (MatchedChainNodes.size() > 1) {
- // FIXME2: This is broken, we should eliminate this nonsense completely,
- // but we want to produce the same selections that the old matcher does
- // for now.
- unsigned PrevOp = MatchedChainNodes[MatchedChainNodes.size()-2];
- AddMatcher(new CheckChainCompatibleMatcher(PrevOp));
- }
}
// TODO: Complex patterns can't have output flags, if they did, we'd want
@@ -354,19 +344,6 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N,
// Remember all of the input chains our pattern will match.
MatchedChainNodes.push_back(NextRecordedOperandNo++);
- // If this is the second (e.g. indbr(load) or store(add(load))) or third
- // input chain (e.g. (store (add (load, load))) from msp430) we need to make
- // sure that folding the chain won't induce cycles in the DAG. This could
- // happen if there were an intermediate node between the indbr and load, for
- // example.
- if (MatchedChainNodes.size() > 1) {
- // FIXME2: This is broken, we should eliminate this nonsense completely,
- // but we want to produce the same selections that the old matcher does
- // for now.
- unsigned PrevOp = MatchedChainNodes[MatchedChainNodes.size()-2];
- AddMatcher(new CheckChainCompatibleMatcher(PrevOp));
- }
-
// Don't look at the input chain when matching the tree pattern to the
// SDNode.
OpNo = 1;
OpenPOWER on IntegriCloud