[llvm-commits] [llvm] r163878 - in /llvm/trunk/utils/TableGen: AsmWriterEmitter.cpp SequenceToOffsetTable.h

Craig Topper craig.topper at gmail.com
Fri Sep 14 18:06:02 PDT 2012


Thanks for pointing that out. I'll revert while I look into a better fix.
Thinking I may just use one SequenceToOffsetTable for all possible
alternate sets and layout after its all processed. Then the switch can just
cover the index the table and the all the strings will be in one table.
What do you think?

~Craig

On Fri, Sep 14, 2012 at 4:26 PM, Jim Grosbach <grosbach at apple.com> wrote:

> Hi Craig,
>
> This patch doesn't handle the case where alternate register names are in
> use. See EmitGetRegisterName() immediately below in AsmWriterEmitter.cpp
> where hasAltNames==true. As a result, any target using that facility won't
> build. I'd thought MIPS was using it, but apparently not (or that bit isn't
> in the main tree yet?). Can you have a look?
>
> Thanks!
>   Jim
>
>
> On Sep 13, 2012, at 11:37 PM, Craig Topper <craig.topper at gmail.com> wrote:
>
> > Author: ctopper
> > Date: Fri Sep 14 01:37:49 2012
> > New Revision: 163878
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=163878&view=rev
> > Log:
> > Reduce size of register name index tables by using uint16_t for all in
> tree targets. If more than 16-bits are needed for any out of tree targets,
> code will detect and use uint32_t instead.
> >
> > Modified:
> >    llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
> >    llvm/trunk/utils/TableGen/SequenceToOffsetTable.h
> >
> > Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=163878&r1=163877&r2=163878&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
> > +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Fri Sep 14 01:37:49
> 2012
> > @@ -581,12 +581,13 @@
> >     StringTable.add(AsmName);
> >   }
> >
> > -  StringTable.layout();
> > +  unsigned Entries = StringTable.layout();
> >   O << "  static const char AsmStrs" << AltName << "[] = {\n";
> >   StringTable.emit(O, printChar);
> >   O << "  };\n\n";
> >
> > -  O << "  static const unsigned RegAsmOffset" << AltName << "[] = {";
> > +  O << "  static const uint" << ((Entries > 0xffff) ? "32" : "16")
> > +    << "_t RegAsmOffset" << AltName << "[] = {";
> >   for (unsigned i = 0, e = Registers.size(); i != e; ++i) {
> >     if ((i % 14) == 0)
> >       O << "\n    ";
> >
> > Modified: llvm/trunk/utils/TableGen/SequenceToOffsetTable.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SequenceToOffsetTable.h?rev=163878&r1=163877&r2=163878&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/utils/TableGen/SequenceToOffsetTable.h (original)
> > +++ llvm/trunk/utils/TableGen/SequenceToOffsetTable.h Fri Sep 14
> 01:37:49 2012
> > @@ -82,9 +82,9 @@
> >   }
> >
> >   bool empty() const { return Seqs.empty(); }
> > -
> > +
> >   /// layout - Computes the final table layout.
> > -  void layout() {
> > +  unsigned layout() {
> >     assert(Entries == 0 && "Can only call layout() once");
> >     // Lay out the table in Seqs iteration order.
> >     for (typename SeqMap::iterator I = Seqs.begin(), E = Seqs.end(); I
> != E;
> > @@ -93,6 +93,7 @@
> >       // Include space for a terminator.
> >       Entries += I->first.size() + 1;
> >     }
> > +    return Entries;
> >   }
> >
> >   /// get - Returns the offset of Seq in the final table.
> >
> >
> > _______________________________________________
> > 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/20120914/60c617e7/attachment.html>


More information about the llvm-commits mailing list