summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelEmitter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-16 23:13:59 +0000
committerChris Lattner <sabre@nondot.org>2010-02-16 23:13:59 +0000
commit05446e7d47294a91c0af4b9220c64fb355e8d7e8 (patch)
tree43d7e11a068407c5e5075b745e609f58fa60cd57 /utils/TableGen/DAGISelEmitter.cpp
parentb76beda30a3630a9fd5fde10f43d27dd51fb5037 (diff)
downloadllvm-05446e7d47294a91c0af4b9220c64fb355e8d7e8.tar.gz
llvm-05446e7d47294a91c0af4b9220c64fb355e8d7e8.tar.bz2
llvm-05446e7d47294a91c0af4b9220c64fb355e8d7e8.tar.xz
clean up some code, eliminate NodeIsComplexPattern, which
does the same thing as getComplexPatternInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96411 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelEmitter.cpp')
-rw-r--r--utils/TableGen/DAGISelEmitter.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index 9b8d88d215..a62905e9ec 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -47,16 +47,6 @@ static std::string getValueName(const std::string &S) {
return S;
}
-/// NodeIsComplexPattern - return true if N is a leaf node and a subclass of
-/// ComplexPattern.
-static bool NodeIsComplexPattern(TreePatternNode *N) {
- return (N->isLeaf() &&
- dynamic_cast<DefInit*>(N->getLeafValue()) &&
- static_cast<DefInit*>(N->getLeafValue())->getDef()->
- isSubClassOf("ComplexPattern"));
-}
-
-
/// getPatternSize - Return the 'size' of this pattern. We want to match large
/// patterns before small ones. This is used to determine the size of a
/// pattern.
@@ -96,7 +86,7 @@ static unsigned getPatternSize(TreePatternNode *P, CodeGenDAGPatterns &CGP) {
else if (Child->isLeaf()) {
if (dynamic_cast<IntInit*>(Child->getLeafValue()))
Size += 5; // Matches a ConstantSDNode (+3) and a specific value (+2).
- else if (NodeIsComplexPattern(Child))
+ else if (Child->getComplexPatternInfo(CGP))
Size += getPatternSize(Child, CGP);
else if (!Child->getPredicateFns().empty())
++Size;
@@ -530,10 +520,9 @@ void PatternCodeEmitter::EmitMatchCode(TreePatternNode *N, TreePatternNode *P,
")->getSExtValue() == INT64_C(" +
itostr(II->getValue()) + ")");
return;
- } else if (!NodeIsComplexPattern(N)) {
- assert(0 && "Cannot match this as a leaf value!");
- abort();
}
+ assert(N->getComplexPatternInfo(CGP) != 0 &&
+ "Cannot match this as a leaf value!");
}
// If this node has a name associated with it, capture it in VariableMap. If
@@ -2014,11 +2003,9 @@ void DAGISelEmitter::run(raw_ostream &OS) {
else
Matcher = new PushMatcherNode(N, Matcher);
}
-
-
+
+ // OptimizeMatcher(Matcher);
EmitMatcherTable(Matcher, OS);
-
-
//Matcher->dump();
delete Matcher;
#endif