summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86Subtarget.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-12-05 21:47:27 +0000
committerDale Johannesen <dalej@apple.com>2008-12-05 21:47:27 +0000
commit9efd2ce55bc3525950f815fb240061e88d6e0073 (patch)
treeba1abfe2df131d52c7fbf6ff1bd6106c38d292a4 /llvm/lib/Target/X86/X86Subtarget.cpp
parent0e3d6337c6418c56b9e88e05c6d38819cfd0bd92 (diff)
downloadbcm5719-llvm-9efd2ce55bc3525950f815fb240061e88d6e0073.tar.gz
bcm5719-llvm-9efd2ce55bc3525950f815fb240061e88d6e0073.zip
Make LoopStrengthReduce smarter about hoisting things out of
loops when they can be subsumed into addressing modes. Change X86 addressing mode check to realize that some PIC references need an extra register. (I believe this is correct for Linux, if not, I'm sure someone will tell me.) llvm-svn: 60608
Diffstat (limited to 'llvm/lib/Target/X86/X86Subtarget.cpp')
-rw-r--r--llvm/lib/Target/X86/X86Subtarget.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index b836471afc1..583fe8a0fbe 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -59,7 +59,23 @@ bool X86Subtarget::GVRequiresExtraLoad(const GlobalValue* GV,
return (GV->hasDLLImportLinkage());
}
}
-
+ return false;
+}
+
+/// True if accessing the GV requires a register. This is a superset of the
+/// cases where GVRequiresExtraLoad is true. Some variations of PIC require
+/// a register, but not an extra load.
+bool X86Subtarget::GVRequiresRegister(const GlobalValue *GV,
+ const TargetMachine& TM,
+ bool isDirectCall) const
+{
+ if (GVRequiresExtraLoad(GV, TM, isDirectCall))
+ return true;
+ // Code below here need only consider cases where GVRequiresExtraLoad
+ // returns false.
+ if (TM.getRelocationModel() == Reloc::PIC_)
+ return !isDirectCall &&
+ (GV->hasInternalLinkage() || GV->hasExternalLinkage());
return false;
}
OpenPOWER on IntegriCloud