Factor out GVRequiresExtraLoad() from .h to .cpp
authorAnton Korobeynikov <asl@math.spbu.ru>
Thu, 30 Nov 2006 22:42:55 +0000 (22:42 +0000)
committerAnton Korobeynikov <asl@math.spbu.ru>
Thu, 30 Nov 2006 22:42:55 +0000 (22:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32048 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86Subtarget.cpp
lib/Target/X86/X86Subtarget.h

index ea185b98e82a2316d70dafffe107ad539f319ed1..2459ed122c06a173d6a46e8d92e2ddc7e5f528e4 100644 (file)
@@ -27,6 +27,23 @@ AsmWriterFlavor("x86-asm-syntax", cl::init(X86Subtarget::unset),
     clEnumValEnd));
 
 
+/// True if accessing the GV requires an extra load. For Windows, dllimported
+/// 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 X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV, bool isDirectCall) const
+{
+  if (isTargetDarwin()) {
+    return (!isDirectCall &&
+            (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
+             (GV->isExternal() && !GV->hasNotBeenReadFromBytecode())));
+  } else if (isTargetCygwin() || isTargetWindows()) {
+    return (GV->hasDLLImportLinkage());
+  }
+  
+  return false;
+}
+
 /// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in the
 /// specified arguments.  If we can't run cpuid on the host, return true.
 bool X86::GetCpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX,
index c52979711da4a3d6e503b60723f94b7f25de3105..70e70e901108a25666c00b61918699321ab6e46c 100644 (file)
 #ifndef X86SUBTARGET_H
 #define X86SUBTARGET_H
 
-#include "llvm/GlobalValue.h"
 #include "llvm/Target/TargetSubtarget.h"
 
 #include <string>
 
 namespace llvm {
 class Module;
+class GlobalValue;
 
 class X86Subtarget : public TargetSubtarget {
 public:
@@ -111,18 +111,7 @@ public:
   /// 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, bool isDirectCall) const
-  {
-    if (isTargetDarwin()) {
-      return (!isDirectCall &&
-              (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
-               (GV->isExternal() && !GV->hasNotBeenReadFromBytecode())));
-    } else if (isTargetCygwin() || isTargetWindows()) {
-      return (GV->hasDLLImportLinkage());
-    }
-
-    return false;
-  }
+  bool GVRequiresExtraLoad(const GlobalValue* GV, bool isDirectCall) const;
 };
 
 namespace X86 {