mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99494 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1888,7 +1888,9 @@ CheckNodePredicate(const unsigned char *MatcherTable, unsigned &MatcherIndex,
|
|||||||
ALWAYS_INLINE static bool
|
ALWAYS_INLINE static bool
|
||||||
CheckOpcode(const unsigned char *MatcherTable, unsigned &MatcherIndex,
|
CheckOpcode(const unsigned char *MatcherTable, unsigned &MatcherIndex,
|
||||||
SDNode *N) {
|
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
|
ALWAYS_INLINE static bool
|
||||||
@ -2142,7 +2144,8 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
if (CaseSize == 0) break;
|
if (CaseSize == 0) break;
|
||||||
|
|
||||||
// Get the opcode, add the index to the table.
|
// 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())
|
if (Opc >= OpcodeOffset.size())
|
||||||
OpcodeOffset.resize((Opc+1)*2);
|
OpcodeOffset.resize((Opc+1)*2);
|
||||||
OpcodeOffset[Opc] = Idx;
|
OpcodeOffset[Opc] = Idx;
|
||||||
@ -2298,8 +2301,11 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
CaseSize = GetVBR(CaseSize, MatcherTable, MatcherIndex);
|
CaseSize = GetVBR(CaseSize, MatcherTable, MatcherIndex);
|
||||||
if (CaseSize == 0) break;
|
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 the opcode matches, then we will execute this case.
|
||||||
if (CurNodeOpcode == MatcherTable[MatcherIndex++])
|
if (CurNodeOpcode == Opc)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Otherwise, skip over this case.
|
// Otherwise, skip over this case.
|
||||||
|
@ -255,9 +255,9 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case Matcher::CheckOpcode:
|
case Matcher::CheckOpcode:
|
||||||
OS << "OPC_CheckOpcode, "
|
OS << "OPC_CheckOpcode, TARGET_OPCODE("
|
||||||
<< cast<CheckOpcodeMatcher>(N)->getOpcode().getEnumName() << ",\n";
|
<< cast<CheckOpcodeMatcher>(N)->getOpcode().getEnumName() << "),\n";
|
||||||
return 2;
|
return 3;
|
||||||
|
|
||||||
case Matcher::SwitchOpcode:
|
case Matcher::SwitchOpcode:
|
||||||
case Matcher::SwitchType: {
|
case Matcher::SwitchType: {
|
||||||
@ -315,16 +315,17 @@ EmitMatcher(const Matcher *N, unsigned Indent, unsigned CurrentIdx,
|
|||||||
CurrentIdx += EmitVBRValue(ChildSize, OS);
|
CurrentIdx += EmitVBRValue(ChildSize, OS);
|
||||||
|
|
||||||
OS << ' ';
|
OS << ' ';
|
||||||
if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N))
|
if (const SwitchOpcodeMatcher *SOM = dyn_cast<SwitchOpcodeMatcher>(N)) {
|
||||||
OS << SOM->getCaseOpcode(i).getEnumName();
|
OS << "TARGET_OPCODE(" << SOM->getCaseOpcode(i).getEnumName() << "),";
|
||||||
else
|
CurrentIdx += 2;
|
||||||
OS << getEnumName(cast<SwitchTypeMatcher>(N)->getCaseType(i));
|
} else {
|
||||||
OS << ',';
|
OS << getEnumName(cast<SwitchTypeMatcher>(N)->getCaseType(i)) << ',';
|
||||||
|
++CurrentIdx;
|
||||||
|
}
|
||||||
|
|
||||||
if (!OmitComments)
|
if (!OmitComments)
|
||||||
OS << "// ->" << CurrentIdx+ChildSize+1;
|
OS << "// ->" << CurrentIdx+ChildSize;
|
||||||
OS << '\n';
|
OS << '\n';
|
||||||
++CurrentIdx;
|
|
||||||
OS << TmpBuf.str();
|
OS << TmpBuf.str();
|
||||||
CurrentIdx += ChildSize;
|
CurrentIdx += ChildSize;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user