[llvm] r262861 - [MachineRegisterInfo] Add a method to set the size of a virtual register a posteriori.
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 13:41:40 PST 2016
Author: qcolombet
Date: Mon Mar 7 15:41:39 2016
New Revision: 262861
URL: http://llvm.org/viewvc/llvm-project?rev=262861&view=rev
Log:
[MachineRegisterInfo] Add a method to set the size of a virtual register a posteriori.
This is required for mir testing.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h
llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h?rev=262861&r1=262860&r2=262861&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Mon Mar 7 15:41:39 2016
@@ -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);
Modified: llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp?rev=262861&r1=262860&r2=262861&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Mon Mar 7 15:41:39 2016
@@ -109,6 +109,10 @@ MachineRegisterInfo::getSize(unsigned VR
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");
More information about the llvm-commits
mailing list