mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
d817281f2c
As the extern_weak target might be missing, resolving to the absolute address zero, we can't use the normal direct PC-relative branch instructions (as that would result in relocations out of range). Improve the classifyGlobalFunctionReference method to set MO_DLLIMPORT/MO_COFFSTUB, and simplify the existing code in AArch64TargetLowering::LowerCall to use the return value from classifyGlobalFunctionReference for these cases. Add code in both AArch64FastISel and GlobalISel/IRTranslator to bail out for function calls to extern weak functions on windows, to let SelectionDAG handle them. This matches what was done for X86 in 6bf108d77a3c. Differential Revision: https://reviews.llvm.org/D71721
28 lines
756 B
LLVM
28 lines
756 B
LLVM
; RUN: llc -mtriple aarch64-windows -filetype asm -o - < %s | FileCheck %s
|
|
; RUN: llc -mtriple aarch64-windows -filetype asm -o - -fast-isel %s | FileCheck %s
|
|
; RUN: llc -mtriple aarch64-windows -filetype asm -o - -global-isel -global-isel-abort=0 %s | FileCheck %s
|
|
|
|
define void @func() {
|
|
; CHECK-LABEL: func:
|
|
; CHECK: str x30, [sp, #-16]!
|
|
; CHECK-NEXT: adrp x8, .refptr.weakfunc
|
|
; CHECK-NEXT: ldr x8, [x8, .refptr.weakfunc]
|
|
; CHECK-NEXT: cbz x8, .LBB0_2
|
|
; CHECK-NEXT: ; %bb.1:
|
|
; CHECK-NEXT: blr x8
|
|
; CHECK-NEXT: .LBB0_2:
|
|
; CHECK-NEXT: ldr x30, [sp], #16
|
|
; CHECK-NEXT: ret
|
|
|
|
br i1 icmp ne (void ()* @weakfunc, void ()* null), label %1, label %2
|
|
|
|
1:
|
|
call void @weakfunc()
|
|
br label %2
|
|
|
|
2:
|
|
ret void
|
|
}
|
|
|
|
declare extern_weak void @weakfunc()
|