[llvm-branch-commits] [llvm-branch] r104565 - in /llvm/branches/Apple/Hermes: include/llvm/CodeGen/MachineRegisterInfo.h lib/CodeGen/MachineFunction.cpp lib/CodeGen/MachineRegisterInfo.cpp lib/Target/ARM/ARMInstrFormats.td

Evan Cheng evan.cheng at apple.com
Mon May 24 14:47:56 PDT 2010


Author: evancheng
Date: Mon May 24 16:47:56 2010
New Revision: 104565

URL: http://llvm.org/viewvc/llvm-project?rev=104565&view=rev
Log:
Merge 104560.

Modified:
    llvm/branches/Apple/Hermes/include/llvm/CodeGen/MachineRegisterInfo.h
    llvm/branches/Apple/Hermes/lib/CodeGen/MachineFunction.cpp
    llvm/branches/Apple/Hermes/lib/CodeGen/MachineRegisterInfo.cpp
    llvm/branches/Apple/Hermes/lib/Target/ARM/ARMInstrFormats.td   (props changed)

Modified: llvm/branches/Apple/Hermes/include/llvm/CodeGen/MachineRegisterInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Hermes/include/llvm/CodeGen/MachineRegisterInfo.h?rev=104565&r1=104564&r2=104565&view=diff
==============================================================================
--- llvm/branches/Apple/Hermes/include/llvm/CodeGen/MachineRegisterInfo.h (original)
+++ llvm/branches/Apple/Hermes/include/llvm/CodeGen/MachineRegisterInfo.h Mon May 24 16:47:56 2010
@@ -263,6 +263,10 @@
     return false;
   }
 
+  /// getLiveInVirtReg - If PReg is a live-in physical register, return the
+  /// corresponding live-in physical register.
+  unsigned getLiveInVirtReg(unsigned PReg) const;
+
 private:
   void HandleVRegListReallocation();
   

Modified: llvm/branches/Apple/Hermes/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Hermes/lib/CodeGen/MachineFunction.cpp?rev=104565&r1=104564&r2=104565&view=diff
==============================================================================
--- llvm/branches/Apple/Hermes/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/branches/Apple/Hermes/lib/CodeGen/MachineFunction.cpp Mon May 24 16:47:56 2010
@@ -432,8 +432,14 @@
 unsigned MachineFunction::addLiveIn(unsigned PReg,
                                     const TargetRegisterClass *RC) {
   assert(RC->contains(PReg) && "Not the correct regclass!");
-  unsigned VReg = getRegInfo().createVirtualRegister(RC);
-  getRegInfo().addLiveIn(PReg, VReg);
+  MachineRegisterInfo &MRI = getRegInfo();
+  unsigned VReg = MRI.getLiveInVirtReg(PReg);
+  if (VReg) {
+    assert(MRI.getRegClass(VReg) == RC && "Register class mismatch!");
+    return VReg;
+  }
+  VReg = MRI.createVirtualRegister(RC);
+  MRI.addLiveIn(PReg, VReg);
   return VReg;
 }
 

Modified: llvm/branches/Apple/Hermes/lib/CodeGen/MachineRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Hermes/lib/CodeGen/MachineRegisterInfo.cpp?rev=104565&r1=104564&r2=104565&view=diff
==============================================================================
--- llvm/branches/Apple/Hermes/lib/CodeGen/MachineRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Hermes/lib/CodeGen/MachineRegisterInfo.cpp Mon May 24 16:47:56 2010
@@ -117,6 +117,15 @@
 }
 
 
+/// getLiveInVirtReg - If PReg is a live-in physical register, return the
+/// corresponding live-in physical register.
+unsigned MachineRegisterInfo::getLiveInVirtReg(unsigned PReg) const {
+  for (livein_iterator I = livein_begin(), E = livein_end(); I != E; ++I)
+    if (I->first == PReg)
+      return I->second;
+  return 0;
+}
+
 #ifndef NDEBUG
 void MachineRegisterInfo::dumpUses(unsigned Reg) const {
   for (use_iterator I = use_begin(Reg), E = use_end(); I != E; ++I)

Propchange: llvm/branches/Apple/Hermes/lib/Target/ARM/ARMInstrFormats.td
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 24 16:47:56 2010
@@ -1 +1 @@
-/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td:96032,96521,96525,96572,96621,96775,96825,96827,96990,97025,97065,97071,97538,97707,97757,97782,97797,98210,98270,98395,98398,98402,98409,98416,98427,98561,98586,98845,98977,99043,99630,99678,100568,100892,101181,101282,101303,101383,101615,102526,103995,104060,104419,104421,104531
+/llvm/trunk/lib/Target/ARM/ARMInstrFormats.td:96032,96521,96525,96572,96621,96775,96825,96827,96990,97025,97065,97071,97538,97707,97757,97782,97797,98210,98270,98395,98398,98402,98409,98416,98427,98561,98586,98845,98977,99043,99630,99678,100568,100892,101181,101282,101303,101383,101615,102526,103995,104060,104419,104421,104531,104560





More information about the llvm-branch-commits mailing list