summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-21 23:54:05 +0000
committerChris Lattner <sabre@nondot.org>2010-02-21 23:54:05 +0000
commit565a6f94804d12ff637b8c3cfc7752e1d265f3ee (patch)
treefe7c918f5322e0f43afe35c134f3eee59738bf48 /include
parent12783d1c3a86d1b5287b0703db6893ae1f283877 (diff)
downloadllvm-565a6f94804d12ff637b8c3cfc7752e1d265f3ee.tar.gz
llvm-565a6f94804d12ff637b8c3cfc7752e1d265f3ee.tar.bz2
llvm-565a6f94804d12ff637b8c3cfc7752e1d265f3ee.tar.xz
fix most of the failures in the x86 suite by handling multiple
result nodes correctly. Note that this includes a horrible hack in DAGISelHeader which cannot be fixed reasonably without eliminating (parallel) from input patterns. That, in turn, can't be done until we support writing multiple result patterns for the X86and_flag and related multiple-result nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96767 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/DAGISelHeader.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/DAGISelHeader.h b/include/llvm/CodeGen/DAGISelHeader.h
index 99263b0773..3a6fee9577 100644
--- a/include/llvm/CodeGen/DAGISelHeader.h
+++ b/include/llvm/CodeGen/DAGISelHeader.h
@@ -695,7 +695,11 @@ SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
NodeToMatch->getDebugLoc(),
VTList,
Ops.data(), Ops.size());
- RecordedNodes.push_back(SDValue(Res, 0));
+ // Add all the non-flag/non-chain results to the RecordedNodes list.
+ for (unsigned i = 0, e = VTs.size(); i != e; ++i) {
+ if (VTs[i] == MVT::Other || VTs[i] == MVT::Flag) break;
+ RecordedNodes.push_back(SDValue(Res, i));
+ }
// If the node had chain/flag results, update our notion of the current
// chain and flag.
@@ -731,6 +735,13 @@ SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
unsigned ResSlot = MatcherTable[MatcherIndex++];
assert(ResSlot < RecordedNodes.size() && "Invalid CheckSame");
SDValue Res = RecordedNodes[ResSlot];
+
+ // FIXME2: Eliminate this horrible hack by fixing the 'Gen' program
+ // after (parallel) on input patterns are removed. This would also
+ // allow us to stop encoding #results in OPC_CompleteMatch's table
+ // entry.
+ if (NodeToMatch->getNumValues() <= i)
+ break;
assert((NodeToMatch->getValueType(i) == Res.getValueType() ||
NodeToMatch->getValueType(i) == MVT::iPTR ||
Res.getValueType() == MVT::iPTR ||
@@ -763,6 +774,8 @@ SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
ReplaceUses(SDValue(NodeToMatch, NodeToMatch->getNumValues()-1),
InputFlag);
+ assert(NodeToMatch->use_empty() &&
+ "Didn't replace all uses of the node?");
// FIXME: We just return here, which interacts correctly with SelectRoot
// above. We should fix this to not return an SDNode* anymore.
return 0;