Merge some tables in generated RegisterInfo file. Store indices into larger table instead of pointers to reduce relocations and shrink table size on 64-bit builds. Shaves ~24K off X86MCTargetDesc.o

llvm-svn: 151038
This commit is contained in:
Craig Topper 2012-02-21 06:22:36 +00:00
parent 90c2e86b63
commit b5d89e2475
1 changed files with 21 additions and 9 deletions

View File

@ -105,10 +105,10 @@ public:
/// of AX. /// of AX.
/// ///
struct MCRegisterDesc { struct MCRegisterDesc {
const char *Name; // Printable name for the reg (for debugging) const char *Name; // Printable name for the reg (for debugging)
const unsigned *Overlaps; // Overlapping registers, described above int Overlaps; // Overlapping registers, described above
const unsigned *SubRegs; // Sub-register set, described above int SubRegs; // Sub-register set, described above
const unsigned *SuperRegs; // Super-register set, described above int SuperRegs; // Super-register set, described above
}; };
/// MCRegisterInfo base class - We assume that the target defines a static /// MCRegisterInfo base class - We assume that the target defines a static
@ -132,6 +132,9 @@ private:
unsigned RAReg; // Return address register unsigned RAReg; // Return address register
const MCRegisterClass *Classes; // Pointer to the regclass array const MCRegisterClass *Classes; // Pointer to the regclass array
unsigned NumClasses; // Number of entries in the array unsigned NumClasses; // Number of entries in the array
const unsigned *Overlaps; // Pointer to the overlaps array
const unsigned *SubRegs; // Pointer to the subregs array
const unsigned *SuperRegs; // Pointer to the superregs array
DenseMap<unsigned, int> L2DwarfRegs; // LLVM to Dwarf regs mapping DenseMap<unsigned, int> L2DwarfRegs; // LLVM to Dwarf regs mapping
DenseMap<unsigned, int> EHL2DwarfRegs; // LLVM to Dwarf regs mapping EH DenseMap<unsigned, int> EHL2DwarfRegs; // LLVM to Dwarf regs mapping EH
DenseMap<unsigned, unsigned> Dwarf2LRegs; // Dwarf to LLVM regs mapping DenseMap<unsigned, unsigned> Dwarf2LRegs; // Dwarf to LLVM regs mapping
@ -142,11 +145,16 @@ public:
/// InitMCRegisterInfo - Initialize MCRegisterInfo, called by TableGen /// InitMCRegisterInfo - Initialize MCRegisterInfo, called by TableGen
/// auto-generated routines. *DO NOT USE*. /// auto-generated routines. *DO NOT USE*.
void InitMCRegisterInfo(const MCRegisterDesc *D, unsigned NR, unsigned RA, void InitMCRegisterInfo(const MCRegisterDesc *D, unsigned NR, unsigned RA,
const MCRegisterClass *C, unsigned NC) { const MCRegisterClass *C, unsigned NC,
const unsigned *O, const unsigned *Sub,
const unsigned *Super) {
Desc = D; Desc = D;
NumRegs = NR; NumRegs = NR;
RAReg = RA; RAReg = RA;
Classes = C; Classes = C;
Overlaps = O;
SubRegs = Sub;
SuperRegs = Super;
NumClasses = NC; NumClasses = NC;
} }
@ -204,7 +212,8 @@ public:
/// ///
const unsigned *getAliasSet(unsigned RegNo) const { const unsigned *getAliasSet(unsigned RegNo) const {
// The Overlaps set always begins with Reg itself. // The Overlaps set always begins with Reg itself.
return get(RegNo).Overlaps + 1; if (get(RegNo).Overlaps < 0) return 0;
return Overlaps + get(RegNo).Overlaps + 1;
} }
/// getOverlaps - Return a list of registers that overlap Reg, including /// getOverlaps - Return a list of registers that overlap Reg, including
@ -213,7 +222,8 @@ public:
/// These are exactly the registers in { x | regsOverlap(x, Reg) }. /// These are exactly the registers in { x | regsOverlap(x, Reg) }.
/// ///
const unsigned *getOverlaps(unsigned RegNo) const { const unsigned *getOverlaps(unsigned RegNo) const {
return get(RegNo).Overlaps; if (get(RegNo).Overlaps < 0) return 0;
return Overlaps + get(RegNo).Overlaps;
} }
/// getSubRegisters - Return the list of registers that are sub-registers of /// getSubRegisters - Return the list of registers that are sub-registers of
@ -222,7 +232,8 @@ public:
/// relations. e.g. X86::RAX's sub-register list is EAX, AX, AL, AH. /// relations. e.g. X86::RAX's sub-register list is EAX, AX, AL, AH.
/// ///
const unsigned *getSubRegisters(unsigned RegNo) const { const unsigned *getSubRegisters(unsigned RegNo) const {
return get(RegNo).SubRegs; if (get(RegNo).SubRegs < 0) return 0;
return SubRegs + get(RegNo).SubRegs;
} }
/// getSuperRegisters - Return the list of registers that are super-registers /// getSuperRegisters - Return the list of registers that are super-registers
@ -231,7 +242,8 @@ public:
/// relations. e.g. X86::AL's super-register list is AX, EAX, RAX. /// relations. e.g. X86::AL's super-register list is AX, EAX, RAX.
/// ///
const unsigned *getSuperRegisters(unsigned RegNo) const { const unsigned *getSuperRegisters(unsigned RegNo) const {
return get(RegNo).SuperRegs; if (get(RegNo).SuperRegs < 0) return 0;
return SuperRegs + get(RegNo).SuperRegs;
} }
/// getName - Return the human-readable symbolic target-specific name for the /// getName - Return the human-readable symbolic target-specific name for the