[LLVMbugs] [Bug 11954] New: MC instruction info tables are hugely bloated

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 8 17:11:30 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11954

             Bug #: 11954
           Summary: MC instruction info tables are hugely bloated
           Product: libraries
           Version: 1.0
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Some of the largest .o files in LLVM are the
<target>/MCTargetDesc/Release/<target>MCTargetDesc.o files.  For example, X86's
is 680K and ARM's is 580K.  By far the biggest contributor to this bloat comes
from the "GET_INSTRINFO_MC_DESC" part of "X86GenInstrInfo.inc" (it is 570K of
X86's 680K), and almost all of the bloat is in the __DATA,__const section
because it has relocations in it (affecting startup time) for PIC builds.

The easiest improvement is because MCInstrDesc is also just poorly packed: it
has dead struct padding in it on 64-bit hosts.  Reordering the fields would
same quite a bit.


The relocations come from the references to other arrays (i.e. ImplicitList and
OperandInfo).  Instead of pointers to these arrays, it would be better to
flatten all the arrays into a single ImplicitList and then use indexes into it.
 In pseudo code, instead of:

static const unsigned ImplicitList1[] = { X86::EFLAGS, 0 };
static const unsigned ImplicitList2[] = { X86::AX, 0 };
...
static const unsigned ImplicitList7[] = { X86::ESP, X86::EFLAGS, 0 };

...
  { .... ImplicitList1 ... },
  { .... ImplicitList2 ... },

it would be better to emit these as:

static const unsigned ImplicitList[] = { X86::EFLAGS, 0, X86::AX, 0, X86::AX, 0
};
...
  { .... 0 /*offset of "ImplicitList0" in ImplicitList*/ ... },
  { .... 2 ... },

This would eliminate the relocations and shrink the entry from 8 bytes to
something more reasonable (4 or even 2).  Further, this would allow us to go
crazy and unique together the tails of these lists.  For example, ImplicitList1
is the the same as "ImplicitList7+1" in the example above.

The "Name" field should be merged into a big string and use indexes into the
string, the same way we handle the instruction names in the generated
printInstruction() method of the target asmprinters.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list