[llvm-commits] [llvm] r152817 - in /llvm/trunk: include/llvm/MC/MCInstrInfo.h utils/TableGen/AsmMatcherEmitter.cpp utils/TableGen/AsmWriterEmitter.cpp utils/TableGen/InstrInfoEmitter.cpp utils/TableGen/StringToOffsetTable.h
Craig Topper
craig.topper at gmail.com
Thu Mar 15 14:19:28 PDT 2012
Yeah I noticed that and was planning to put it back. Making it const was
done as part of my original change cause I happened to notice it wasn't,
but failed to put it in the commit comments.
On Thu, Mar 15, 2012 at 2:08 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Mar 15, 2012, at 11:05 AM, Jakob Stoklund Olesen wrote:
>
> > Author: stoklund
> > Date: Thu Mar 15 13:05:57 2012
> > New Revision: 152817
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=152817&view=rev
> > Log:
> > Revert r152202: "Use uint16_t to store InstrNameIndices in MCInstrInfo."
> >
> > We cannot limit the concatenated instruction names to 64K. ARM is
> > already at 32K, and it is easy to imagine a target with more
> > instructions.
>
> Ok, but this also deconstifies OperandMatchEntry::MnemonicTable. That
> shouldn't depend on how many names there are.
>
> -Chris
>
> >
> > Modified:
> > llvm/trunk/include/llvm/MC/MCInstrInfo.h
> > llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
> > llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
> > llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp
> > llvm/trunk/utils/TableGen/StringToOffsetTable.h
> >
> > Modified: llvm/trunk/include/llvm/MC/MCInstrInfo.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCInstrInfo.h?rev=152817&r1=152816&r2=152817&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/MC/MCInstrInfo.h (original)
> > +++ llvm/trunk/include/llvm/MC/MCInstrInfo.h Thu Mar 15 13:05:57 2012
> > @@ -25,14 +25,14 @@
> > ///
> > 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;
> >
> > Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=152817&r1=152816&r2=152817&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
> > +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Thu Mar 15 13:05:57
> 2012
> > @@ -2023,7 +2023,7 @@
> > // 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())
> > @@ -2079,9 +2079,8 @@
> >
> > // 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
> > << ", ";
> > @@ -2098,7 +2097,7 @@
> > }
> > OS << "};\n\n";
> >
> > - OS << "const char *const OperandMatchEntry::MnemonicTable =\n";
> > + OS << "const char *OperandMatchEntry::MnemonicTable =\n";
> > StringTable.EmitString(OS);
> > OS << ";\n\n";
> >
> > @@ -2321,7 +2320,7 @@
> > // 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())
> > @@ -2364,11 +2363,10 @@
> >
> > // 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];
> > @@ -2392,7 +2390,7 @@
> >
> > OS << "};\n\n";
> >
> > - OS << "const char *const MatchEntry::MnemonicTable =\n";
> > + OS << "const char *MatchEntry::MnemonicTable =\n";
> > StringTable.EmitString(OS);
> > OS << ";\n\n";
> >
> >
> > Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=152817&r1=152816&r2=152817&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
> > +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Thu Mar 15 13:05:57
> 2012
> > @@ -306,7 +306,6 @@
> > }
> >
> > // 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);
> > }
> >
> > @@ -374,7 +373,7 @@
> > O << " };\n\n";
> >
> > // Emit the string itself.
> > - O << " const char *const AsmStrs = \n";
> > + O << " const char *AsmStrs = \n";
> > StringTable.EmitString(O);
> > O << ";\n\n";
> >
> > @@ -497,9 +496,7 @@
> > }
> > }
> >
> > - 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
> > @@ -594,9 +591,7 @@
> > 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"
> >
> > Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=152817&r1=152816&r2=152817&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original)
> > +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Thu Mar 15 13:05:57
> 2012
> > @@ -213,20 +213,18 @@
> > 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";
> >
> > @@ -259,8 +257,8 @@
> >
> > 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, "
> >
> > Modified: llvm/trunk/utils/TableGen/StringToOffsetTable.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/StringToOffsetTable.h?rev=152817&r1=152816&r2=152817&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/utils/TableGen/StringToOffsetTable.h (original)
> > +++ llvm/trunk/utils/TableGen/StringToOffsetTable.h Thu Mar 15 13:05:57
> 2012
> > @@ -40,9 +40,6 @@
> > }
> >
> > 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);
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
~Craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120315/01ca9b1b/attachment.html>
More information about the llvm-commits
mailing list