[llvm-commits] [llvm] r75232 - in /llvm/trunk/lib/Target/X86: X86CodeEmitter.cpp X86FastISel.cpp X86ISelLowering.cpp X86InstrInfo.cpp X86Subtarget.cpp X86Subtarget.h

Chris Lattner sabre at nondot.org
Thu Jul 9 22:52:02 PDT 2009


Author: lattner
Date: Fri Jul 10 00:52:02 2009
New Revision: 75232

URL: http://llvm.org/viewvc/llvm-project?rev=75232&view=rev
Log:
GVRequiresExtraLoad is now never used for calls, simplify it based on this.

Modified:
    llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
    llvm/trunk/lib/Target/X86/X86FastISel.cpp
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
    llvm/trunk/lib/Target/X86/X86Subtarget.cpp
    llvm/trunk/lib/Target/X86/X86Subtarget.h

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

==============================================================================
--- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Fri Jul 10 00:52:02 2009
@@ -301,7 +301,7 @@
       !TM.getSubtarget<X86Subtarget>().isTargetDarwin())
     return false;
   
-  return TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM, false);
+  return TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM);
 }
 
 template<class CodeEmitter>

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

==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Fri Jul 10 00:52:02 2009
@@ -449,7 +449,7 @@
 
     // If the ABI doesn't require an extra load, return a direct reference to
     // the global.
-    if (!Subtarget->GVRequiresExtraLoad(GV, TM, false)) {
+    if (!Subtarget->GVRequiresExtraLoad(GV, TM)) {
       if (Subtarget->isPICStyleRIPRel()) {
         // Use rip-relative addressing if we can.  Above we verified that the
         // base and index registers are unused.

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

==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Jul 10 00:52:02 2009
@@ -4554,7 +4554,7 @@
                                       SelectionDAG &DAG) const {
   bool IsPIC = getTargetMachine().getRelocationModel() == Reloc::PIC_;
   bool ExtraLoadRequired =
-    Subtarget->GVRequiresExtraLoad(GV, getTargetMachine(), false);
+    Subtarget->GVRequiresExtraLoad(GV, getTargetMachine());
 
   // Create the TargetGlobalAddress node, folding in the constant
   // offset if it is legal.
@@ -7075,7 +7075,7 @@
 
   if (AM.BaseGV) {
     // We can only fold this if we don't need an extra load.
-    if (Subtarget->GVRequiresExtraLoad(AM.BaseGV, getTargetMachine(), false))
+    if (Subtarget->GVRequiresExtraLoad(AM.BaseGV, getTargetMachine()))
       return false;
     // If BaseGV requires a register, we cannot also have a BaseReg.
     if (Subtarget->GVRequiresRegister(AM.BaseGV, getTargetMachine()) &&
@@ -8841,8 +8841,7 @@
     }
     // If we require an extra load to get this address, as in PIC mode, we
     // can't accept it.
-    if (Subtarget->GVRequiresExtraLoad(GA->getGlobal(), getTargetMachine(),
-                                       false))
+    if (Subtarget->GVRequiresExtraLoad(GA->getGlobal(), getTargetMachine()))
       return;
 
     if (hasMemory)

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

==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Jul 10 00:52:02 2009
@@ -781,7 +781,7 @@
 /// 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, false);
+  return TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM);
 }
 
 /// CanRematLoadWithDispOperand - Return true if a load with the specified

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

==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Fri Jul 10 00:52:02 2009
@@ -39,8 +39,7 @@
 /// value of GV itself. This means that the GlobalAddress must be in the base
 /// or index register of the address, not the GV offset field.
 bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue *GV,
-                                       const TargetMachine &TM,
-                                       bool isDirectCall) const {
+                                       const TargetMachine &TM) const {
   // Windows targets only require an extra load for DLLImport linkage values,
   // and they need these regardless of whether we're in PIC mode or not.
   if (isTargetCygMing() || isTargetWindows())
@@ -51,8 +50,6 @@
     return false;
     
   if (isTargetDarwin()) {
-    if (isDirectCall)
-      return false;
     bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
     if (GV->hasHiddenVisibility() &&
         (Is64Bit || (!isDecl && !GV->hasCommonLinkage())))
@@ -60,11 +57,9 @@
       // target is x86-64 or the symbol is definitely defined in the current
       // translation unit.
       return false;
-    return !isDirectCall && (isDecl || GV->isWeakForLinker());
+    return isDecl || GV->isWeakForLinker();
   } else if (isTargetELF()) {
     // Extra load is needed for all externally visible.
-    if (isDirectCall)
-      return false;
     if (GV->hasLocalLinkage() || GV->hasHiddenVisibility())
       return false;
     return true;
@@ -77,7 +72,7 @@
 /// a register, but not an extra load.
 bool X86Subtarget::GVRequiresRegister(const GlobalValue *GV,
                                       const TargetMachine &TM) const {
-  if (GVRequiresExtraLoad(GV, TM, false))
+  if (GVRequiresExtraLoad(GV, TM))
     return true;
   
   // Code below here need only consider cases where GVRequiresExtraLoad

Modified: llvm/trunk/lib/Target/X86/X86Subtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.h?rev=75232&r1=75231&r2=75232&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86Subtarget.h (original)
+++ llvm/trunk/lib/Target/X86/X86Subtarget.h Fri Jul 10 00:52:02 2009
@@ -201,8 +201,7 @@
   /// symbols are indirect, loading the value at address GV rather then the
   /// value of GV itself. This means that the GlobalAddress must be in the base
   /// or index register of the address, not the GV offset field.
-  bool GVRequiresExtraLoad(const GlobalValue* GV, const TargetMachine &TM,
-                           bool isDirectCall) const;
+  bool GVRequiresExtraLoad(const GlobalValue* GV, const TargetMachine &TM)const;
 
   /// True if accessing the GV requires a register.  This is a superset of the
   /// cases where GVRequiresExtraLoad is true.  Some variations of PIC require





More information about the llvm-commits mailing list