aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-09 02:46:53 +0000
committerChris Lattner <sabre@nondot.org>2009-07-09 02:46:53 +0000
commite3ee6f1e1fcd61a9a0f3297848e73bd55b42a97d (patch)
tree53029f8d9cccc2de7f82e1f6e4e5ede50bc2a25a
parent951bf7d74f12b6dacfb2691c90603916b9bfd93f (diff)
hoist check for IsTailCall to callers. Eliminate redundant check for
x86-64: GOT-style PIC is never used on x86-64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75090 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index a024d10200..3889e61acf 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -1321,22 +1321,18 @@ X86TargetLowering::NameDecorationForFORMAL_ARGUMENTS(SDValue Op) {
/// CallRequiresGOTInRegister - Check whether the call requires the GOT pointer
/// in a register before calling.
-static bool CallRequiresGOTPtrInReg(const TargetMachine &TM,
- bool IsTailCall) {
+static bool CallRequiresGOTPtrInReg(const TargetMachine &TM) {
const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
- return !IsTailCall && !Subtarget.is64Bit() &&
- TM.getRelocationModel() == Reloc::PIC_ &&
+ return TM.getRelocationModel() == Reloc::PIC_ &&
Subtarget.isPICStyleGOT();
}
/// CallRequiresFnAddressInReg - Check whether the call requires the function
/// address to be loaded in a register.
-static bool CallRequiresFnAddressInReg(const TargetMachine &TM,
- bool IsTailCall) {
+static bool CallRequiresFnAddressInReg(const TargetMachine &TM) {
const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
- return !Subtarget.is64Bit() && IsTailCall &&
- TM.getRelocationModel() == Reloc::PIC_ &&
+ return TM.getRelocationModel() == Reloc::PIC_ &&
Subtarget.isPICStyleGOT();
}
@@ -1808,7 +1804,7 @@ SDValue X86TargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
// ELF / PIC requires GOT in the EBX register before function calls via PLT
// GOT pointer.
- if (CallRequiresGOTPtrInReg(getTargetMachine(), IsTailCall)) {
+ if (!IsTailCall && CallRequiresGOTPtrInReg(getTargetMachine())) {
Chain = DAG.getCopyToReg(Chain, dl, X86::EBX,
DAG.getNode(X86ISD::GlobalBaseReg,
DebugLoc::getUnknownLoc(),
@@ -1823,7 +1819,7 @@ SDValue X86TargetLowering::LowerCALL(SDValue Op, SelectionDAG &DAG) {
// calls on PIC/GOT architectures. Normally we would just put the address of
// GOT into ebx and then call target@PLT. But for tail calls ebx would be
// restored (since ebx is callee saved) before jumping to the target@PLT.
- if (CallRequiresFnAddressInReg(getTargetMachine(), IsTailCall)) {
+ if (IsTailCall && CallRequiresFnAddressInReg(getTargetMachine())) {
// Note: The actual moving to ecx is done further down.
GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee);
if (G && !G->getGlobal()->hasHiddenVisibility() &&