[llvm] r272901 - Refactor duplicated code. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 08:22:02 PDT 2016


Author: rafael
Date: Thu Jun 16 10:22:01 2016
New Revision: 272901

URL: http://llvm.org/viewvc/llvm-project?rev=272901&view=rev
Log:
Refactor duplicated code. NFC.

Modified:
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=272901&r1=272900&r2=272901&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Thu Jun 16 10:22:01 2016
@@ -1795,6 +1795,10 @@ ARMTargetLowering::LowerCall(TargetLower
   // direct call is) turn it into a TargetGlobalAddress/TargetExternalSymbol
   // node so that legalize doesn't hack it.
   bool isDirect = false;
+
+  const TargetMachine &TM = getTargetMachine();
+  Reloc::Model RM = TM.getRelocationModel();
+
   bool isARMFunc = false;
   bool isLocalARMFunc = false;
   ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
@@ -1802,7 +1806,7 @@ ARMTargetLowering::LowerCall(TargetLower
 
   if (Subtarget->genLongCalls()) {
     assert((Subtarget->isTargetWindows() ||
-            getTargetMachine().getRelocationModel() == Reloc::Static) &&
+            RM == Reloc::Static) &&
            "long-calls with non-static relocation model!");
     // Handle a global address or an external symbol. If it's not one of
     // those, the target's already in a register, so we don't need to do
@@ -1841,8 +1845,6 @@ ARMTargetLowering::LowerCall(TargetLower
     const GlobalValue *GV = G->getGlobal();
     isDirect = true;
     bool isDef = GV->isStrongDefinitionForLinker();
-    const TargetMachine &TM = getTargetMachine();
-    Reloc::Model RM = TM.getRelocationModel();
     const Triple &TargetTriple = TM.getTargetTriple();
     bool isStub =
         !shouldAssumeDSOLocal(RM, TargetTriple, *GV->getParent(), GV) &&




More information about the llvm-commits mailing list