forked from OSchip/llvm-project
[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
e217660591
commit
03c419628e
|
@ -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