///
class MCInstrInfo {
const MCInstrDesc *Desc; // Raw array to allow static init'n
- const uint16_t *InstrNameIndices; // Array for name indices in InstrNameData
+ const unsigned *InstrNameIndices; // Array for name indices in InstrNameData
const char *InstrNameData; // Instruction name string pool
unsigned NumOpcodes; // Number of entries in the desc array
public:
/// InitMCInstrInfo - Initialize MCInstrInfo, called by TableGen
/// auto-generated routines. *DO NOT USE*.
- void InitMCInstrInfo(const MCInstrDesc *D, const uint16_t *NI, const char *ND,
+ void InitMCInstrInfo(const MCInstrDesc *D, const unsigned *NI, const char *ND,
unsigned NO) {
Desc = D;
InstrNameIndices = NI;
// Emit the static custom operand parsing table;
OS << "namespace {\n";
OS << " struct OperandMatchEntry {\n";
- OS << " static const char *const MnemonicTable;\n";
+ OS << " static const char *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();
- unsigned Idx = StringTable.GetOrAddStringOffset(LenMnemonic, false);
- assert(Idx <= 0xffff && "String offset too large to fit in table");
- OS << ", " << Idx << " /* " << II.Mnemonic << " */";
+ OS << ", " << StringTable.GetOrAddStringOffset(LenMnemonic, false)
+ << " /* " << II.Mnemonic << " */";
OS << ", " << OMI.CI->Name
<< ", ";
}
OS << "};\n\n";
- OS << "const char *const OperandMatchEntry::MnemonicTable =\n";
+ OS << "const char *OperandMatchEntry::MnemonicTable =\n";
StringTable.EmitString(OS);
OS << ";\n\n";
// following the mnemonic.
OS << "namespace {\n";
OS << " struct MatchEntry {\n";
- OS << " static const char *const MnemonicTable;\n";
+ OS << " static const char *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() << ", "
- << Idx << " /* " << II.Mnemonic << " */"
+ << StringTable.GetOrAddStringOffset(LenMnemonic, false)
+ << " /* " << 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 *const MatchEntry::MnemonicTable =\n";
+ OS << "const char *MatchEntry::MnemonicTable =\n";
StringTable.EmitString(OS);
OS << ";\n\n";
}
// Bias offset by one since we want 0 as a sentinel.
- assert((Idx+1) <= 0xffff && "String offset too large to fit in table");
OpcodeInfo.push_back(Idx+1);
}
O << " };\n\n";
// Emit the string itself.
- O << " const char *const AsmStrs = \n";
+ O << " const char *AsmStrs = \n";
StringTable.EmitString(O);
O << ";\n\n";
}
}
- unsigned Idx = StringTable.GetOrAddStringOffset(AsmName);
- assert(Idx <= 0xffff && "String offset too large to fit in table");
- O << Idx;
+ O << StringTable.GetOrAddStringOffset(AsmName);
if (((i + 1) % 14) == 0)
O << ",\n ";
else
if ((i % 14) == 0)
O << "\n ";
- unsigned Idx = StringTable.GetOrAddStringOffset(AsmName);
- assert(Idx <= 0xffff && "String offset too large to fit in table");
- O << Idx << ", ";
+ O << StringTable.GetOrAddStringOffset(AsmName) << ", ";
}
O << "0\n"
<< " };\n"
OperandInfoIDs, OS);
OS << "};\n\n";
- OS << "extern const uint16_t " << TargetName <<"InstrNameIndices[] = {\n ";
+ OS << "extern const unsigned " << TargetName <<"InstrNameIndices[] = {\n ";
StringToOffsetTable StringTable;
for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
const CodeGenInstruction *Instr = NumberedInstructions[i];
- unsigned Idx = StringTable.GetOrAddStringOffset(Instr->TheDef->getName());
- assert(Idx <= 0xffff && "String offset too large to fit in table");
- OS << Idx << "U, ";
+ OS << StringTable.GetOrAddStringOffset(Instr->TheDef->getName()) << "U, ";
if (i % 8 == 0)
OS << "\n ";
}
OS << "\n};\n\n";
- OS << "extern const char *const " << TargetName << "InstrNameData =\n";
+ OS << "const char *" << TargetName << "InstrNameData =\n";
StringTable.EmitString(OS);
OS << ";\n\n";
OS << "namespace llvm {\n";
OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n";
- OS << "extern const uint16_t " << TargetName << "InstrNameIndices[];\n";
- OS << "extern const char *const " << TargetName << "InstrNameData;\n";
+ OS << "extern const unsigned " << TargetName << "InstrNameIndices[];\n";
+ OS << "extern const char *" << TargetName << "InstrNameData;\n";
OS << ClassName << "::" << ClassName << "(int SO, int DO)\n"
<< " : TargetInstrInfoImpl(SO, DO) {\n"
<< " InitMCInstrInfo(" << TargetName << "Insts, "
}
void EmitString(raw_ostream &O) {
- assert(AggregateString.size() <= 65536 &&
- "Aggregate string too large to be portable");
-
// Escape the string.
SmallString<256> Str;
raw_svector_ostream(Str).write_escaped(AggregateString);