mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-05 19:29:54 +00:00
[GlobalISel] Remember the size of generic virtual registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260468 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
34b34e0d3e
commit
d3bd0e5e8b
@ -105,6 +105,11 @@ private:
|
||||
/// started.
|
||||
BitVector ReservedRegs;
|
||||
|
||||
#ifdef LLVM_BUILD_GLOBAL_ISEL
|
||||
/// Map generic virtual registers to their actual size.
|
||||
DenseMap<unsigned, unsigned> VRegToSize;
|
||||
#endif
|
||||
|
||||
/// Keep track of the physical registers that are live in to the function.
|
||||
/// Live in values are typically arguments in registers. LiveIn values are
|
||||
/// allowed to have virtual registers associated with them, stored in the
|
||||
@ -587,6 +592,12 @@ public:
|
||||
///
|
||||
unsigned createVirtualRegister(const TargetRegisterClass *RegClass);
|
||||
|
||||
#ifdef LLVM_BUILD_GLOBAL_ISEL
|
||||
/// Get the size of \p VReg or 0 if VReg is not a generic
|
||||
/// (target independent) virtual register.
|
||||
unsigned getSize(unsigned VReg) const;
|
||||
#endif
|
||||
|
||||
/// getNumVirtRegs - Return the number of virtual registers created.
|
||||
///
|
||||
unsigned getNumVirtRegs() const { return VRegInfo.size(); }
|
||||
|
@ -1657,8 +1657,15 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
|
||||
if (StartOp != 0) OS << ", ";
|
||||
getOperand(StartOp).print(OS, MST, TRI);
|
||||
unsigned Reg = getOperand(StartOp).getReg();
|
||||
if (TargetRegisterInfo::isVirtualRegister(Reg))
|
||||
if (TargetRegisterInfo::isVirtualRegister(Reg)) {
|
||||
VirtRegs.push_back(Reg);
|
||||
#ifdef LLVM_BUILD_GLOBAL_ISEL
|
||||
unsigned Size;
|
||||
if (MRI && (Size = MRI->getSize(Reg))) {
|
||||
OS << '(' << Size << ')';
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (StartOp != 0)
|
||||
|
@ -103,6 +103,15 @@ MachineRegisterInfo::createVirtualRegister(const TargetRegisterClass *RegClass){
|
||||
return Reg;
|
||||
}
|
||||
|
||||
#ifdef LLVM_BUILD_GLOBAL_ISEL
|
||||
unsigned
|
||||
MachineRegisterInfo::getSize(unsigned VReg) const {
|
||||
DenseMap<unsigned, unsigned>::const_iterator SizeIt =
|
||||
VRegToSize.find(VReg);
|
||||
return SizeIt != VRegToSize.end()? SizeIt->second: 0;
|
||||
}
|
||||
#endif // LLVM_BUILD_GLOBAL_ISEL
|
||||
|
||||
/// clearVirtRegs - Remove all virtual registers (after physreg assignment).
|
||||
void MachineRegisterInfo::clearVirtRegs() {
|
||||
#ifndef NDEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user