2012-02-02 07:20:51 +08:00
|
|
|
; RUN: llc < %s -tailcallopt -mcpu=generic -mtriple=x86_64-linux -post-RA-scheduler=true | FileCheck %s
|
|
|
|
; RUN: llc < %s -tailcallopt -mcpu=generic -mtriple=x86_64-win32 -post-RA-scheduler=true | FileCheck %s
|
2011-01-26 10:04:09 +08:00
|
|
|
|
|
|
|
; FIXME: Redundant unused stack allocation could be eliminated.
|
2011-06-04 06:45:21 +08:00
|
|
|
; CHECK: subq ${{24|72|80}}, %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.
llvm-svn: 78142
2009-08-05 09:29:28 +08:00
|
|
|
|
2008-04-30 17:19:47 +08: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.
llvm-svn: 78142
2009-08-05 09:29:28 +08:00
|
|
|
; Add %in1 %p1 to a different temporary register (%eax).
|
2011-04-05 08:32:44 +08:00
|
|
|
; CHECK: movl [[A1:32|144]](%rsp), [[R1:%e..]]
|
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.
llvm-svn: 78142
2009-08-05 09:29:28 +08:00
|
|
|
; Move param %in1 to temp register (%r10d).
|
2011-04-05 08:32:44 +08:00
|
|
|
; CHECK: movl [[A2:40|152]](%rsp), [[R2:%[a-z0-9]+]]
|
2010-06-22 06:17:20 +08:00
|
|
|
; Add %in1 %p1 to a different temporary register (%eax).
|
2011-04-05 08:32:44 +08:00
|
|
|
; CHECK: addl {{%edi|%ecx}}, [[R1]]
|
2009-11-13 09:01:58 +08:00
|
|
|
; Move param %in2 to stack.
|
2011-04-05 08:32:44 +08:00
|
|
|
; CHECK: movl [[R2]], [[A1]](%rsp)
|
2009-11-17 07:43:42 +08:00
|
|
|
; Move result of addition to stack.
|
2011-04-05 08:32:44 +08:00
|
|
|
; CHECK: movl [[R1]], [[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.
llvm-svn: 78142
2009-08-05 09:29:28 +08:00
|
|
|
; Eventually, do a TAILCALL
|
|
|
|
; CHECK: TAILCALL
|
2008-04-30 17:19:47 +08:00
|
|
|
|
2009-10-19 03:57:27 +08: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 17:19:47 +08:00
|
|
|
|
2009-10-19 03:57:27 +08: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 17:19:47 +08:00
|
|
|
entry:
|
|
|
|
%tmp = add i32 %in1, %p1
|
2009-06-13 00:26:57 +08: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 17:19:47 +08:00
|
|
|
ret i32 %retval
|
|
|
|
}
|