forked from OSchip/llvm-project
Make the subregister hashtable output more readable by wrapping the lines,
and mark it const along with the associated changes to TargetRegisterInfo. llvm-svn: 52966
This commit is contained in:
parent
ab54e51b38
commit
3684013910
|
@ -275,8 +275,8 @@ public:
|
|||
///
|
||||
class TargetRegisterInfo {
|
||||
protected:
|
||||
unsigned* SubregHash;
|
||||
unsigned SubregHashSize;
|
||||
const unsigned* SubregHash;
|
||||
const unsigned SubregHashSize;
|
||||
public:
|
||||
typedef const TargetRegisterClass * const * regclass_iterator;
|
||||
private:
|
||||
|
@ -291,7 +291,9 @@ protected:
|
|||
regclass_iterator RegClassBegin,
|
||||
regclass_iterator RegClassEnd,
|
||||
int CallFrameSetupOpcode = -1,
|
||||
int CallFrameDestroyOpcode = -1);
|
||||
int CallFrameDestroyOpcode = -1,
|
||||
const unsigned* subregs = 0,
|
||||
const unsigned subregsize = 0);
|
||||
virtual ~TargetRegisterInfo();
|
||||
public:
|
||||
|
||||
|
|
|
@ -22,8 +22,10 @@ using namespace llvm;
|
|||
|
||||
TargetRegisterInfo::TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR,
|
||||
regclass_iterator RCB, regclass_iterator RCE,
|
||||
int CFSO, int CFDO)
|
||||
: Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) {
|
||||
int CFSO, int CFDO,
|
||||
const unsigned* subregs, const unsigned subregsize)
|
||||
: Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE),
|
||||
SubregHash(subregs), SubregHashSize(subregsize) {
|
||||
assert(NumRegs < FirstVirtualRegister &&
|
||||
"Target has too many physical registers!");
|
||||
|
||||
|
|
|
@ -501,29 +501,34 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
|||
if (SubregHashTableSize) {
|
||||
std::string Namespace = Regs[0].TheDef->getValueAsString("Namespace");
|
||||
|
||||
OS << "\n\n unsigned SubregHashTable[] = {";
|
||||
OS << "\n\n const unsigned SubregHashTable[] = { ";
|
||||
for (unsigned i = 0; i < SubregHashTableSize - 1; ++i) {
|
||||
if (i != 0)
|
||||
// Insert spaces for nice formatting.
|
||||
OS << " ";
|
||||
|
||||
if (SubregHashTable[2*i] != ~0U) {
|
||||
OS << getQualifiedName(Regs[SubregHashTable[2*i]].TheDef) << ", "
|
||||
<< getQualifiedName(Regs[SubregHashTable[2*i+1]].TheDef) << ", ";
|
||||
<< getQualifiedName(Regs[SubregHashTable[2*i+1]].TheDef) << ", \n";
|
||||
} else {
|
||||
OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister, ";
|
||||
OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister, \n";
|
||||
}
|
||||
}
|
||||
|
||||
unsigned Idx = SubregHashTableSize*2-2;
|
||||
if (SubregHashTable[Idx] != ~0U) {
|
||||
OS << getQualifiedName(Regs[SubregHashTable[Idx]].TheDef) << ", "
|
||||
<< getQualifiedName(Regs[SubregHashTable[Idx+1]].TheDef) << "};\n";
|
||||
OS << " "
|
||||
<< getQualifiedName(Regs[SubregHashTable[Idx]].TheDef) << ", "
|
||||
<< getQualifiedName(Regs[SubregHashTable[Idx+1]].TheDef) << " };\n";
|
||||
} else {
|
||||
OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister};\n";
|
||||
OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister };\n";
|
||||
}
|
||||
|
||||
OS << " unsigned SubregHashTableSize = "
|
||||
OS << " const unsigned SubregHashTableSize = "
|
||||
<< SubregHashTableSize << ";\n";
|
||||
} else {
|
||||
OS << "\n\n unsigned SubregHashTable[] = { ~0U, ~0U };\n"
|
||||
<< " unsigned SubregHashTableSize = 1;\n";
|
||||
OS << "\n\n const unsigned SubregHashTable[] = { ~0U, ~0U };\n"
|
||||
<< " const unsigned SubregHashTableSize = 1;\n";
|
||||
}
|
||||
|
||||
delete [] SubregHashTable;
|
||||
|
@ -672,9 +677,8 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
|||
<< "(int CallFrameSetupOpcode, int CallFrameDestroyOpcode)\n"
|
||||
<< " : TargetRegisterInfo(RegisterDescriptors, " << Registers.size()+1
|
||||
<< ", RegisterClasses, RegisterClasses+" << RegisterClasses.size() <<",\n "
|
||||
<< " CallFrameSetupOpcode, CallFrameDestroyOpcode) {\n"
|
||||
<< " this->SubregHash = SubregHashTable;\n"
|
||||
<< " this->SubregHashSize = SubregHashTableSize;\n"
|
||||
<< " CallFrameSetupOpcode, CallFrameDestroyOpcode,\n"
|
||||
<< " SubregHashTable, SubregHashTableSize) {\n"
|
||||
<< "}\n\n";
|
||||
|
||||
// Collect all information about dwarf register numbers
|
||||
|
|
Loading…
Reference in New Issue