2012-02-02 00:20:51 +01: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 03:04:09 +01:00
|
|
|
|
|
|
|
; FIXME: Redundant unused stack allocation could be eliminated.
|
2011-06-04 00:45:21 +02: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 03:29:28 +02:00
|
|
|
|
2008-04-30 11:19:47 +02: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 03:29:28 +02:00
|
|
|
; Add %in1 %p1 to a different temporary register (%eax).
|
2011-04-05 02:32:44 +02: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 03:29:28 +02:00
|
|
|
; Move param %in1 to temp register (%r10d).
|
2011-04-05 02:32:44 +02:00
|
|
|
; CHECK: movl [[A2:40|152]](%rsp), [[R2:%[a-z0-9]+]]
|
2010-06-22 00:17:20 +02:00
|
|
|
; Add %in1 %p1 to a different temporary register (%eax).
|
2011-04-05 02:32:44 +02:00
|
|
|
; CHECK: addl {{%edi|%ecx}}, [[R1]]
|
2009-11-13 02:01:58 +01:00
|
|
|
; Move param %in2 to stack.
|
2011-04-05 02:32:44 +02:00
|
|
|
; CHECK: movl [[R2]], [[A1]](%rsp)
|
2009-11-17 00:43:42 +01:00
|
|
|
; Move result of addition to stack.
|
2011-04-05 02:32:44 +02: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 03:29:28 +02:00
|
|
|
; Eventually, do a TAILCALL
|
|
|
|
; CHECK: TAILCALL
|
2008-04-30 11:19:47 +02:00
|
|
|
|
2009-10-18 21:57:27 +02: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 11:19:47 +02:00
|
|
|
|
2009-10-18 21:57:27 +02: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 11:19:47 +02:00
|
|
|
entry:
|
|
|
|
%tmp = add i32 %in1, %p1
|
2009-06-12 18:26:57 +02: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 11:19:47 +02:00
|
|
|
ret i32 %retval
|
|
|
|
}
|