mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-21 08:17:40 +00:00
Re-commit r152202 hopefully fixing the MSVC linker error.
Original commit message: Use uint16_t to store InstrNameIndices in MCInstrInfo. Add asserts to protect all 16-bit string table offsets. Also make sure the string to offset table string is not larger than 65536 characters since larger string literals aren't portable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152296 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -213,18 +213,20 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
|
||||
OperandInfoIDs, OS);
|
||||
OS << "};\n\n";
|
||||
|
||||
OS << "extern const unsigned " << TargetName <<"InstrNameIndices[] = {\n ";
|
||||
OS << "extern const uint16_t " << TargetName <<"InstrNameIndices[] = {\n ";
|
||||
StringToOffsetTable StringTable;
|
||||
for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) {
|
||||
const CodeGenInstruction *Instr = NumberedInstructions[i];
|
||||
OS << StringTable.GetOrAddStringOffset(Instr->TheDef->getName()) << "U, ";
|
||||
unsigned Idx = StringTable.GetOrAddStringOffset(Instr->TheDef->getName());
|
||||
assert(Idx <= 0xffff && "String offset too large to fit in table");
|
||||
OS << Idx << "U, ";
|
||||
if (i % 8 == 0)
|
||||
OS << "\n ";
|
||||
}
|
||||
|
||||
OS << "\n};\n\n";
|
||||
|
||||
OS << "const char *" << TargetName << "InstrNameData =\n";
|
||||
OS << "extern const char *const " << TargetName << "InstrNameData =\n";
|
||||
StringTable.EmitString(OS);
|
||||
OS << ";\n\n";
|
||||
|
||||
@@ -257,8 +259,8 @@ void InstrInfoEmitter::run(raw_ostream &OS) {
|
||||
|
||||
OS << "namespace llvm {\n";
|
||||
OS << "extern const MCInstrDesc " << TargetName << "Insts[];\n";
|
||||
OS << "extern const unsigned " << TargetName << "InstrNameIndices[];\n";
|
||||
OS << "extern const char *" << TargetName << "InstrNameData;\n";
|
||||
OS << "extern const uint16_t " << TargetName << "InstrNameIndices[];\n";
|
||||
OS << "extern const char *const " << TargetName << "InstrNameData;\n";
|
||||
OS << ClassName << "::" << ClassName << "(int SO, int DO)\n"
|
||||
<< " : TargetInstrInfoImpl(SO, DO) {\n"
|
||||
<< " InitMCInstrInfo(" << TargetName << "Insts, "
|
||||
|
||||
Reference in New Issue
Block a user