diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h index ab29c4849ef..cc8385018d0 100644 --- a/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/include/llvm/CodeGen/MachineRegisterInfo.h @@ -603,6 +603,11 @@ public: /// (target independent) virtual register. unsigned getSize(unsigned VReg) const; + /// Set the size of \p VReg to \p Size. + /// Although the size should be set at build time, mir infrastructure + /// is not yet able to do it. + void setSize(unsigned VReg, unsigned Size); + /// Create and return a new generic virtual register with a size of \p Size. /// \pre Size > 0. unsigned createGenericVirtualRegister(unsigned Size); diff --git a/lib/CodeGen/MachineRegisterInfo.cpp b/lib/CodeGen/MachineRegisterInfo.cpp index 2b81f6b2015..8521bee82e6 100644 --- a/lib/CodeGen/MachineRegisterInfo.cpp +++ b/lib/CodeGen/MachineRegisterInfo.cpp @@ -109,6 +109,10 @@ MachineRegisterInfo::getSize(unsigned VReg) const { return SizeIt != getVRegToSize().end() ? SizeIt->second : 0; } +void MachineRegisterInfo::setSize(unsigned VReg, unsigned Size) { + getVRegToSize()[VReg] = Size; +} + unsigned MachineRegisterInfo::createGenericVirtualRegister(unsigned Size) { assert(Size && "Cannot create empty virtual register");