summaryrefslogtreecommitdiff
path: root/utils/TableGen/DAGISelMatcherGen.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-16 19:19:58 +0000
committerChris Lattner <sabre@nondot.org>2010-02-16 19:19:58 +0000
commit6bc1b51377d86c7f9ec422ab6962d3051dc92de2 (patch)
tree324c38a60b9ea5ff4a19226623afc0c103f4b2d9 /utils/TableGen/DAGISelMatcherGen.cpp
parent21390d79843050ae8b3226860cadc16ff51d0dcf (diff)
downloadllvm-6bc1b51377d86c7f9ec422ab6962d3051dc92de2.tar.gz
llvm-6bc1b51377d86c7f9ec422ab6962d3051dc92de2.tar.bz2
llvm-6bc1b51377d86c7f9ec422ab6962d3051dc92de2.tar.xz
simplify this code. In the new world order there is no
need to scan the entire subtree of the pattern anymore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96369 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/DAGISelMatcherGen.cpp')
-rw-r--r--utils/TableGen/DAGISelMatcherGen.cpp51
1 files changed, 24 insertions, 27 deletions
diff --git a/utils/TableGen/DAGISelMatcherGen.cpp b/utils/TableGen/DAGISelMatcherGen.cpp
index fac5824f4c..84e9a3d03d 100644
--- a/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/utils/TableGen/DAGISelMatcherGen.cpp
@@ -186,36 +186,33 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N,
// If this node has a chain, then the chain is operand #0 is the SDNode, and
// the child numbers of the node are all offset by one.
unsigned OpNo = 0;
- if (N->NodeHasProperty(SDNPHasChain, CGP))
+ if (N->NodeHasProperty(SDNPHasChain, CGP)) {
OpNo = 1;
- // If this node is not the root and the subtree underneath it produces a
- // chain, then the result of matching the node is also produce a chain.
- // Beyond that, this means that we're also folding (at least) the root node
- // into the node that produce the chain (for example, matching
- // "(add reg, (load ptr))" as a add_with_memory on X86). This is problematic,
- // if the 'reg' node also uses the load (say, its chain). Graphically:
- //
- // [LD]
- // ^ ^
- // | \ DAG's like cheese.
- // / |
- // / [YY]
- // | ^
- // [XX]--/
- //
- // It would be invalid to fold XX and LD. In this case, folding the two
- // nodes together would induce a cycle in the DAG, making it a cyclic DAG (!).
- // To prevent this, we emit a dynamic check for legality before allowing this
- // to be folded.
- //
- const TreePatternNode *Root = Pattern.getSrcPattern();
- if (N != Root && // Not the root of the pattern.
- N->TreeHasProperty(SDNPHasChain, CGP)) { // Has a chain somewhere in tree.
+ // If this node is not the root and the subtree underneath it produces a
+ // chain, then the result of matching the node is also produce a chain.
+ // Beyond that, this means that we're also folding (at least) the root node
+ // into the node that produce the chain (for example, matching
+ // "(add reg, (load ptr))" as a add_with_memory on X86). This is
+ // problematic, if the 'reg' node also uses the load (say, its chain).
+ // Graphically:
+ //
+ // [LD]
+ // ^ ^
+ // | \ DAG's like cheese.
+ // / |
+ // / [YY]
+ // | ^
+ // [XX]--/
+ //
+ // It would be invalid to fold XX and LD. In this case, folding the two
+ // nodes together would induce a cycle in the DAG, making it a 'cyclic DAG'
+ // To prevent this, we emit a dynamic check for legality before allowing
+ // this to be folded.
+ //
+ const TreePatternNode *Root = Pattern.getSrcPattern();
+ if (N != Root) { // Not the root of the pattern.
- // If this non-root node produces a chain, we may need to emit a validity
- // check.
- if (OpNo != 0) {
// If there is a node between the root and this node, then we definitely
// need to emit the check.
bool NeedCheck = !Root->hasChild(N);