[llvm-commits] [llvm] r96453 - in /llvm/trunk: include/llvm/CodeGen/DAGISelHeader.h utils/TableGen/DAGISelEmitter.cpp
Chris Lattner
sabre at nondot.org
Tue Feb 16 21:35:38 PST 2010
Author: lattner
Date: Tue Feb 16 23:35:28 2010
New Revision: 96453
URL: http://llvm.org/viewvc/llvm-project?rev=96453&view=rev
Log:
simplify IsChainCompatible codegen, add comments. no
functionality change.
Modified:
llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h
llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h?rev=96453&r1=96452&r2=96453&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DAGISelHeader.h Tue Feb 16 23:35:28 2010
@@ -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 @@
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 {
Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=96453&r1=96452&r2=96453&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Tue Feb 16 23:35:28 2010
@@ -606,10 +606,8 @@
if (NodeHasChain) {
if (FoundChain) {
- emitCheck("(" + ChainName + ".getNode() == " +
- getNodeName(RootName) + " || "
- "IsChainCompatible(" + ChainName + ".getNode(), " +
- getNodeName(RootName) + "))");
+ emitCheck("IsChainCompatible(" + ChainName + ".getNode(), " +
+ getNodeName(RootName) + ")");
OrigChains.push_back(std::make_pair(ChainName,
getValueName(RootName)));
} else
More information about the llvm-commits
mailing list