[PATCH] ARM: enable long calls for WoA

Jim Grosbach grosbach at apple.com
Tue Apr 1 12:01:00 PDT 2014


Perhaps a new predicate function like ARMTargetLowering::useLongCalls() that contains the compound check rather than putting it inline here?


On Apr 1, 2014, at 9:40 AM, Saleem Abdulrasool <abdulras at fb.com> wrote:

> Hi t.p.northover, grosbach,
> 
> Enable long calls on WoA.  While this may not be the most efficient approach,
> the MSVC compiler also generates long calls for most scenarios.  Ideally, all
> local symbols would be relaxed during CG to normal calls.  However, in the
> scenario of external symbols, you do not know the required range for the jump,
> and thus require long calls.
> 
> http://llvm-reviews.chandlerc.com/D3247
> 
> Files:
>  lib/Target/ARM/ARMISelLowering.cpp
>  test/CodeGen/ARM/Windows/calls.ll
> 
> Index: lib/Target/ARM/ARMISelLowering.cpp
> ===================================================================
> --- lib/Target/ARM/ARMISelLowering.cpp
> +++ lib/Target/ARM/ARMISelLowering.cpp
> @@ -1645,8 +1645,9 @@
>   bool isLocalARMFunc = false;
>   ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
> 
> -  if (EnableARMLongCalls) {
> -    assert (getTargetMachine().getRelocationModel() == Reloc::Static
> +  if (EnableARMLongCalls || Subtarget->isTargetWindows()) {
> +    assert ((getTargetMachine().getRelocationModel() == Reloc::Static ||
> +             Subtarget->isTargetWindows())
>             && "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
> Index: test/CodeGen/ARM/Windows/calls.ll
> ===================================================================
> --- /dev/null
> +++ test/CodeGen/ARM/Windows/calls.ll
> @@ -0,0 +1,36 @@
> +; RUN: llc -mtriple=thumbv7-windows -mcpu=cortex-a9 -o - %s | FileCheck %s
> +
> +declare void @external()
> +
> +define void @internal() nounwind {
> +entry:
> +  ret void
> +}
> +
> +define void @call_external() nounwind {
> +entry:
> +  tail call void @external()
> +  ret void
> +}
> +
> +define void @call_internal() nounwind {
> +entry:
> +  tail call void @internal()
> +  ret void
> +}
> +
> +; CHECK: call_external:
> +; CHECK: 	ldr	r0, .L[[CPI:[^ ]*]]
> +; CHECK: 	bx	r0
> +; CHECK: .align 2
> +; CHECK: .L[[CPI]]
> +; CHECK: 	.long external
> +
> +; CHECK: call_internal
> +; CHECK: 	ldr	r0, .L[[CPI:[^ ]*]]
> +; FIXME: relax this to a bl function
> +; CHECK: 	bx	r0
> +; CHECK: .align 2
> +; CHECK: .L[[CPI]]
> +; CHECK: 	.long internal
> +
> <D3247.1.patch>




More information about the llvm-commits mailing list