From 33fb08b898b631ff31e141d5603a029d6fa4b682 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Tue, 6 Mar 2007 09:00:00 +0000 Subject: gcc/ * config/m68k/m68k-protos.h (output_sibcall): Declare. (mips_expand_epilogue): Add a bool parameter. (m68k_legitimize_sibcall_address): Declare. * config/m68k/m68k.c (TARGET_FUNCTION_OK_FOR_SIBCALL): Define. (m68k_expand_epilogue): Add a parameter to select between sibling and normal epilogues. Only generate a return for the latter. (m68k_ok_for_sibcall_p): New function. (m68k_legitimize_sibcall_address, output_sibcall): New functions. * config/m68k/m68k.md (sibcall, *sibcall): New patterns. (sibcall_value, *sibcall_value): Likewise. (*call, *call_value): Require !SIBLING_CALL_P. (epilogue): Update call to m68k_expand_epilogue. (sibcall_epilogue): New pattern. * config/m68k/predicates.md (const_call_operand): Say that this predicate applies to sibling calls too. (sibcall_operand): New predicate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122607 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/config/m68k/m68k.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'gcc/config/m68k/m68k.md') diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index 40c80721b09..f983d39cd32 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -6679,6 +6679,41 @@ "subql #1,%0\;cmpl #-1,%0\;jne %l1"; }) +(define_expand "sibcall" + [(call (match_operand:QI 0 "memory_operand" "") + (match_operand:SI 1 "general_operand" ""))] + "" +{ + operands[0] = m68k_legitimize_sibcall_address (operands[0]); +}) + +(define_insn "*sibcall" + [(call (mem:QI (match_operand:SI 0 "sibcall_operand" "")) + (match_operand:SI 1 "general_operand" ""))] + "SIBLING_CALL_P (insn)" +{ + return output_sibcall (operands[0]); +}) + +(define_expand "sibcall_value" + [(set (match_operand 0 "" "") + (call (match_operand:QI 1 "memory_operand" "") + (match_operand:SI 2 "general_operand" "")))] + "" +{ + operands[1] = m68k_legitimize_sibcall_address (operands[1]); +}) + +(define_insn "*sibcall_value" + [(set (match_operand 0 "" "=rf,rf") + (call (mem:QI (match_operand:SI 1 "sibcall_operand" "")) + (match_operand:SI 2 "general_operand" "")))] + "SIBLING_CALL_P (insn)" +{ + operands[0] = operands[1]; + return output_sibcall (operands[0]); +}) + ;; Call subroutine with no return value. (define_expand "call" [(call (match_operand:QI 0 "memory_operand" "") @@ -6693,7 +6728,7 @@ [(call (mem:QI (match_operand:SI 0 "call_operand" "a,W")) (match_operand:SI 1 "general_operand" "g,g"))] ;; Operand 1 not really used on the m68000. - "" + "!SIBLING_CALL_P (insn)" { return output_call (operands[0]); }) @@ -6715,7 +6750,7 @@ (call (mem:QI (match_operand:SI 1 "call_operand" "a,W")) (match_operand:SI 2 "general_operand" "g,g")))] ;; Operand 2 not really used on the m68000. - "" + "!SIBLING_CALL_P (insn)" { operands[0] = operands[1]; return output_call (operands[0]); @@ -6774,7 +6809,15 @@ [(return)] "" { - m68k_expand_epilogue (); + m68k_expand_epilogue (false); + DONE; +}) + +(define_expand "sibcall_epilogue" + [(return)] + "" +{ + m68k_expand_epilogue (true); DONE; }) -- cgit v1.2.1