diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2006-11-30 22:42:55 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2006-11-30 22:42:55 +0000 |
commit | 6dbdfe2baae95b4e203d557c586a244ccdd60c09 (patch) | |
tree | b8cda0f30b5cebe02aa149fa815c433bef49e436 /llvm/lib/Target/X86/X86Subtarget.cpp | |
parent | 6104a1aa9e10c94db5e6f4783decc0d5023fd1eb (diff) | |
download | bcm5719-llvm-6dbdfe2baae95b4e203d557c586a244ccdd60c09.tar.gz bcm5719-llvm-6dbdfe2baae95b4e203d557c586a244ccdd60c09.zip |
Factor out GVRequiresExtraLoad() from .h to .cpp
llvm-svn: 32048
Diffstat (limited to 'llvm/lib/Target/X86/X86Subtarget.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86Subtarget.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp index ea185b98e82..2459ed122c0 100644 --- a/llvm/lib/Target/X86/X86Subtarget.cpp +++ b/llvm/lib/Target/X86/X86Subtarget.cpp @@ -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, |