mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-28 14:36:34 +00:00
Add immediate sub-registers.
llvm-svn: 37738
This commit is contained in:
parent
5506831e5b
commit
ac10d44736
@ -48,6 +48,7 @@ struct TargetRegisterDesc {
|
||||
const char *Name; // Assembly language name for the register
|
||||
const unsigned *AliasSet; // Register Alias Set, described above
|
||||
const unsigned *SubRegs; // Sub-register set, described above
|
||||
const unsigned *ImmSubRegs; // Immediate sub-register set, described above
|
||||
const unsigned *SuperRegs; // Super-register set, described above
|
||||
};
|
||||
|
||||
@ -326,6 +327,14 @@ public:
|
||||
return get(RegNo).SubRegs;
|
||||
}
|
||||
|
||||
/// getImmediateSubRegisters - Return the set of registers that are immediate
|
||||
/// sub-registers of the specified register, or a null list of there are none.
|
||||
/// The list returned is zero terminated.
|
||||
///
|
||||
const unsigned *getImmediateSubRegisters(unsigned RegNo) const {
|
||||
return get(RegNo).ImmSubRegs;
|
||||
}
|
||||
|
||||
/// getSuperRegisters - Return the set of registers that are super-registers
|
||||
/// of the specified register, or a null list of there are none. The list
|
||||
/// returned is zero terminated.
|
||||
|
@ -359,6 +359,7 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
OS << " };\n";
|
||||
|
||||
// Emit register sub-registers / super-registers, aliases...
|
||||
std::map<Record*, std::set<Record*> > RegisterImmSubRegs;
|
||||
std::map<Record*, std::set<Record*> > RegisterSubRegs;
|
||||
std::map<Record*, std::set<Record*> > RegisterSuperRegs;
|
||||
std::map<Record*, std::set<Record*> > RegisterAliases;
|
||||
@ -397,6 +398,7 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
cerr << "Warning: register " << getQualifiedName(SubReg)
|
||||
<< " specified as a sub-register of " << getQualifiedName(R)
|
||||
<< " multiple times!\n";
|
||||
RegisterImmSubRegs[R].insert(SubReg);
|
||||
addSubSuperReg(R, SubReg, RegisterSubRegs, RegisterSuperRegs,
|
||||
RegisterAliases, *this);
|
||||
}
|
||||
@ -434,6 +436,21 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
OS << "0 };\n";
|
||||
}
|
||||
|
||||
if (!RegisterImmSubRegs.empty())
|
||||
OS << "\n\n // Register Immediate Sub-registers Sets...\n";
|
||||
|
||||
// Loop over all of the registers which have sub-registers, emitting the
|
||||
// sub-registers list to memory.
|
||||
for (std::map<Record*, std::set<Record*> >::iterator
|
||||
I = RegisterImmSubRegs.begin(), E = RegisterImmSubRegs.end();
|
||||
I != E; ++I) {
|
||||
OS << " const unsigned " << I->first->getName() << "_ImmSubRegsSet[] = { ";
|
||||
for (std::set<Record*>::iterator ASI = I->second.begin(),
|
||||
E = I->second.end(); ASI != E; ++ASI)
|
||||
OS << getQualifiedName(*ASI) << ", ";
|
||||
OS << "0 };\n";
|
||||
}
|
||||
|
||||
if (!RegisterSuperRegs.empty())
|
||||
OS << "\n\n // Register Super-registers Sets...\n";
|
||||
|
||||
@ -472,6 +489,10 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
OS << Reg.getName() << "_SubRegsSet,\t";
|
||||
else
|
||||
OS << "Empty_SubRegsSet,\t";
|
||||
if (RegisterImmSubRegs.count(Reg.TheDef))
|
||||
OS << Reg.getName() << "_ImmSubRegsSet,\t";
|
||||
else
|
||||
OS << "Empty_SubRegsSet,\t";
|
||||
if (RegisterSuperRegs.count(Reg.TheDef))
|
||||
OS << Reg.getName() << "_SuperRegsSet },\n";
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user