mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-19 09:36:44 +00:00
Use variable type for index into mnemonic table. Shrinks size of index field on in tree targets. Saving static data space.
llvm-svn: 164108
This commit is contained in:
parent
6cba50cbb4
commit
c4107aa8c2
@ -2681,11 +2681,21 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
emitComputeAvailableFeatures(Info, OS);
|
emitComputeAvailableFeatures(Info, OS);
|
||||||
|
|
||||||
|
|
||||||
|
StringToOffsetTable StringTable;
|
||||||
|
|
||||||
size_t MaxNumOperands = 0;
|
size_t MaxNumOperands = 0;
|
||||||
|
unsigned MaxMnemonicIndex = 0;
|
||||||
for (std::vector<MatchableInfo*>::const_iterator it =
|
for (std::vector<MatchableInfo*>::const_iterator it =
|
||||||
Info.Matchables.begin(), ie = Info.Matchables.end();
|
Info.Matchables.begin(), ie = Info.Matchables.end();
|
||||||
it != ie; ++it)
|
it != ie; ++it) {
|
||||||
MaxNumOperands = std::max(MaxNumOperands, (*it)->AsmOperands.size());
|
MatchableInfo &II = **it;
|
||||||
|
MaxNumOperands = std::max(MaxNumOperands, II.AsmOperands.size());
|
||||||
|
|
||||||
|
// Store a pascal-style length byte in the mnemonic.
|
||||||
|
std::string LenMnemonic = char(II.Mnemonic.size()) + II.Mnemonic.str();
|
||||||
|
MaxMnemonicIndex = std::max(MaxMnemonicIndex,
|
||||||
|
StringTable.GetOrAddStringOffset(LenMnemonic, false));
|
||||||
|
}
|
||||||
|
|
||||||
// Emit the static match table; unused classes get initalized to 0 which is
|
// Emit the static match table; unused classes get initalized to 0 which is
|
||||||
// guaranteed to be InvalidMatchClass.
|
// guaranteed to be InvalidMatchClass.
|
||||||
@ -2700,7 +2710,8 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
OS << "namespace {\n";
|
OS << "namespace {\n";
|
||||||
OS << " struct MatchEntry {\n";
|
OS << " struct MatchEntry {\n";
|
||||||
OS << " static const char *const MnemonicTable;\n";
|
OS << " static const char *const MnemonicTable;\n";
|
||||||
OS << " uint32_t Mnemonic;\n";
|
OS << " " << getMinimalTypeForRange(MaxMnemonicIndex)
|
||||||
|
<< " Mnemonic;\n";
|
||||||
OS << " uint16_t Opcode;\n";
|
OS << " uint16_t Opcode;\n";
|
||||||
OS << " " << getMinimalTypeForRange(Info.Matchables.size())
|
OS << " " << getMinimalTypeForRange(Info.Matchables.size())
|
||||||
<< " ConvertFn;\n";
|
<< " ConvertFn;\n";
|
||||||
@ -2730,8 +2741,6 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
|
|
||||||
OS << "} // end anonymous namespace.\n\n";
|
OS << "} // end anonymous namespace.\n\n";
|
||||||
|
|
||||||
StringToOffsetTable StringTable;
|
|
||||||
|
|
||||||
OS << "static const MatchEntry MatchTable["
|
OS << "static const MatchEntry MatchTable["
|
||||||
<< Info.Matchables.size() << "] = {\n";
|
<< Info.Matchables.size() << "] = {\n";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user