[llvm-commits] [llvm] r75234 - in /llvm/trunk/lib/Target/X86: X86CodeEmitter.cpp X86InstrInfo.cpp

Chris Lattner sabre at nondot.org
Thu Jul 9 23:07:08 PDT 2009


Author: lattner
Date: Fri Jul 10 01:07:08 2009
New Revision: 75234

URL: http://llvm.org/viewvc/llvm-project?rev=75234&view=rev
Log:
convert some late code (called by regalloc and code emission)
to use isGlobalStubReference instead of GVRequiresExtraLoad
(which should really be part of isel).

Modified:
    llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp

Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=75234&r1=75233&r2=75234&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Fri Jul 10 01:07:08 2009
@@ -293,15 +293,15 @@
 
 static bool gvNeedsNonLazyPtr(const MachineOperand &GVOp,
                               const TargetMachine &TM) {
-  const GlobalValue *GV = GVOp.getGlobal();
-  
   // For Darwin-64, simulate the linktime GOT by using the same non-lazy-pointer
   // mechanism as 32-bit mode.
   if (TM.getSubtarget<X86Subtarget>().is64Bit() && 
       !TM.getSubtarget<X86Subtarget>().isTargetDarwin())
     return false;
   
-  return TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM);
+  // Return true if this is a reference to a stub containing the address of the
+  // global, not the global itself.
+  return isGlobalStubReference(GVOp);
 }
 
 template<class CodeEmitter>

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=75234&r1=75233&r2=75234&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Jul 10 01:07:08 2009
@@ -762,7 +762,6 @@
   return 0;
 }
 
-
 /// regIsPICBase - Return true if register is PIC base (i.e.g defined by
 /// X86::MOVPC32r.
 static bool regIsPICBase(unsigned BaseReg, const MachineRegisterInfo &MRI) {
@@ -778,12 +777,6 @@
   return isPICBase;
 }
 
-/// isGVStub - Return true if the GV requires an extra load to get the
-/// real address.
-static inline bool isGVStub(GlobalValue *GV, X86TargetMachine &TM) {
-  return TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM);
-}
-
 /// CanRematLoadWithDispOperand - Return true if a load with the specified
 /// operand is a candidate for remat: for this to be true we need to know that
 /// the load will always return the same value, even if moved.
@@ -796,7 +789,7 @@
   if (MO.isGlobal()) {
     // If this is a load of a stub, not of the global, we can remat it.  This
     // access will always return the address of the global.
-    if (isGVStub(MO.getGlobal(), TM))
+    if (isGlobalStubReference(MO))
       return true;
     
     // If the global itself is constant, we can remat the load.
@@ -987,7 +980,7 @@
       return true;
 
     if (MO.isGlobal())
-      return isGVStub(MO.getGlobal(), TM);
+      return isGlobalStubReference(MO);
 
     // If this is a load from an invariant stack slot, the load is a constant.
     if (MO.isFI()) {





More information about the llvm-commits mailing list