1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[MachineRegisterInfo] Get rid of the global-isel ifdefs.

One additional pointer is not a big deal size-wise and it makes
the code much nicer!

llvm-svn: 262856
This commit is contained in:
Quentin Colombet 2016-03-07 21:22:09 +00:00
parent 773269eba0
commit 264b1a3444
2 changed files with 13 additions and 11 deletions

View File

@ -105,10 +105,17 @@ private:
/// started.
BitVector ReservedRegs;
#ifdef LLVM_BUILD_GLOBAL_ISEL
typedef DenseMap<unsigned, unsigned> VRegToSizeMap;
/// Map generic virtual registers to their actual size.
DenseMap<unsigned, unsigned> VRegToSize;
#endif
mutable std::unique_ptr<VRegToSizeMap> VRegToSize;
/// Accessor for VRegToSize. This accessor should only be used
/// by global-isel related work.
VRegToSizeMap &getVRegToSize() const {
if (!VRegToSize)
VRegToSize.reset(new VRegToSizeMap);
return *VRegToSize.get();
}
/// Keep track of the physical registers that are live in to the function.
/// Live in values are typically arguments in registers. LiveIn values are
@ -592,7 +599,6 @@ 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;
@ -600,7 +606,6 @@ public:
/// Create and return a new generic virtual register with a size of \p Size.
/// \pre Size > 0.
unsigned createGenericVirtualRegister(unsigned Size);
#endif
/// getNumVirtRegs - Return the number of virtual registers created.
///

View File

@ -103,12 +103,10 @@ 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;
VRegToSizeMap::const_iterator SizeIt = getVRegToSize().find(VReg);
return SizeIt != getVRegToSize().end() ? SizeIt->second : 0;
}
unsigned
@ -120,13 +118,12 @@ MachineRegisterInfo::createGenericVirtualRegister(unsigned Size) {
VRegInfo.grow(Reg);
// FIXME: Should we use a dummy register class?
VRegInfo[Reg].first = nullptr;
VRegToSize[Reg] = Size;
getVRegToSize()[Reg] = Size;
RegAllocHints.grow(Reg);
if (TheDelegate)
TheDelegate->MRI_NoteNewVirtualRegister(Reg);
return Reg;
}
#endif // LLVM_BUILD_GLOBAL_ISEL
/// clearVirtRegs - Remove all virtual registers (after physreg assignment).
void MachineRegisterInfo::clearVirtRegs() {