summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-22 23:55:39 +0000
committerChris Lattner <sabre@nondot.org>2010-02-22 23:55:39 +0000
commit60680ad31607a670c6bbbfd6b8bec4d5ea219669 (patch)
tree19e513ea38affc7f1d212ca5da966e7630d0c7c7
parent2a33390e2b95fd36b8e824c08982115c37238cc0 (diff)
downloadbcm5719-llvm-60680ad31607a670c6bbbfd6b8bec4d5ea219669.tar.gz
bcm5719-llvm-60680ad31607a670c6bbbfd6b8bec4d5ea219669.zip
add a new Push2 opcode for targets (like cellspu) which have
ridiculously ginormous patterns and need more than one byte of displacement for encodings. This fixes CellSPU/fdiv.ll. SPU is still doing something else ridiculous though. llvm-svn: 96833
-rw-r--r--llvm/include/llvm/CodeGen/DAGISelHeader.h15
-rw-r--r--llvm/utils/TableGen/DAGISelMatcherEmitter.cpp23
2 files changed, 32 insertions, 6 deletions
diff --git a/llvm/include/llvm/CodeGen/DAGISelHeader.h b/llvm/include/llvm/CodeGen/DAGISelHeader.h
index 0ebb9f10f6d..29d66f59954 100644
--- a/llvm/include/llvm/CodeGen/DAGISelHeader.h
+++ b/llvm/include/llvm/CodeGen/DAGISelHeader.h
@@ -201,7 +201,7 @@ GetInt8(const unsigned char *MatcherTable, unsigned &Idx) {
}
enum BuiltinOpcodes {
- OPC_Push,
+ OPC_Push, OPC_Push2,
OPC_RecordNode,
OPC_RecordMemRef,
OPC_CaptureFlagInput,
@@ -359,6 +359,19 @@ SDNode *SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
MatchScopes.push_back(NewEntry);
continue;
}
+ case OPC_Push2: {
+ unsigned NumToSkip = GetInt2(MatcherTable, MatcherIndex);
+ MatchScope NewEntry;
+ NewEntry.FailIndex = MatcherIndex+NumToSkip;
+ NewEntry.NodeStackSize = NodeStack.size();
+ NewEntry.NumRecordedNodes = RecordedNodes.size();
+ NewEntry.NumMatchedMemRefs = MatchedMemRefs.size();
+ NewEntry.InputChain = InputChain;
+ NewEntry.InputFlag = InputFlag;
+ NewEntry.HasChainNodesMatched = !ChainNodesMatched.empty();
+ MatchScopes.push_back(NewEntry);
+ continue;
+ }
case OPC_RecordNode:
// Remember this node, it may end up being an operand in the pattern.
RecordedNodes.push_back(N);
diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index 82d852e379f..33e37fae949 100644
--- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -350,16 +350,29 @@ EmitMatcherList(const MatcherNode *N, unsigned Indent, unsigned CurrentIdx,
NextSize = EmitMatcherList(cast<PushMatcherNode>(N)->getNext(),
Indent+1, CurrentIdx+2, FOS);
}
-
+
+ // In the unlikely event that we have something too big to emit with a
+ // one byte offset, regenerate it with a two-byte one.
if (NextSize > 255) {
- errs() <<
- "Tblgen internal error: can't handle predicate this complex yet\n";
- // FIXME: exit(1);
+ TmpBuf.clear();
+ raw_svector_ostream OS(TmpBuf);
+ formatted_raw_ostream FOS(OS);
+ NextSize = EmitMatcherList(cast<PushMatcherNode>(N)->getNext(),
+ Indent+1, CurrentIdx+3, FOS);
+ if (NextSize > 65535) {
+ errs() <<
+ "Tblgen internal error: can't handle pattern this complex yet\n";
+ exit(1);
+ }
}
OS << "/*" << CurrentIdx << "*/";
OS.PadToColumn(Indent*2);
- OS << "OPC_Push, " << NextSize << ",\n";
+
+ if (NextSize < 256)
+ OS << "OPC_Push, " << NextSize << ",\n";
+ else
+ OS << "OPC_Push2, " << (NextSize&255) << ", " << (NextSize>>8) << ",\n";
OS << TmpBuf.str();
Size += 2+NextSize;
OpenPOWER on IntegriCloud