aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen/DAGISelHeader.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-17 05:35:28 +0000
committerChris Lattner <sabre@nondot.org>2010-02-17 05:35:28 +0000
commit8583db790d98fa1b216ec80123799e3f5f7aa8f7 (patch)
tree6c70d459e667d22928078285d6fae988c1973767 /include/llvm/CodeGen/DAGISelHeader.h
parenta5e66024017daacce6f409d60d94a8a1b9e0c35d (diff)
downloadexternal_llvm-8583db790d98fa1b216ec80123799e3f5f7aa8f7.zip
external_llvm-8583db790d98fa1b216ec80123799e3f5f7aa8f7.tar.gz
external_llvm-8583db790d98fa1b216ec80123799e3f5f7aa8f7.tar.bz2
simplify IsChainCompatible codegen, add comments. no
functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96453 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/DAGISelHeader.h')
-rw-r--r--include/llvm/CodeGen/DAGISelHeader.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/DAGISelHeader.h b/include/llvm/CodeGen/DAGISelHeader.h
index f3eccf0..8cd11f6 100644
--- a/include/llvm/CodeGen/DAGISelHeader.h
+++ b/include/llvm/CodeGen/DAGISelHeader.h
@@ -26,9 +26,8 @@
/// node list.
SelectionDAG::allnodes_iterator ISelPosition;
-/// IsChainCompatible - Returns true if Chain is Op or Chain does
-/// not reach Op.
-static bool IsChainCompatible(SDNode *Chain, SDNode *Op) {
+/// ChainNotReachable - Returns true if Chain does not reach Op.
+static bool ChainNotReachable(SDNode *Chain, SDNode *Op) {
if (Chain->getOpcode() == ISD::EntryToken)
return true;
if (Chain->getOpcode() == ISD::TokenFactor)
@@ -36,11 +35,20 @@ static bool IsChainCompatible(SDNode *Chain, SDNode *Op) {
if (Chain->getNumOperands() > 0) {
SDValue C0 = Chain->getOperand(0);
if (C0.getValueType() == MVT::Other)
- return C0.getNode() != Op && IsChainCompatible(C0.getNode(), Op);
+ return C0.getNode() != Op && ChainNotReachable(C0.getNode(), Op);
}
return true;
}
+/// IsChainCompatible - Returns true if Chain is Op or Chain does not reach Op.
+/// This is used to ensure that there are no nodes trapped between Chain, which
+/// is the first chain node discovered in a pattern and Op, a later node, that
+/// will not be selected into the pattern.
+static bool IsChainCompatible(SDNode *Chain, SDNode *Op) {
+ return Chain == Op || ChainNotReachable(Chain, Op);
+}
+
+
/// ISelUpdater - helper class to handle updates of the
/// instruciton selection graph.
class VISIBILITY_HIDDEN ISelUpdater : public SelectionDAG::DAGUpdateListener {