mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
3075bb4222
This commit does two things. Firstly, it adds a collection of flags which can be passed along to the target to encode information about the MBB that an instruction lives in to the outliner. Second, it adds some of those flags to the AArch64 outliner in order to add more stack instructions to the list of legal instructions that are handled by the outliner. The two flags added check if - There are calls in the MachineBasicBlock containing the instruction - The link register is available in the entire block If the link register is available and there are no calls, then a stack instruction can always be outlined without fixups, regardless of what it is, since in this case, the outliner will never modify the stack to create a call or outlined frame. The motivation for doing this was checking which instructions are most often missed by the outliner. Instructions like, say %sp<def> = ADDXri %sp, 32, 0; flags: FrameDestroy are very common, but cannot be outlined in the case that the outliner might modify the stack. This commit allows us to outline instructions like this. llvm-svn: 322048
156 lines
4.0 KiB
YAML
156 lines
4.0 KiB
YAML
# RUN: llc -mtriple=aarch64--- -run-pass=machine-outliner %s -o - | FileCheck %s
|
|
--- |
|
|
|
|
define void @baz() #0 {
|
|
ret void
|
|
}
|
|
|
|
define i32 @main() #0 {
|
|
ret i32 0
|
|
}
|
|
|
|
define void @bar(i32 %a) #0 {
|
|
ret void
|
|
}
|
|
|
|
attributes #0 = { noinline noredzone "no-frame-pointer-elim"="true" }
|
|
...
|
|
---
|
|
# This test ensures that we
|
|
# - Create outlined functions
|
|
# - Don't outline anything to do with LR or W30
|
|
# - Save LR when it's not available
|
|
# - Don't outline stack instructions when we might need to save + restore
|
|
#
|
|
# CHECK-LABEL: name: main
|
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F0:[0-9]+]]
|
|
# CHECK-NEXT: early-clobber %sp, %lr = LDRXpost %sp, 16
|
|
# CHECK-NEXT: %x16 = ADDXri %sp, 48, 0
|
|
# CHECK-NEXT: STRHHroW %w16, %x9, %w30, 1, 1
|
|
# CHECK-NEXT: %lr = ORRXri %xzr, 1
|
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F0]]
|
|
# CHECK-NEXT: early-clobber %sp, %lr = LDRXpost %sp, 16
|
|
# CHECK-NEXT: %x16 = ADDXri %sp, 48, 0
|
|
# CHECK-NEXT: STRHHroW %w16, %x9, %w30, 1, 1
|
|
# CHECK-NEXT: %lr = ORRXri %xzr, 1
|
|
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F0]]
|
|
# CHECK-NEXT: early-clobber %sp, %lr = LDRXpost %sp, 16
|
|
# CHECK-NEXT: %x16 = ADDXri %sp, 48, 0
|
|
# CHECK-NEXT: STRHHroW %w16, %x9, %w30, 1, 1
|
|
# CHECK-NEXT: %lr = ORRXri %xzr, 1
|
|
name: main
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.0:
|
|
%sp = frame-setup SUBXri %sp, 16, 0
|
|
%x9 = ORRXri %xzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w30 = ORRWri %wzr, 1
|
|
%lr = ORRXri %xzr, 1
|
|
|
|
%x20, %x19 = LDPXi %sp, 10
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%x16 = ADDXri %sp, 48, 0;
|
|
STRHHroW %w16, %x9, %w30, 1, 1
|
|
%lr = ORRXri %xzr, 1
|
|
%w3 = ORRWri %wzr, 1993
|
|
|
|
%x20, %x19 = LDPXi %sp, 10
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%x16 = ADDXri %sp, 48, 0;
|
|
STRHHroW %w16, %x9, %w30, 1, 1
|
|
%lr = ORRXri %xzr, 1
|
|
|
|
%w4 = ORRWri %wzr, 1994
|
|
|
|
%x20, %x19 = LDPXi %sp, 10
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%w16 = ORRWri %wzr, 1
|
|
%x16 = ADDXri %sp, 48, 0;
|
|
STRHHroW %w16, %x9, %w30, 1, 1
|
|
%lr = ORRXri %xzr, 1
|
|
|
|
%sp = ADDXri %sp, 16, 0
|
|
RET undef %lr
|
|
|
|
...
|
|
---
|
|
# This test ensures that we can avoid saving LR when it's available.
|
|
# CHECK-LABEL: bb.1:
|
|
# CHECK-NOT: BL @baz, implicit-def dead %lr, implicit %sp
|
|
# CHECK: BL @OUTLINED_FUNCTION_[[F1:[0-9]+]], implicit-def %lr, implicit %sp
|
|
# CHECK-NEXT: %w17 = ORRWri %wzr, 2
|
|
# CHECK-NEXT: BL @OUTLINED_FUNCTION_[[F1]], implicit-def %lr, implicit %sp
|
|
# CHECK-NEXT: %w8 = ORRWri %wzr, 0
|
|
name: bar
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.0:
|
|
liveins: %w0, %lr, %w8
|
|
%sp = frame-setup SUBXri %sp, 32, 0
|
|
%fp = frame-setup ADDXri %sp, 16, 0
|
|
|
|
bb.1:
|
|
BL @baz, implicit-def dead %lr, implicit %sp
|
|
%w17 = ORRWri %wzr, 1
|
|
%w17 = ORRWri %wzr, 1
|
|
%w17 = ORRWri %wzr, 1
|
|
%w17 = ORRWri %wzr, 1
|
|
BL @baz, implicit-def dead %lr, implicit %sp
|
|
%w17 = ORRWri %wzr, 2
|
|
BL @baz, implicit-def dead %lr, implicit %sp
|
|
%w17 = ORRWri %wzr, 1
|
|
%w17 = ORRWri %wzr, 1
|
|
%w17 = ORRWri %wzr, 1
|
|
%w17 = ORRWri %wzr, 1
|
|
BL @baz, implicit-def dead %lr, implicit %sp
|
|
%w8 = ORRWri %wzr, 0
|
|
|
|
bb.2:
|
|
%w15 = ORRWri %wzr, 1
|
|
%w15 = ORRWri %wzr, 1
|
|
%w15 = ORRWri %wzr, 1
|
|
%w15 = ORRWri %wzr, 1
|
|
%x15 = ADDXri %sp, 48, 0;
|
|
%w9 = ORRWri %wzr, 0
|
|
%w15 = ORRWri %wzr, 1
|
|
%w15 = ORRWri %wzr, 1
|
|
%w15 = ORRWri %wzr, 1
|
|
%w15 = ORRWri %wzr, 1
|
|
%x15 = ADDXri %sp, 48, 0;
|
|
%w8 = ORRWri %wzr, 0
|
|
|
|
bb.3:
|
|
%fp, %lr = LDPXi %sp, 2
|
|
%sp = ADDXri %sp, 32, 0
|
|
RET undef %lr
|
|
|
|
...
|
|
---
|
|
name: baz
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.0:
|
|
liveins: %w0, %lr, %w8
|
|
RET undef %lr
|
|
|
|
# CHECK-LABEL: name: OUTLINED_FUNCTION_{{[0-9]}}
|
|
# CHECK=LABEL: name: OUTLINED_FUNCTION_{{[1-9]}}
|