2009-12-07 20:04:31 +01:00
|
|
|
; RUN: llc < %s -tailcallopt -march=x86-64 -post-RA-scheduler=true | FileCheck %s
|
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).
|
|
|
|
; CHECK: movl %edi, %eax
|
|
|
|
; Move param %in1 to temp register (%r10d).
|
|
|
|
; CHECK: movl 40(%rsp), %r10d
|
2009-11-13 02:01:58 +01:00
|
|
|
; Move param %in2 to stack.
|
|
|
|
; CHECK: movl %r10d, 32(%rsp)
|
2009-11-17 00:43:42 +01:00
|
|
|
; Move result of addition to stack.
|
|
|
|
; CHECK: movl %eax, 40(%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
|
|
|
|
}
|
|
|
|
|