diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-06-16 15:31:06 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-06-16 15:31:06 +0000 |
commit | c24f0eeb8df9abac9e0402cec8b345694ff94ec8 (patch) | |
tree | db40385c01ff6316606e41eb1174cd5fe710c0d9 /llvm/lib | |
parent | 85bc3f83f4b33227db66773ecba679a849301c81 (diff) | |
download | bcm5719-llvm-c24f0eeb8df9abac9e0402cec8b345694ff94ec8.tar.gz bcm5719-llvm-c24f0eeb8df9abac9e0402cec8b345694ff94ec8.zip |
Refactor duplicated code. NFC.
llvm-svn: 272903
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/ARM/ARMISelLowering.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp index 021c870c624..4ef14ade068 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -1798,6 +1798,9 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, const TargetMachine &TM = getTargetMachine(); Reloc::Model RM = TM.getRelocationModel(); + const GlobalValue *GV = nullptr; + if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) + GV = G->getGlobal(); bool isARMFunc = false; bool isLocalARMFunc = false; @@ -1811,8 +1814,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, // 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 // anything extra. - if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) { - const GlobalValue *GV = G->getGlobal(); + if (isa<GlobalAddressSDNode>(Callee)) { // Create a constant pool entry for the callee address unsigned ARMPCLabelIndex = AFI->createPICLabelUId(); ARMConstantPoolValue *CPV = @@ -1841,8 +1843,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, MachinePointerInfo::getConstantPool(DAG.getMachineFunction()), false, false, false, 0); } - } else if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) { - const GlobalValue *GV = G->getGlobal(); + } else if (isa<GlobalAddressSDNode>(Callee)) { isDirect = true; bool isDef = GV->isStrongDefinitionForLinker(); const Triple &TargetTriple = TM.getTargetTriple(); |