[llvm-commits] [llvm] r60684 - in /llvm/trunk: include/llvm/CodeGen/MachineRegisterInfo.h lib/CodeGen/MachineRegisterInfo.cpp

Dan Gohman gohman at apple.com
Sun Dec 7 20:54:11 PST 2008


Author: djg
Date: Sun Dec  7 22:54:11 2008
New Revision: 60684

URL: http://llvm.org/viewvc/llvm-project?rev=60684&view=rev
Log:
Move createVirtualRegister out-of-line.

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=60684&r1=60683&r2=60684&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineRegisterInfo.h Sun Dec  7 22:54:11 2008
@@ -164,19 +164,7 @@
   /// createVirtualRegister - Create and return a new virtual register in the
   /// function with the specified register class.
   ///
-  unsigned createVirtualRegister(const TargetRegisterClass *RegClass) {
-    assert(RegClass && "Cannot create register without RegClass!");
-    // Add a reg, but keep track of whether the vector reallocated or not.
-    void *ArrayBase = VRegInfo.empty() ? 0 : &VRegInfo[0];
-    VRegInfo.push_back(std::make_pair(RegClass, (MachineOperand*)0));
-
-    if (!((&VRegInfo[0] == ArrayBase || VRegInfo.size() == 1)))
-      // The vector reallocated, handle this now.
-      HandleVRegListReallocation();
-    unsigned VR = getLastVirtReg();
-    RegClass2VRegMap[RegClass->getID()].push_back(VR);
-    return VR;
-  }
+  unsigned createVirtualRegister(const TargetRegisterClass *RegClass);
 
   /// getLastVirtReg - Return the highest currently assigned virtual register.
   ///

Modified: llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp?rev=60684&r1=60683&r2=60684&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineRegisterInfo.cpp Sun Dec  7 22:54:11 2008
@@ -35,6 +35,24 @@
   delete [] PhysRegUseDefLists;
 }
 
+/// createVirtualRegister - Create and return a new virtual register in the
+/// function with the specified register class.
+///
+unsigned
+MachineRegisterInfo::createVirtualRegister(const TargetRegisterClass *RegClass){
+  assert(RegClass && "Cannot create register without RegClass!");
+  // Add a reg, but keep track of whether the vector reallocated or not.
+  void *ArrayBase = VRegInfo.empty() ? 0 : &VRegInfo[0];
+  VRegInfo.push_back(std::make_pair(RegClass, (MachineOperand*)0));
+
+  if (!((&VRegInfo[0] == ArrayBase || VRegInfo.size() == 1)))
+    // The vector reallocated, handle this now.
+    HandleVRegListReallocation();
+  unsigned VR = getLastVirtReg();
+  RegClass2VRegMap[RegClass->getID()].push_back(VR);
+  return VR;
+}
+
 /// HandleVRegListReallocation - We just added a virtual register to the
 /// VRegInfo info list and it reallocated.  Update the use/def lists info
 /// pointers.





More information about the llvm-commits mailing list