diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2006-12-20 01:03:20 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2006-12-20 01:03:20 +0000 |
commit | 93acb49182767055967c4cc812796e2772e3a989 (patch) | |
tree | 2823f7182f57863275b8c69af296181ec4ba849e /llvm/lib/Target/X86/X86Subtarget.cpp | |
parent | 00bb216977a4a1a4db60b30263fe9b19fa7fa0d7 (diff) | |
download | bcm5719-llvm-93acb49182767055967c4cc812796e2772e3a989.tar.gz bcm5719-llvm-93acb49182767055967c4cc812796e2772e3a989.zip |
Fixed dllimported symbols support during JIT'ing. JIT on mingw32
platform should be more or less workable. At least, sim is running fine
under lli :)
llvm-svn: 32711
Diffstat (limited to 'llvm/lib/Target/X86/X86Subtarget.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86Subtarget.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp index ff88fdbca26..5281dcda7aa 100644 --- a/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/llvm/lib/Target/X86/X86Subtarget.cpp @@ -32,13 +32,14 @@ AsmWriterFlavor("x86-asm-syntax", cl::init(X86Subtarget::unset), /// 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()); - } + if (GenerateExtraLoadsForGVs) + if (isTargetDarwin()) { + return (!isDirectCall && + (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || + (GV->isExternal() && !GV->hasNotBeenReadFromBytecode()))); + } else if (isTargetCygwin() || isTargetWindows()) { + return (GV->hasDLLImportLinkage()); + } return false; } @@ -206,6 +207,15 @@ static const char *GetCurrentX86CPU() { } } +/// 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) @@ -214,6 +224,7 @@ X86Subtarget::X86Subtarget(const Module &M, const std::string &FS, bool is64Bit) // 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 |