[llvm] r265745 - [MachineInstr] Teach the print method about RegisterBank.
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 7 16:18:11 PDT 2016
Author: qcolombet
Date: Thu Apr 7 18:18:11 2016
New Revision: 265745
URL: http://llvm.org/viewvc/llvm-project?rev=265745&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/CodeGen/MachineInstr.cpp
Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=265745&r1=265744&r2=265745&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Apr 7 18:18:11 2016
@@ -1689,12 +1689,9 @@ void MachineInstr::print(raw_ostream &OS
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
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;
}
More information about the llvm-commits
mailing list