mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-09-14 04:57:33 +00:00
emit the match table at global scope instead of within the
MatchInstructionImpl. This makes it easier to read/understand MatchInstructionImpl. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113170 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e206fcf0e9
commit
96352e5ceb
@ -1604,7 +1604,6 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
// Emit the available features compute function.
|
// Emit the available features compute function.
|
||||||
EmitComputeAvailableFeatures(Target, Info, OS);
|
EmitComputeAvailableFeatures(Target, Info, OS);
|
||||||
|
|
||||||
// Finally, build the match function.
|
|
||||||
|
|
||||||
size_t MaxNumOperands = 0;
|
size_t MaxNumOperands = 0;
|
||||||
for (std::vector<InstructionInfo*>::const_iterator it =
|
for (std::vector<InstructionInfo*>::const_iterator it =
|
||||||
@ -1612,11 +1611,6 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
it != ie; ++it)
|
it != ie; ++it)
|
||||||
MaxNumOperands = std::max(MaxNumOperands, (*it)->Operands.size());
|
MaxNumOperands = std::max(MaxNumOperands, (*it)->Operands.size());
|
||||||
|
|
||||||
OS << Target.getName() << ClassName << "::MatchResultTy "
|
|
||||||
<< Target.getName() << ClassName << "::\n"
|
|
||||||
<< "MatchInstructionImpl(const SmallVectorImpl<MCParsedAsmOperand*>"
|
|
||||||
<< " &Operands,\n";
|
|
||||||
OS << " MCInst &Inst) {\n";
|
|
||||||
|
|
||||||
// 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.
|
||||||
@ -1628,13 +1622,18 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
// order the match kinds appropriately (putting mnemonics last), then we
|
// order the match kinds appropriately (putting mnemonics last), then we
|
||||||
// should only end up using a few bits for each class, especially the ones
|
// should only end up using a few bits for each class, especially the ones
|
||||||
// following the mnemonic.
|
// following the mnemonic.
|
||||||
OS << " static const struct MatchEntry {\n";
|
OS << "namespace {\n";
|
||||||
|
OS << " struct MatchEntry {\n";
|
||||||
OS << " unsigned Opcode;\n";
|
OS << " unsigned Opcode;\n";
|
||||||
OS << " const char *Mnemonic;\n";
|
OS << " const char *Mnemonic;\n";
|
||||||
OS << " ConversionKind ConvertFn;\n";
|
OS << " ConversionKind ConvertFn;\n";
|
||||||
OS << " MatchClassKind Classes[" << MaxNumOperands << "];\n";
|
OS << " MatchClassKind Classes[" << MaxNumOperands << "];\n";
|
||||||
OS << " unsigned RequiredFeatures;\n";
|
OS << " unsigned RequiredFeatures;\n";
|
||||||
OS << " } MatchTable[" << Info.Instructions.size() << "] = {\n";
|
OS << " };\n";
|
||||||
|
OS << "} // end anonymous namespace.\n\n";
|
||||||
|
|
||||||
|
OS << "static const MatchEntry MatchTable["
|
||||||
|
<< Info.Instructions.size() << "] = {\n";
|
||||||
|
|
||||||
for (std::vector<InstructionInfo*>::const_iterator it =
|
for (std::vector<InstructionInfo*>::const_iterator it =
|
||||||
Info.Instructions.begin(), ie = Info.Instructions.end();
|
Info.Instructions.begin(), ie = Info.Instructions.end();
|
||||||
@ -1664,8 +1663,14 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
|
|||||||
OS << "},\n";
|
OS << "},\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
OS << " };\n\n";
|
OS << "};\n\n";
|
||||||
|
|
||||||
|
// Finally, build the match function.
|
||||||
|
OS << Target.getName() << ClassName << "::MatchResultTy "
|
||||||
|
<< Target.getName() << ClassName << "::\n"
|
||||||
|
<< "MatchInstructionImpl(const SmallVectorImpl<MCParsedAsmOperand*>"
|
||||||
|
<< " &Operands,\n";
|
||||||
|
OS << " MCInst &Inst) {\n";
|
||||||
|
|
||||||
// Emit code to get the available features.
|
// Emit code to get the available features.
|
||||||
OS << " // Get the current feature set.\n";
|
OS << " // Get the current feature set.\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user