Refactored JIT codegen for mingw32. Now we're using standart relocation
type for distinguish JIT & non-JIT instead of "dirty" hacks :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32745 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp
index 4ab8713..05965c2 100644
--- a/lib/Target/X86/X86Subtarget.cpp
+++ b/lib/Target/X86/X86Subtarget.cpp
@@ -15,6 +15,7 @@
#include "X86GenSubtarget.inc"
#include "llvm/Module.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Target/TargetMachine.h"
using namespace llvm;
cl::opt<X86Subtarget::AsmWriterFlavorTy>
@@ -31,9 +32,10 @@
/// 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
{
- if (GenerateExtraLoadsForGVs)
+ if (TM.getRelocationModel() != Reloc::Static)
if (isTargetDarwin()) {
return (!isDirectCall &&
(GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
@@ -208,16 +210,6 @@
}
}
-/// SetJITMode - This is called to inform the subtarget info that we are
-/// producing code for the JIT.
-void X86Subtarget::SetJITMode()
-{
- // JIT mode doesn't want extra loads for dllimported symbols, it knows exactly
- // where everything is.
- if (isTargetCygwin())
- GenerateExtraLoadsForGVs = false;
-}
-
X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit)
: AsmFlavor(AsmWriterFlavor)
, X86SSELevel(NoMMXSSE)
@@ -226,7 +218,6 @@
// FIXME: this is a known good value for Yonah. How about others?
, MinRepStrSizeThreshold(128)
, Is64Bit(is64Bit)
- , GenerateExtraLoadsForGVs(true)
, TargetType(isELF) { // Default to ELF unless otherwise specified.
// Determine default and user specified characteristics