[llvm] r210399 - ARM: correct assertion for long-calls on WoA

Saleem Abdulrasool compnerd at compnerd.org
Sat Jun 7 13:29:27 PDT 2014


Author: compnerd
Date: Sat Jun  7 15:29:27 2014
New Revision: 210399

URL: http://llvm.org/viewvc/llvm-project?rev=210399&view=rev
Log:
ARM: correct assertion for long-calls on WoA

COFF/PE, so the relocation model is never static.  Loosen the assertion
accordingly.  The relocation can still be emitted properly, as it will be
converted to an IMAGE_REL_ARM_ADDR32 which will be resolved by the loader
taking the base relocation into account.  This is necessary to permit the
emission of long calls which can be controlled via the -mlong-calls option in
the driver.

Added:
    llvm/trunk/test/CodeGen/ARM/Windows/long-calls.ll
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=210399&r1=210398&r2=210399&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Sat Jun  7 15:29:27 2014
@@ -1598,8 +1598,9 @@ ARMTargetLowering::LowerCall(TargetLower
   ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
 
   if (EnableARMLongCalls) {
-    assert (getTargetMachine().getRelocationModel() == Reloc::Static
-            && "long-calls with non-static relocation model!");
+    assert((Subtarget->isTargetWindows() ||
+            getTargetMachine().getRelocationModel() == 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
     // anything extra.

Added: llvm/trunk/test/CodeGen/ARM/Windows/long-calls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/Windows/long-calls.ll?rev=210399&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/Windows/long-calls.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/Windows/long-calls.ll Sat Jun  7 15:29:27 2014
@@ -0,0 +1,18 @@
+; RUN: llc -mtriple=thumbv7-windows -mcpu=cortex-a9 -arm-long-calls -o - %s \
+; RUN:    | FileCheck %s
+
+declare arm_aapcs_vfpcc void @callee()
+
+define arm_aapcs_vfpcc void @caller() nounwind {
+entry:
+  tail call void @callee()
+  ret void
+}
+
+; CHECK-LABEL: caller
+; CHECK: ldr [[REG:r[0-9]+]], [[CPI:.LCPI[_0-9]+]]
+; CHECK: bx [[REG]]
+; CHECK: .align 2
+; CHECK: [[CPI]]:
+; CHECK: .long callee
+





More information about the llvm-commits mailing list