From cb6c7a518520f8d0a1b76e8fb92ef3a29c7fb53c Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 16 Jun 2016 15:40:24 +0000 Subject: [PATCH] Refactor duplicated code. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272904 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMISelLowering.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 4ef14ade068..ce7a7693d9b 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -1798,9 +1798,14 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, const TargetMachine &TM = getTargetMachine(); Reloc::Model RM = TM.getRelocationModel(); + const Triple &TargetTriple = TM.getTargetTriple(); + const Module *Mod = MF.getFunction()->getParent(); const GlobalValue *GV = nullptr; if (GlobalAddressSDNode *G = dyn_cast(Callee)) GV = G->getGlobal(); + bool isStub = + !shouldAssumeDSOLocal(RM, TargetTriple, *Mod, GV) && + Subtarget->isTargetMachO(); bool isARMFunc = false; bool isLocalARMFunc = false; @@ -1846,10 +1851,6 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, } else if (isa(Callee)) { isDirect = true; bool isDef = GV->isStrongDefinitionForLinker(); - const Triple &TargetTriple = TM.getTargetTriple(); - bool isStub = - !shouldAssumeDSOLocal(RM, TargetTriple, *GV->getParent(), GV) && - Subtarget->isTargetMachO(); isARMFunc = !Subtarget->isThumb() || (isStub && !Subtarget->isMClass()); // ARM call to a local ARM function is predicable. @@ -1887,8 +1888,6 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, } } else if (ExternalSymbolSDNode *S = dyn_cast(Callee)) { isDirect = true; - bool isStub = Subtarget->isTargetMachO() && - getTargetMachine().getRelocationModel() != Reloc::Static; isARMFunc = !Subtarget->isThumb() || (isStub && !Subtarget->isMClass()); // tBX takes a register source operand. const char *Sym = S->getSymbol(); -- 2.50.1