* PATCH ARM -- clean up sibcalls
@ 2002-07-29 6:24 Richard Earnshaw
0 siblings, 0 replies; only message in thread
From: Richard Earnshaw @ 2002-07-29 6:24 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard.Earnshaw
[-- Attachment #1: Type: text/plain, Size: 637 bytes --]
This patch cleans up sibling call generation so that we don't
unnecessarily clobber the return register, this means that simple
tail-calling functions may not have to save any registers at all, eg before
int foo(int);
int bar ()
{
foo(1);
}
was compiled as
bar:
str lr, [sp, #-4]!
mov r0, #1
ldr lr, [sp], #4
b foo
We now get
bar:
mov r0, #1
b foo
2002-07-29 Richard Earnshaw <rearnsha@arm.com>
* arm.md (sibcall, sibcall_value): Add RETURN as part of the pattern,
remove clobber of LR.
(sibcall_insn, sibcall_value_insn): Update accordingly.
(sibcall_epilogue): Remove debugging comment from assembler stream.
[-- Attachment #2: gcc-tailcall.patch --]
[-- Type: text/x-patch , Size: 3022 bytes --]
Index: arm.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.md,v
retrieving revision 1.103
diff -p -r1.103 arm.md
*** arm.md 24 Jul 2002 18:29:00 -0000 1.103
--- arm.md 29 Jul 2002 12:37:38 -0000
***************
*** 6691,6698 ****
(define_expand "sibcall"
[(parallel [(call (match_operand 0 "memory_operand" "")
(match_operand 1 "general_operand" ""))
! (use (match_operand 2 "" ""))
! (use (reg:SI LR_REGNUM))])]
"TARGET_ARM"
"
{
--- 6691,6698 ----
(define_expand "sibcall"
[(parallel [(call (match_operand 0 "memory_operand" "")
(match_operand 1 "general_operand" ""))
! (return)
! (use (match_operand 2 "" ""))])]
"TARGET_ARM"
"
{
***************
*** 6705,6712 ****
[(parallel [(set (match_operand 0 "register_operand" "")
(call (match_operand 1 "memory_operand" "")
(match_operand 2 "general_operand" "")))
! (use (match_operand 3 "" ""))
! (use (reg:SI LR_REGNUM))])]
"TARGET_ARM"
"
{
--- 6705,6712 ----
[(parallel [(set (match_operand 0 "register_operand" "")
(call (match_operand 1 "memory_operand" "")
(match_operand 2 "general_operand" "")))
! (return)
! (use (match_operand 3 "" ""))])]
"TARGET_ARM"
"
{
***************
*** 6718,6725 ****
(define_insn "*sibcall_insn"
[(call (mem:SI (match_operand:SI 0 "" "X"))
(match_operand 1 "" ""))
! (use (match_operand 2 "" ""))
! (use (reg:SI LR_REGNUM))]
"TARGET_ARM && GET_CODE (operands[0]) == SYMBOL_REF"
"*
return NEED_PLT_RELOC ? \"b%?\\t%a0(PLT)\" : \"b%?\\t%a0\";
--- 6718,6725 ----
(define_insn "*sibcall_insn"
[(call (mem:SI (match_operand:SI 0 "" "X"))
(match_operand 1 "" ""))
! (return)
! (use (match_operand 2 "" ""))]
"TARGET_ARM && GET_CODE (operands[0]) == SYMBOL_REF"
"*
return NEED_PLT_RELOC ? \"b%?\\t%a0(PLT)\" : \"b%?\\t%a0\";
***************
*** 6731,6738 ****
[(set (match_operand 0 "s_register_operand" "=r,f")
(call (mem:SI (match_operand:SI 1 "" "X,X"))
(match_operand 2 "" "")))
! (use (match_operand 3 "" ""))
! (use (reg:SI LR_REGNUM))]
"TARGET_ARM && GET_CODE (operands[1]) == SYMBOL_REF"
"*
return NEED_PLT_RELOC ? \"b%?\\t%a1(PLT)\" : \"b%?\\t%a1\";
--- 6731,6738 ----
[(set (match_operand 0 "s_register_operand" "=r,f")
(call (mem:SI (match_operand:SI 1 "" "X,X"))
(match_operand 2 "" "")))
! (return)
! (use (match_operand 3 "" ""))]
"TARGET_ARM && GET_CODE (operands[1]) == SYMBOL_REF"
"*
return NEED_PLT_RELOC ? \"b%?\\t%a1(PLT)\" : \"b%?\\t%a1\";
***************
*** 8656,8662 ****
[(unspec_volatile [(const_int 0)] VUNSPEC_EPILOGUE)]
"TARGET_ARM"
"*
- output_asm_insn (\"%@ Sibcall epilogue\", operands);
if (USE_RETURN_INSN (FALSE))
return output_return_instruction (const_true_rtx, FALSE, FALSE);
return arm_output_epilogue (FALSE);
--- 8656,8661 ----
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-07-29 12:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-29 6:24 PATCH ARM -- clean up sibcalls Richard Earnshaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).