2011-01-26 02:04:09 +00:00
|
|
|
; RUN: llc < %s -tailcallopt -mtriple=x86_64-linux -post-RA-scheduler=true | FileCheck %s
|
|
|
|
; RUN: llc < %s -tailcallopt -mtriple=x86_64-win32 -post-RA-scheduler=true | FileCheck %s
|
|
|
|
|
|
|
|
; FIXME: Redundant unused stack allocation could be eliminated.
|
2011-02-27 08:47:19 +00:00
|
|
|
; CHECK: subq ${{24|72}}, %rsp
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
|
2008-04-30 09:19:47 +00:00
|
|
|
; Check that lowered arguments on the stack do not overwrite each other.
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
; Add %in1 %p1 to a different temporary register (%eax).
|
2011-01-26 02:04:09 +00:00
|
|
|
; CHECK: movl [[A1:32|144]](%rsp), %eax
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
; Move param %in1 to temp register (%r10d).
|
2011-01-26 02:04:09 +00:00
|
|
|
; CHECK: movl [[A2:40|152]](%rsp), %r10d
|
2010-06-21 22:17:20 +00:00
|
|
|
; Add %in1 %p1 to a different temporary register (%eax).
|
2011-01-26 02:04:09 +00:00
|
|
|
; CHECK: addl {{%edi|%ecx}}, %eax
|
2009-11-13 01:01:58 +00:00
|
|
|
; Move param %in2 to stack.
|
2011-01-26 02:04:09 +00:00
|
|
|
; CHECK: movl %r10d, [[A1]](%rsp)
|
2009-11-16 23:43:42 +00:00
|
|
|
; Move result of addition to stack.
|
2011-01-26 02:04:09 +00:00
|
|
|
; CHECK: movl %eax, [[A2]](%rsp)
|
Major calling convention code refactoring.
Instead of awkwardly encoding calling-convention information with ISD::CALL,
ISD::FORMAL_ARGUMENTS, ISD::RET, and ISD::ARG_FLAGS nodes, TargetLowering
provides three virtual functions for targets to override:
LowerFormalArguments, LowerCall, and LowerRet, which replace the custom
lowering done on the special nodes. They provide the same information, but
in a more immediately usable format.
This also reworks much of the target-independent tail call logic. The
decision of whether or not to perform a tail call is now cleanly split
between target-independent portions, and the target dependent portion
in IsEligibleForTailCallOptimization.
This also synchronizes all in-tree targets, to help enable future
refactoring and feature work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05 01:29:28 +00:00
|
|
|
; Eventually, do a TAILCALL
|
|
|
|
; CHECK: TAILCALL
|
2008-04-30 09:19:47 +00:00
|
|
|
|
2009-10-18 19:57:27 +00:00
|
|
|
declare fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %a, i32 %b) nounwind
|
2008-04-30 09:19:47 +00:00
|
|
|
|
2009-10-18 19:57:27 +00:00
|
|
|
define fastcc i32 @tailcaller(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in1, i32 %in2) nounwind {
|
2008-04-30 09:19:47 +00:00
|
|
|
entry:
|
|
|
|
%tmp = add i32 %in1, %p1
|
2009-06-12 16:26:57 +00:00
|
|
|
%retval = tail call fastcc i32 @tailcallee(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5, i32 %p6, i32 %in2,i32 %tmp)
|
2008-04-30 09:19:47 +00:00
|
|
|
ret i32 %retval
|
|
|
|
}
|