forked from OSchip/llvm-project
Move register class name strings to a single array in MCRegisterInfo to reduce static table size and number of relocation entries.
Indices into the table are stored in each MCRegisterClass instead of a pointer. A new method, getRegClassName, is added to MCRegisterInfo and TargetRegisterInfo to lookup the string in the table. llvm-svn: 222118
This commit is contained in:
parent
a3b5b60753
commit
cf0444ba2a
|
@ -32,9 +32,9 @@ public:
|
||||||
typedef const MCPhysReg* iterator;
|
typedef const MCPhysReg* iterator;
|
||||||
typedef const MCPhysReg* const_iterator;
|
typedef const MCPhysReg* const_iterator;
|
||||||
|
|
||||||
const char *Name;
|
|
||||||
const iterator RegsBegin;
|
const iterator RegsBegin;
|
||||||
const uint8_t *const RegSet;
|
const uint8_t *const RegSet;
|
||||||
|
const uint32_t NameIdx;
|
||||||
const uint16_t RegsSize;
|
const uint16_t RegsSize;
|
||||||
const uint16_t RegSetSize;
|
const uint16_t RegSetSize;
|
||||||
const uint16_t ID;
|
const uint16_t ID;
|
||||||
|
@ -46,10 +46,6 @@ public:
|
||||||
///
|
///
|
||||||
unsigned getID() const { return ID; }
|
unsigned getID() const { return ID; }
|
||||||
|
|
||||||
/// getName() - Return the register class name for debugging.
|
|
||||||
///
|
|
||||||
const char *getName() const { return Name; }
|
|
||||||
|
|
||||||
/// begin/end - Return all of the registers in this class.
|
/// begin/end - Return all of the registers in this class.
|
||||||
///
|
///
|
||||||
iterator begin() const { return RegsBegin; }
|
iterator begin() const { return RegsBegin; }
|
||||||
|
@ -162,6 +158,7 @@ private:
|
||||||
const MCPhysReg (*RegUnitRoots)[2]; // Pointer to regunit root table.
|
const MCPhysReg (*RegUnitRoots)[2]; // Pointer to regunit root table.
|
||||||
const MCPhysReg *DiffLists; // Pointer to the difflists array
|
const MCPhysReg *DiffLists; // Pointer to the difflists array
|
||||||
const char *RegStrings; // Pointer to the string table.
|
const char *RegStrings; // Pointer to the string table.
|
||||||
|
const char *RegClassStrings; // Pointer to the class strings.
|
||||||
const uint16_t *SubRegIndices; // Pointer to the subreg lookup
|
const uint16_t *SubRegIndices; // Pointer to the subreg lookup
|
||||||
// array.
|
// array.
|
||||||
const SubRegCoveredBits *SubRegIdxRanges; // Pointer to the subreg covered
|
const SubRegCoveredBits *SubRegIdxRanges; // Pointer to the subreg covered
|
||||||
|
@ -243,6 +240,7 @@ public:
|
||||||
unsigned NRU,
|
unsigned NRU,
|
||||||
const MCPhysReg *DL,
|
const MCPhysReg *DL,
|
||||||
const char *Strings,
|
const char *Strings,
|
||||||
|
const char *ClassStrings,
|
||||||
const uint16_t *SubIndices,
|
const uint16_t *SubIndices,
|
||||||
unsigned NumIndices,
|
unsigned NumIndices,
|
||||||
const SubRegCoveredBits *SubIdxRanges,
|
const SubRegCoveredBits *SubIdxRanges,
|
||||||
|
@ -254,6 +252,7 @@ public:
|
||||||
Classes = C;
|
Classes = C;
|
||||||
DiffLists = DL;
|
DiffLists = DL;
|
||||||
RegStrings = Strings;
|
RegStrings = Strings;
|
||||||
|
RegClassStrings = ClassStrings;
|
||||||
NumClasses = NC;
|
NumClasses = NC;
|
||||||
RegUnitRoots = RURoots;
|
RegUnitRoots = RURoots;
|
||||||
NumRegUnits = NRU;
|
NumRegUnits = NRU;
|
||||||
|
@ -401,6 +400,10 @@ public:
|
||||||
return Classes[i];
|
return Classes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *getRegClassName(const MCRegisterClass *Class) const {
|
||||||
|
return RegClassStrings + Class->NameIdx;
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Returns the encoding for RegNo
|
/// \brief Returns the encoding for RegNo
|
||||||
uint16_t getEncodingValue(unsigned RegNo) const {
|
uint16_t getEncodingValue(unsigned RegNo) const {
|
||||||
assert(RegNo < NumRegs &&
|
assert(RegNo < NumRegs &&
|
||||||
|
|
|
@ -52,10 +52,6 @@ public:
|
||||||
///
|
///
|
||||||
unsigned getID() const { return MC->getID(); }
|
unsigned getID() const { return MC->getID(); }
|
||||||
|
|
||||||
/// getName() - Return the register class name for debugging.
|
|
||||||
///
|
|
||||||
const char *getName() const { return MC->getName(); }
|
|
||||||
|
|
||||||
/// begin/end - Return all of the registers in this class.
|
/// begin/end - Return all of the registers in this class.
|
||||||
///
|
///
|
||||||
iterator begin() const { return MC->begin(); }
|
iterator begin() const { return MC->begin(); }
|
||||||
|
@ -561,6 +557,11 @@ public:
|
||||||
return RegClassBegin[i];
|
return RegClassBegin[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// getRegClassName - Returns the name of the register class.
|
||||||
|
const char *getRegClassName(const TargetRegisterClass *Class) const {
|
||||||
|
return MCRegisterInfo::getRegClassName(Class->MC);
|
||||||
|
}
|
||||||
|
|
||||||
/// getCommonSubClass - find the largest common subclass of A and B. Return
|
/// getCommonSubClass - find the largest common subclass of A and B. Return
|
||||||
/// NULL if there is no common subclass.
|
/// NULL if there is no common subclass.
|
||||||
const TargetRegisterClass *
|
const TargetRegisterClass *
|
||||||
|
|
|
@ -518,7 +518,7 @@ BitVector AggressiveAntiDepBreaker::GetRenameRegisters(unsigned Reg) {
|
||||||
BV &= RCBV;
|
BV &= RCBV;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(dbgs() << " " << RC->getName());
|
DEBUG(dbgs() << " " << TRI->getRegClassName(RC));
|
||||||
}
|
}
|
||||||
|
|
||||||
return BV;
|
return BV;
|
||||||
|
|
|
@ -720,7 +720,7 @@ bool ExeDepsFix::runOnMachineFunction(MachineFunction &mf) {
|
||||||
assert(NumRegs == RC->getNumRegs() && "Bad regclass");
|
assert(NumRegs == RC->getNumRegs() && "Bad regclass");
|
||||||
|
|
||||||
DEBUG(dbgs() << "********** FIX EXECUTION DEPENDENCIES: "
|
DEBUG(dbgs() << "********** FIX EXECUTION DEPENDENCIES: "
|
||||||
<< RC->getName() << " **********\n");
|
<< TRI->getRegClassName(RC) << " **********\n");
|
||||||
|
|
||||||
// If no relevant registers are used in the function, we can skip it
|
// If no relevant registers are used in the function, we can skip it
|
||||||
// completely.
|
// completely.
|
||||||
|
|
|
@ -1377,7 +1377,7 @@ void InlineSpiller::spill(LiveRangeEdit &edit) {
|
||||||
StackInt = nullptr;
|
StackInt = nullptr;
|
||||||
|
|
||||||
DEBUG(dbgs() << "Inline spilling "
|
DEBUG(dbgs() << "Inline spilling "
|
||||||
<< MRI.getRegClass(edit.getReg())->getName()
|
<< TRI.getRegClassName(MRI.getRegClass(edit.getReg()))
|
||||||
<< ':' << edit.getParent()
|
<< ':' << edit.getParent()
|
||||||
<< "\nFrom original " << PrintReg(Original) << '\n');
|
<< "\nFrom original " << PrintReg(Original) << '\n');
|
||||||
assert(edit.getParent().isSpillable() &&
|
assert(edit.getParent().isSpillable() &&
|
||||||
|
|
|
@ -411,8 +411,11 @@ LiveRangeEdit::calculateRegClassAndHint(MachineFunction &MF,
|
||||||
for (unsigned I = 0, Size = size(); I < Size; ++I) {
|
for (unsigned I = 0, Size = size(); I < Size; ++I) {
|
||||||
LiveInterval &LI = LIS.getInterval(get(I));
|
LiveInterval &LI = LIS.getInterval(get(I));
|
||||||
if (MRI.recomputeRegClass(LI.reg, MF.getTarget()))
|
if (MRI.recomputeRegClass(LI.reg, MF.getTarget()))
|
||||||
DEBUG(dbgs() << "Inflated " << PrintReg(LI.reg) << " to "
|
DEBUG({
|
||||||
<< MRI.getRegClass(LI.reg)->getName() << '\n');
|
const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
|
||||||
|
dbgs() << "Inflated " << PrintReg(LI.reg) << " to "
|
||||||
|
<< TRI->getRegClassName(MRI.getRegClass(LI.reg)) << '\n'
|
||||||
|
});
|
||||||
VRAI.calculateSpillWeightAndHint(LI);
|
VRAI.calculateSpillWeightAndHint(LI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ void LiveStacks::print(raw_ostream &OS, const Module*) const {
|
||||||
int Slot = I->first;
|
int Slot = I->first;
|
||||||
const TargetRegisterClass *RC = getIntervalRegClass(Slot);
|
const TargetRegisterClass *RC = getIntervalRegClass(Slot);
|
||||||
if (RC)
|
if (RC)
|
||||||
OS << " [" << RC->getName() << "]\n";
|
OS << " [" << TRI->getRegClassName(RC) << "]\n";
|
||||||
else
|
else
|
||||||
OS << " [Unknown]\n";
|
OS << " [Unknown]\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1607,18 +1607,17 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM,
|
||||||
// call instructions much less noisy on targets where calls clobber lots
|
// call instructions much less noisy on targets where calls clobber lots
|
||||||
// of registers. Don't rely on MO.isDead() because we may be called before
|
// of registers. Don't rely on MO.isDead() because we may be called before
|
||||||
// LiveVariables is run, or we may be looking at a non-allocatable reg.
|
// LiveVariables is run, or we may be looking at a non-allocatable reg.
|
||||||
if (MF && isCall() &&
|
if (MRI && isCall() &&
|
||||||
MO.isReg() && MO.isImplicit() && MO.isDef()) {
|
MO.isReg() && MO.isImplicit() && MO.isDef()) {
|
||||||
unsigned Reg = MO.getReg();
|
unsigned Reg = MO.getReg();
|
||||||
if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
|
if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
|
||||||
const MachineRegisterInfo &MRI = MF->getRegInfo();
|
if (MRI->use_empty(Reg)) {
|
||||||
if (MRI.use_empty(Reg)) {
|
|
||||||
bool HasAliasLive = false;
|
bool HasAliasLive = false;
|
||||||
for (MCRegAliasIterator AI(
|
for (MCRegAliasIterator AI(
|
||||||
Reg, TM->getSubtargetImpl()->getRegisterInfo(), true);
|
Reg, TM->getSubtargetImpl()->getRegisterInfo(), true);
|
||||||
AI.isValid(); ++AI) {
|
AI.isValid(); ++AI) {
|
||||||
unsigned AliasReg = *AI;
|
unsigned AliasReg = *AI;
|
||||||
if (!MRI.use_empty(AliasReg)) {
|
if (!MRI->use_empty(AliasReg)) {
|
||||||
HasAliasLive = true;
|
HasAliasLive = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1669,13 +1668,12 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM,
|
||||||
|
|
||||||
unsigned RCID = 0;
|
unsigned RCID = 0;
|
||||||
if (InlineAsm::hasRegClassConstraint(Flag, RCID)) {
|
if (InlineAsm::hasRegClassConstraint(Flag, RCID)) {
|
||||||
if (TM)
|
if (TM) {
|
||||||
|
const TargetRegisterInfo *TRI =
|
||||||
|
TM->getSubtargetImpl()->getRegisterInfo();
|
||||||
OS << ':'
|
OS << ':'
|
||||||
<< TM->getSubtargetImpl()
|
<< TRI->getRegClassName(TRI->getRegClass(RCID));
|
||||||
->getRegisterInfo()
|
} else
|
||||||
->getRegClass(RCID)
|
|
||||||
->getName();
|
|
||||||
else
|
|
||||||
OS << ":RC" << RCID;
|
OS << ":RC" << RCID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1724,7 +1722,8 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM,
|
||||||
if (!HaveSemi) OS << ";"; HaveSemi = true;
|
if (!HaveSemi) OS << ";"; HaveSemi = true;
|
||||||
for (unsigned i = 0; i != VirtRegs.size(); ++i) {
|
for (unsigned i = 0; i != VirtRegs.size(); ++i) {
|
||||||
const TargetRegisterClass *RC = MRI->getRegClass(VirtRegs[i]);
|
const TargetRegisterClass *RC = MRI->getRegClass(VirtRegs[i]);
|
||||||
OS << " " << RC->getName() << ':' << PrintReg(VirtRegs[i]);
|
OS << " " << MRI->getTargetRegisterInfo()->getRegClassName(RC)
|
||||||
|
<< ':' << PrintReg(VirtRegs[i]);
|
||||||
for (unsigned j = i+1; j != VirtRegs.size();) {
|
for (unsigned j = i+1; j != VirtRegs.size();) {
|
||||||
if (MRI->getRegClass(VirtRegs[j]) != RC) {
|
if (MRI->getRegClass(VirtRegs[j]) != RC) {
|
||||||
++j;
|
++j;
|
||||||
|
|
|
@ -907,7 +907,7 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
|
||||||
if (!DRC->contains(Reg)) {
|
if (!DRC->contains(Reg)) {
|
||||||
report("Illegal physical register for instruction", MO, MONum);
|
report("Illegal physical register for instruction", MO, MONum);
|
||||||
*OS << TRI->getName(Reg) << " is not a "
|
*OS << TRI->getName(Reg) << " is not a "
|
||||||
<< DRC->getName() << " register.\n";
|
<< TRI->getRegClassName(DRC) << " register.\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -918,13 +918,13 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
|
||||||
TRI->getSubClassWithSubReg(RC, SubIdx);
|
TRI->getSubClassWithSubReg(RC, SubIdx);
|
||||||
if (!SRC) {
|
if (!SRC) {
|
||||||
report("Invalid subregister index for virtual register", MO, MONum);
|
report("Invalid subregister index for virtual register", MO, MONum);
|
||||||
*OS << "Register class " << RC->getName()
|
*OS << "Register class " << TRI->getRegClassName(RC)
|
||||||
<< " does not support subreg index " << SubIdx << "\n";
|
<< " does not support subreg index " << SubIdx << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (RC != SRC) {
|
if (RC != SRC) {
|
||||||
report("Invalid register class for subregister index", MO, MONum);
|
report("Invalid register class for subregister index", MO, MONum);
|
||||||
*OS << "Register class " << RC->getName()
|
*OS << "Register class " << TRI->getRegClassName(RC)
|
||||||
<< " does not fully support subreg index " << SubIdx << "\n";
|
<< " does not fully support subreg index " << SubIdx << "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -946,8 +946,9 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
|
||||||
}
|
}
|
||||||
if (!RC->hasSuperClassEq(DRC)) {
|
if (!RC->hasSuperClassEq(DRC)) {
|
||||||
report("Illegal virtual register for instruction", MO, MONum);
|
report("Illegal virtual register for instruction", MO, MONum);
|
||||||
*OS << "Expected a " << DRC->getName() << " register, but got a "
|
*OS << "Expected a " << TRI->getRegClassName(DRC)
|
||||||
<< RC->getName() << " register\n";
|
<< " register, but got a " << TRI->getRegClassName(RC)
|
||||||
|
<< " register\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ void RegAllocBase::allocatePhysRegs() {
|
||||||
// register if possible and populate a list of new live intervals that
|
// register if possible and populate a list of new live intervals that
|
||||||
// result from splitting.
|
// result from splitting.
|
||||||
DEBUG(dbgs() << "\nselectOrSplit "
|
DEBUG(dbgs() << "\nselectOrSplit "
|
||||||
<< MRI->getRegClass(VirtReg->reg)->getName()
|
<< TRI->getRegClassName(MRI->getRegClass(VirtReg->reg))
|
||||||
<< ':' << *VirtReg << " w=" << VirtReg->weight << '\n');
|
<< ':' << *VirtReg << " w=" << VirtReg->weight << '\n');
|
||||||
typedef SmallVector<unsigned, 4> VirtRegVec;
|
typedef SmallVector<unsigned, 4> VirtRegVec;
|
||||||
VirtRegVec SplitVRegs;
|
VirtRegVec SplitVRegs;
|
||||||
|
|
|
@ -548,7 +548,7 @@ RAFast::LiveRegMap::iterator RAFast::allocVirtReg(MachineInstr *MI,
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(dbgs() << "Allocating " << PrintReg(VirtReg) << " from "
|
DEBUG(dbgs() << "Allocating " << PrintReg(VirtReg) << " from "
|
||||||
<< RC->getName() << "\n");
|
<< TRI->getRegClassName(RC) << "\n");
|
||||||
|
|
||||||
unsigned BestReg = 0, BestCost = spillImpossible;
|
unsigned BestReg = 0, BestCost = spillImpossible;
|
||||||
for (ArrayRef<MCPhysReg>::iterator I = AO.begin(), E = AO.end(); I != E; ++I){
|
for (ArrayRef<MCPhysReg>::iterator I = AO.begin(), E = AO.end(); I != E; ++I){
|
||||||
|
|
|
@ -817,7 +817,7 @@ unsigned RAGreedy::tryEvict(LiveInterval &VirtReg,
|
||||||
const TargetRegisterClass *RC = MRI->getRegClass(VirtReg.reg);
|
const TargetRegisterClass *RC = MRI->getRegClass(VirtReg.reg);
|
||||||
unsigned MinCost = RegClassInfo.getMinCost(RC);
|
unsigned MinCost = RegClassInfo.getMinCost(RC);
|
||||||
if (MinCost >= CostPerUseLimit) {
|
if (MinCost >= CostPerUseLimit) {
|
||||||
DEBUG(dbgs() << RC->getName() << " minimum cost = " << MinCost
|
DEBUG(dbgs() << TRI->getRegClassName(RC) << " minimum cost = " << MinCost
|
||||||
<< ", no cheaper registers to be found.\n");
|
<< ", no cheaper registers to be found.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ void RegisterClassInfo::compute(const TargetRegisterClass *RC) const {
|
||||||
RCI.LastCostChange = LastCostChange;
|
RCI.LastCostChange = LastCostChange;
|
||||||
|
|
||||||
DEBUG({
|
DEBUG({
|
||||||
dbgs() << "AllocationOrder(" << RC->getName() << ") = [";
|
dbgs() << "AllocationOrder(" << TRI->getRegClassName(RC) << ") = [";
|
||||||
for (unsigned I = 0; I != RCI.NumRegs; ++I)
|
for (unsigned I = 0; I != RCI.NumRegs; ++I)
|
||||||
dbgs() << ' ' << PrintReg(RCI.Order[I], TRI);
|
dbgs() << ' ' << PrintReg(RCI.Order[I], TRI);
|
||||||
dbgs() << (RCI.ProperSubClass ? " ] (sub-class)\n" : " ]\n");
|
dbgs() << (RCI.ProperSubClass ? " ] (sub-class)\n" : " ]\n");
|
||||||
|
|
|
@ -1106,8 +1106,8 @@ bool RegisterCoalescer::joinCopy(MachineInstr *CopyMI, bool &Again) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DEBUG({
|
DEBUG({
|
||||||
dbgs() << "\tConsidering merging to " << CP.getNewRC()->getName()
|
dbgs() << "\tConsidering merging to "
|
||||||
<< " with ";
|
<< TRI->getRegClassName(CP.getNewRC()) << " with ";
|
||||||
if (CP.getDstIdx() && CP.getSrcIdx())
|
if (CP.getDstIdx() && CP.getSrcIdx())
|
||||||
dbgs() << PrintReg(CP.getDstReg()) << " in "
|
dbgs() << PrintReg(CP.getDstReg()) << " in "
|
||||||
<< TRI->getSubRegIndexName(CP.getDstIdx()) << " and "
|
<< TRI->getSubRegIndexName(CP.getDstIdx()) << " and "
|
||||||
|
@ -2264,7 +2264,7 @@ bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) {
|
||||||
continue;
|
continue;
|
||||||
if (MRI->recomputeRegClass(Reg, *TM)) {
|
if (MRI->recomputeRegClass(Reg, *TM)) {
|
||||||
DEBUG(dbgs() << PrintReg(Reg) << " inflated to "
|
DEBUG(dbgs() << PrintReg(Reg) << " inflated to "
|
||||||
<< MRI->getRegClass(Reg)->getName() << '\n');
|
<< TRI->getRegClassName(MRI->getRegClass(Reg)) << '\n');
|
||||||
++NumInflated;
|
++NumInflated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1935,8 +1935,8 @@ void RegReductionPQBase::dumpRegPressure() const {
|
||||||
unsigned Id = RC->getID();
|
unsigned Id = RC->getID();
|
||||||
unsigned RP = RegPressure[Id];
|
unsigned RP = RegPressure[Id];
|
||||||
if (!RP) continue;
|
if (!RP) continue;
|
||||||
DEBUG(dbgs() << RC->getName() << ": " << RP << " / " << RegLimit[Id]
|
DEBUG(dbgs() << TRI->getRegClassName(RC) << ": " << RP << " / "
|
||||||
<< '\n');
|
<< RegLimit[Id] << '\n');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ void VirtRegMap::print(raw_ostream &OS, const Module*) const {
|
||||||
if (Virt2PhysMap[Reg] != (unsigned)VirtRegMap::NO_PHYS_REG) {
|
if (Virt2PhysMap[Reg] != (unsigned)VirtRegMap::NO_PHYS_REG) {
|
||||||
OS << '[' << PrintReg(Reg, TRI) << " -> "
|
OS << '[' << PrintReg(Reg, TRI) << " -> "
|
||||||
<< PrintReg(Virt2PhysMap[Reg], TRI) << "] "
|
<< PrintReg(Virt2PhysMap[Reg], TRI) << "] "
|
||||||
<< MRI->getRegClass(Reg)->getName() << "\n";
|
<< TRI->getRegClassName(MRI->getRegClass(Reg)) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ void VirtRegMap::print(raw_ostream &OS, const Module*) const {
|
||||||
unsigned Reg = TargetRegisterInfo::index2VirtReg(i);
|
unsigned Reg = TargetRegisterInfo::index2VirtReg(i);
|
||||||
if (Virt2StackSlotMap[Reg] != VirtRegMap::NO_STACK_SLOT) {
|
if (Virt2StackSlotMap[Reg] != VirtRegMap::NO_STACK_SLOT) {
|
||||||
OS << '[' << PrintReg(Reg, TRI) << " -> fi#" << Virt2StackSlotMap[Reg]
|
OS << '[' << PrintReg(Reg, TRI) << " -> fi#" << Virt2StackSlotMap[Reg]
|
||||||
<< "] " << MRI->getRegClass(Reg)->getName() << "\n";
|
<< "] " << TRI->getRegClassName(MRI->getRegClass(Reg)) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OS << '\n';
|
OS << '\n';
|
||||||
|
|
|
@ -848,6 +848,8 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target,
|
||||||
// Loop over all of the register classes... emitting each one.
|
// Loop over all of the register classes... emitting each one.
|
||||||
OS << "namespace { // Register classes...\n";
|
OS << "namespace { // Register classes...\n";
|
||||||
|
|
||||||
|
SequenceToOffsetTable<std::string> RegClassStrings;
|
||||||
|
|
||||||
// Emit the register enum value arrays for each RegisterClass
|
// Emit the register enum value arrays for each RegisterClass
|
||||||
for (unsigned rc = 0, e = RegisterClasses.size(); rc != e; ++rc) {
|
for (unsigned rc = 0, e = RegisterClasses.size(); rc != e; ++rc) {
|
||||||
const CodeGenRegisterClass &RC = *RegisterClasses[rc];
|
const CodeGenRegisterClass &RC = *RegisterClasses[rc];
|
||||||
|
@ -856,6 +858,8 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target,
|
||||||
// Give the register class a legal C name if it's anonymous.
|
// Give the register class a legal C name if it's anonymous.
|
||||||
std::string Name = RC.getName();
|
std::string Name = RC.getName();
|
||||||
|
|
||||||
|
RegClassStrings.add(Name);
|
||||||
|
|
||||||
// Emit the register list now.
|
// Emit the register list now.
|
||||||
OS << " // " << Name << " Register Class...\n"
|
OS << " // " << Name << " Register Class...\n"
|
||||||
<< " const MCPhysReg " << Name
|
<< " const MCPhysReg " << Name
|
||||||
|
@ -880,6 +884,11 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target,
|
||||||
}
|
}
|
||||||
OS << "}\n\n";
|
OS << "}\n\n";
|
||||||
|
|
||||||
|
RegClassStrings.layout();
|
||||||
|
OS << "extern const char " << TargetName << "RegClassStrings[] = {\n";
|
||||||
|
RegClassStrings.emit(OS, printChar);
|
||||||
|
OS << "};\n\n";
|
||||||
|
|
||||||
OS << "extern const MCRegisterClass " << TargetName
|
OS << "extern const MCRegisterClass " << TargetName
|
||||||
<< "MCRegisterClasses[] = {\n";
|
<< "MCRegisterClasses[] = {\n";
|
||||||
|
|
||||||
|
@ -892,8 +901,8 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target,
|
||||||
assert((RC.SpillAlignment/8) <= 0xffff && "SpillAlignment too large.");
|
assert((RC.SpillAlignment/8) <= 0xffff && "SpillAlignment too large.");
|
||||||
assert(RC.CopyCost >= -128 && RC.CopyCost <= 127 && "Copy cost too large.");
|
assert(RC.CopyCost >= -128 && RC.CopyCost <= 127 && "Copy cost too large.");
|
||||||
|
|
||||||
OS << " { " << '\"' << RC.getName() << "\", "
|
OS << " { " << RC.getName() << ", " << RC.getName() << "Bits, "
|
||||||
<< RC.getName() << ", " << RC.getName() << "Bits, "
|
<< RegClassStrings.get(RC.getName()) << ", "
|
||||||
<< RC.getOrder().size() << ", sizeof(" << RC.getName() << "Bits), "
|
<< RC.getOrder().size() << ", sizeof(" << RC.getName() << "Bits), "
|
||||||
<< RC.getQualifiedName() + "RegClassID" << ", "
|
<< RC.getQualifiedName() + "RegClassID" << ", "
|
||||||
<< RC.SpillSize/8 << ", "
|
<< RC.SpillSize/8 << ", "
|
||||||
|
@ -934,6 +943,7 @@ RegisterInfoEmitter::runMCDesc(raw_ostream &OS, CodeGenTarget &Target,
|
||||||
<< RegBank.getNumNativeRegUnits() << ", "
|
<< RegBank.getNumNativeRegUnits() << ", "
|
||||||
<< TargetName << "RegDiffLists, "
|
<< TargetName << "RegDiffLists, "
|
||||||
<< TargetName << "RegStrings, "
|
<< TargetName << "RegStrings, "
|
||||||
|
<< TargetName << "RegClassStrings, "
|
||||||
<< TargetName << "SubRegIdxLists, "
|
<< TargetName << "SubRegIdxLists, "
|
||||||
<< (SubRegIndices.size() + 1) << ",\n"
|
<< (SubRegIndices.size() + 1) << ",\n"
|
||||||
<< TargetName << "SubRegIdxRanges, "
|
<< TargetName << "SubRegIdxRanges, "
|
||||||
|
@ -1267,6 +1277,7 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
|
||||||
OS << "extern const MCRegisterDesc " << TargetName << "RegDesc[];\n";
|
OS << "extern const MCRegisterDesc " << TargetName << "RegDesc[];\n";
|
||||||
OS << "extern const MCPhysReg " << TargetName << "RegDiffLists[];\n";
|
OS << "extern const MCPhysReg " << TargetName << "RegDiffLists[];\n";
|
||||||
OS << "extern const char " << TargetName << "RegStrings[];\n";
|
OS << "extern const char " << TargetName << "RegStrings[];\n";
|
||||||
|
OS << "extern const char " << TargetName << "RegClassStrings[];\n";
|
||||||
OS << "extern const MCPhysReg " << TargetName << "RegUnitRoots[][2];\n";
|
OS << "extern const MCPhysReg " << TargetName << "RegUnitRoots[][2];\n";
|
||||||
OS << "extern const uint16_t " << TargetName << "SubRegIdxLists[];\n";
|
OS << "extern const uint16_t " << TargetName << "SubRegIdxLists[];\n";
|
||||||
OS << "extern const MCRegisterInfo::SubRegCoveredBits "
|
OS << "extern const MCRegisterInfo::SubRegCoveredBits "
|
||||||
|
@ -1289,6 +1300,7 @@ RegisterInfoEmitter::runTargetDesc(raw_ostream &OS, CodeGenTarget &Target,
|
||||||
<< " " << RegBank.getNumNativeRegUnits() << ",\n"
|
<< " " << RegBank.getNumNativeRegUnits() << ",\n"
|
||||||
<< " " << TargetName << "RegDiffLists,\n"
|
<< " " << TargetName << "RegDiffLists,\n"
|
||||||
<< " " << TargetName << "RegStrings,\n"
|
<< " " << TargetName << "RegStrings,\n"
|
||||||
|
<< " " << TargetName << "RegClassStrings,\n"
|
||||||
<< " " << TargetName << "SubRegIdxLists,\n"
|
<< " " << TargetName << "SubRegIdxLists,\n"
|
||||||
<< " " << SubRegIndices.size() + 1 << ",\n"
|
<< " " << SubRegIndices.size() + 1 << ",\n"
|
||||||
<< " " << TargetName << "SubRegIdxRanges,\n"
|
<< " " << TargetName << "SubRegIdxRanges,\n"
|
||||||
|
|
Loading…
Reference in New Issue