// Emit the static custom operand parsing table;
OS << "namespace {\n";
OS << " struct OperandMatchEntry {\n";
- OS << " static const char *MnemonicTable;\n";
+ OS << " static const char *const MnemonicTable;\n";
OS << " unsigned OperandMask;\n";
OS << " uint16_t Mnemonic;\n";
OS << " " << getMinimalTypeForRange(Info.Classes.size())
// Store a pascal-style length byte in the mnemonic.
std::string LenMnemonic = char(II.Mnemonic.size()) + II.Mnemonic.str();
- OS << ", " << StringTable.GetOrAddStringOffset(LenMnemonic, false)
- << " /* " << II.Mnemonic << " */";
+ unsigned Idx = StringTable.GetOrAddStringOffset(LenMnemonic, false);
+ assert(Idx <= 0xffff && "String offset too large to fit in table");
+ OS << ", " << Idx << " /* " << II.Mnemonic << " */";
OS << ", " << OMI.CI->Name
<< ", ";
}
OS << "};\n\n";
- OS << "const char *OperandMatchEntry::MnemonicTable =\n";
+ OS << "const char *const OperandMatchEntry::MnemonicTable =\n";
StringTable.EmitString(OS);
OS << ";\n\n";
// following the mnemonic.
OS << "namespace {\n";
OS << " struct MatchEntry {\n";
- OS << " static const char *MnemonicTable;\n";
+ OS << " static const char *const MnemonicTable;\n";
OS << " uint16_t Opcode;\n";
OS << " uint16_t Mnemonic;\n";
OS << " " << getMinimalTypeForRange(Info.Matchables.size())
// Store a pascal-style length byte in the mnemonic.
std::string LenMnemonic = char(II.Mnemonic.size()) + II.Mnemonic.str();
+ unsigned Idx = StringTable.GetOrAddStringOffset(LenMnemonic, false);
+ assert(Idx <= 0xffff && "String offset too large to fit in table");
OS << " { " << Target.getName() << "::"
<< II.getResultInst()->TheDef->getName() << ", "
- << StringTable.GetOrAddStringOffset(LenMnemonic, false)
- << " /* " << II.Mnemonic << " */"
+ << Idx << " /* " << II.Mnemonic << " */"
<< ", " << II.ConversionFnKind << ", { ";
for (unsigned i = 0, e = II.AsmOperands.size(); i != e; ++i) {
MatchableInfo::AsmOperand &Op = II.AsmOperands[i];
OS << "};\n\n";
- OS << "const char *MatchEntry::MnemonicTable =\n";
+ OS << "const char *const MatchEntry::MnemonicTable =\n";
StringTable.EmitString(OS);
OS << ";\n\n";