[llvm-commits] [llvm] r99494 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp utils/TableGen/DAGISelMatcherEmitter.cpp
Chris Lattner
sabre at nondot.org
Wed Mar 24 23:33:05 PDT 2010
Author: lattner
Date: Thu Mar 25 01:33:05 2010
New Revision: 99494
URL: http://llvm.org/viewvc/llvm-project?rev=99494&view=rev
Log:
Change tblgen to emit FOOISD opcode names as two
bytes instead of one byte. This is important because
we're running up to too many opcodes to fit in a byte
and it is aggrevated by FIRST_TARGET_MEMORY_OPCODE
making the numbering sparse. This just bites the
bullet and bloats out the table. In practice, this
increases the size of the x86 isel table from 74.5K
to 76K. I think we'll cope :)
This fixes rdar://7791648
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=99494&r1=99493&r2=99494&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Mar 25 01:33:05 2010
@@ -1888,7 +1888,9 @@
ALWAYS_INLINE static bool
CheckOpcode(const unsigned char *MatcherTable, unsigned &MatcherIndex,
SDNode *N) {
- return N->getOpcode() == MatcherTable[MatcherIndex++];
+ uint16_t Opc = MatcherTable[MatcherIndex++];
+ Opc |= (unsigned short)MatcherTable[MatcherIndex++] << 8;
+ return N->getOpcode() == Opc;
}
ALWAYS_INLINE static bool
@@ -2142,7 +2144,8 @@
if (CaseSize == 0) break;
// Get the opcode, add the index to the table.
- unsigned Opc = MatcherTable[Idx++];
+ uint16_t Opc = MatcherTable[Idx++];
+ Opc |= (unsigned short)MatcherTable[Idx++] << 8;
if (Opc >= OpcodeOffset.size())
OpcodeOffset.resize((Opc+1)*2);
OpcodeOffset[Opc] = Idx;
@@ -2298,8 +2301,11 @@
CaseSize = GetVBR(CaseSize, MatcherTable, MatcherIndex);
if (CaseSize == 0) break;
+ uint16_t Opc = MatcherTable[MatcherIndex++];
+ Opc |= (unsigned short)MatcherTable[MatcherIndex++] << 8;
+
// If the opcode matches, then we will execute this case.
- if (CurNodeOpcode == MatcherTable[MatcherIndex++])
+ if (CurNodeOpcode == Opc)
break;
// Otherwise, skip over this case.
Modified: llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp?rev=99494&r1=99493&r2=99494&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/DAGISelMatcherEmitter.cpp Thu Mar 25 01:33:05 2010
@@ -255,9 +255,9 @@
}
case Matcher::CheckOpcode:
- OS << "OPC_CheckOpcode, "
- << cast<CheckOpcodeMatcher>(N)->getOpcode().getEnumName() << ",\n";
- return 2;
+ OS << "OPC_CheckOpcode, TARGET_OPCODE("
+ << cast<CheckOpcodeMatcher>(N)->getOpcode().getEnumName() << "),\n";
+ return 3;
case Matcher::SwitchOpcode:
case Matcher::SwitchType: {
@@ -315,16 +315,17 @@
CurrentIdx += EmitVBRValue(ChildSize, OS);
OS << ' ';
- if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N))
- OS << SOM->getCaseOpcode(i).getEnumName();
- else
- OS << getEnumName(cast<SwitchTypeMatcher>(N)->getCaseType(i));
- OS << ',';
+ if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N)) {
+ OS << "TARGET_OPCODE(" << SOM->getCaseOpcode(i).getEnumName() << "),";
+ CurrentIdx += 2;
+ } else {
+ OS << getEnumName(cast<SwitchTypeMatcher>(N)->getCaseType(i)) << ',';
+ ++CurrentIdx;
+ }
if (!OmitComments)
- OS << "// ->" << CurrentIdx+ChildSize+1;
+ OS << "// ->" << CurrentIdx+ChildSize;
OS << '\n';
- ++CurrentIdx;
OS << TmpBuf.str();
CurrentIdx += ChildSize;
}
More information about the llvm-commits
mailing list