mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
6a7770b7ae
This changes the SelectionDAG scheduling preference to source order. Soon, the SelectionDAG scheduler can be bypassed saving a nice chunk of compile time. Performance differences that result from this change are often a consequence of register coalescing. The register coalescer is far from perfect. Bugs can be filed for deficiencies. On x86 SandyBridge/Haswell, the source order schedule is often preserved, particularly for small blocks. Register pressure is generally improved over the SD scheduler's ILP mode. However, we are still able to handle large blocks that require latency hiding, unlike the SD scheduler's BURR mode. MI scheduler also attempts to discover the critical path in single-block loops and adjust heuristics accordingly. The MI scheduler relies on the new machine model. This is currently unimplemented for AVX, so we may not be generating the best code yet. Unit tests are updated so they don't depend on SD scheduling heuristics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192750 91177308-0d34-0410-b5e6-96231b3b80d8
72 lines
2.7 KiB
LLVM
72 lines
2.7 KiB
LLVM
; RUN: llc < %s -mtriple=x86_64-linux-gnu -tailcallopt -code-model=large -enable-misched=false | FileCheck %s
|
|
|
|
declare fastcc i32 @callee(i32 %arg)
|
|
define fastcc i32 @directcall(i32 %arg) {
|
|
entry:
|
|
; This is the large code model, so &callee may not fit into the jmp
|
|
; instruction. Instead, stick it into a register.
|
|
; CHECK: movabsq $callee, [[REGISTER:%r[a-z0-9]+]]
|
|
; CHECK: jmpq *[[REGISTER]] # TAILCALL
|
|
%res = tail call fastcc i32 @callee(i32 %arg)
|
|
ret i32 %res
|
|
}
|
|
|
|
; Check that the register used for an indirect tail call doesn't
|
|
; clobber any of the arguments.
|
|
define fastcc i32 @indirect_manyargs(i32(i32,i32,i32,i32,i32,i32,i32)* %target) {
|
|
; Adjust the stack to enter the function. (The amount of the
|
|
; adjustment may change in the future, in which case the location of
|
|
; the stack argument and the return adjustment will change too.)
|
|
; CHECK: pushq
|
|
; Put the call target into R11, which won't be clobbered while restoring
|
|
; callee-saved registers and won't be used for passing arguments.
|
|
; CHECK: movq %rdi, %rax
|
|
; Pass the stack argument.
|
|
; CHECK: movl $7, 16(%rsp)
|
|
; Pass the register arguments, in the right registers.
|
|
; CHECK: movl $1, %edi
|
|
; CHECK: movl $2, %esi
|
|
; CHECK: movl $3, %edx
|
|
; CHECK: movl $4, %ecx
|
|
; CHECK: movl $5, %r8d
|
|
; CHECK: movl $6, %r9d
|
|
; Adjust the stack to "return".
|
|
; CHECK: popq
|
|
; And tail-call to the target.
|
|
; CHECK: jmpq *%rax # TAILCALL
|
|
%res = tail call fastcc i32 %target(i32 1, i32 2, i32 3, i32 4, i32 5,
|
|
i32 6, i32 7)
|
|
ret i32 %res
|
|
}
|
|
|
|
; Check that the register used for a direct tail call doesn't clobber
|
|
; any of the arguments.
|
|
declare fastcc i32 @manyargs_callee(i32,i32,i32,i32,i32,i32,i32)
|
|
define fastcc i32 @direct_manyargs() {
|
|
; Adjust the stack to enter the function. (The amount of the
|
|
; adjustment may change in the future, in which case the location of
|
|
; the stack argument and the return adjustment will change too.)
|
|
; CHECK: pushq
|
|
; Pass the stack argument.
|
|
; CHECK: movl $7, 16(%rsp)
|
|
; This is the large code model, so &manyargs_callee may not fit into
|
|
; the jmp instruction. Put it into a register which won't be clobbered
|
|
; while restoring callee-saved registers and won't be used for passing
|
|
; arguments.
|
|
; CHECK: movabsq $manyargs_callee, %rax
|
|
; Pass the register arguments, in the right registers.
|
|
; CHECK: movl $1, %edi
|
|
; CHECK: movl $2, %esi
|
|
; CHECK: movl $3, %edx
|
|
; CHECK: movl $4, %ecx
|
|
; CHECK: movl $5, %r8d
|
|
; CHECK: movl $6, %r9d
|
|
; Adjust the stack to "return".
|
|
; CHECK: popq
|
|
; And tail-call to the target.
|
|
; CHECK: jmpq *%rax # TAILCALL
|
|
%res = tail call fastcc i32 @manyargs_callee(i32 1, i32 2, i32 3, i32 4,
|
|
i32 5, i32 6, i32 7)
|
|
ret i32 %res
|
|
}
|