summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-09 03:27:27 +0000
committerChris Lattner <sabre@nondot.org>2009-07-09 03:27:27 +0000
commit821084a356df68f8a99e464c63bd1a41d938cfaa (patch)
treec7c544136eebcc93aadc74d38ed80d83ca618800 /llvm
parent1c5bf9d26dda6aff271f5998f3b8e4dcb90d29c3 (diff)
downloadbcm5719-llvm-821084a356df68f8a99e464c63bd1a41d938cfaa.tar.gz
bcm5719-llvm-821084a356df68f8a99e464c63bd1a41d938cfaa.zip
Reduce indentation in GVRequiresExtraLoad. Return true for windows
with DLLImport symbols even when in -static mode. llvm-svn: 75093
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/X86/X86Subtarget.cpp54
1 files changed, 28 insertions, 26 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index 8506fa66a64..e4cd288470e 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -40,32 +40,34 @@ 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,
const TargetMachine& TM,
- bool isDirectCall) const
-{
- // FIXME: PIC
- if (TM.getRelocationModel() != Reloc::Static &&
- TM.getCodeModel() != CodeModel::Large) {
- if (isTargetDarwin()) {
- if (isDirectCall)
- return false;
- bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
- if (GV->hasHiddenVisibility() &&
- (Is64Bit || (!isDecl && !GV->hasCommonLinkage())))
- // If symbol visibility is hidden, the extra load is not needed if
- // target is x86-64 or the symbol is definitely defined in the current
- // translation unit.
- return false;
- return !isDirectCall && (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;
- } else if (isTargetCygMing() || isTargetWindows()) {
- return (GV->hasDLLImportLinkage());
- }
+ bool isDirectCall) 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())
+ return GV->hasDLLImportLinkage();
+
+ if (TM.getRelocationModel() == Reloc::Static ||
+ TM.getCodeModel() == CodeModel::Large)
+ return false;
+
+ if (isTargetDarwin()) {
+ if (isDirectCall)
+ return false;
+ bool isDecl = GV->isDeclaration() && !GV->hasNotBeenReadFromBitcode();
+ if (GV->hasHiddenVisibility() &&
+ (Is64Bit || (!isDecl && !GV->hasCommonLinkage())))
+ // If symbol visibility is hidden, the extra load is not needed if
+ // target is x86-64 or the symbol is definitely defined in the current
+ // translation unit.
+ return false;
+ return !isDirectCall && (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;
}
return false;
}
OpenPOWER on IntegriCloud