mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
[MachineInstr] Teach the print method about RegisterBank.
Properly print either the register class or the register bank or a virtual register. Get rid of a few ifdefs in the process. llvm-svn: 265745
This commit is contained in:
parent
2aebd873f1
commit
488499a935
@ -1689,12 +1689,9 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
|
||||
unsigned Reg = getOperand(StartOp).getReg();
|
||||
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
||||
VirtRegs.push_back(Reg);
|
||||
#ifdef LLVM_BUILD_GLOBAL_ISEL
|
||||
unsigned Size;
|
||||
if (MRI && (Size = MRI->getSize(Reg))) {
|
||||
if (MRI && (Size = MRI->getSize(Reg)))
|
||||
OS << '(' << Size << ')';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1873,16 +1870,18 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
|
||||
HaveSemi = true;
|
||||
}
|
||||
for (unsigned i = 0; i != VirtRegs.size(); ++i) {
|
||||
const TargetRegisterClass *RC = MRI->getRegClass(VirtRegs[i]);
|
||||
#ifdef LLVM_BUILD_GLOBAL_ISEL
|
||||
// Generic virtual registers do not have register classes.
|
||||
const RegClassOrRegBank &RC = MRI->getRegClassOrRegBank(VirtRegs[i]);
|
||||
if (!RC)
|
||||
continue;
|
||||
#endif
|
||||
OS << " " << TRI->getRegClassName(RC)
|
||||
<< ':' << PrintReg(VirtRegs[i]);
|
||||
// Generic virtual registers do not have register classes.
|
||||
if (RC.is<const RegisterBank *>())
|
||||
OS << " " << RC.get<const RegisterBank *>()->getName();
|
||||
else
|
||||
OS << " "
|
||||
<< TRI->getRegClassName(RC.get<const TargetRegisterClass *>());
|
||||
OS << ':' << PrintReg(VirtRegs[i]);
|
||||
for (unsigned j = i+1; j != VirtRegs.size();) {
|
||||
if (MRI->getRegClass(VirtRegs[j]) != RC) {
|
||||
if (MRI->getRegClassOrRegBank(VirtRegs[j]) != RC) {
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user