From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omggw0009-vm0.mail.otm.yahoo.co.jp (omggw0009-vm0.mail.otm.yahoo.co.jp [182.22.18.158]) by sourceware.org (Postfix) with ESMTPS id BB0C7385EC57 for ; Fri, 31 May 2024 10:27:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BB0C7385EC57 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=yahoo.co.jp Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yahoo.co.jp ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BB0C7385EC57 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=182.22.18.158 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717151262; cv=none; b=mwbg0p56VHHmGtQMfe30TJOKgFU0nObnlDvgEmUYTHBgyy5xIsUjUw9a4W0wJAezUKeTOMAf7Wwqze92bCtkbFH9VSs/fYeK8V+AA2tqi1NV2j9AaEApWwr6NIIZK+gO8Grk0ushVB/YFhZ/p68q4T0C1kA5ltTw9TKkm/m0UBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1717151262; c=relaxed/simple; bh=XdlUiOwJTpxedXUSK8s42t2Dsj8gXqRPqPvG0Trphtc=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=EbUT3ryuGeBI8B9QWphue8w/dxSOHbmYogwnZoacjk00NvU2IoBD4PmDaP54eOfOEAI7y83nrAAGVr2rOoW5q88NSAG2W0asW8dWEiveac8S/jGXnCyDbbQQR0ihpyqx8v8ZJ81yySU6lh0aMRSuxmUXn3sjJf/IGZDP6A8QauQ= ARC-Authentication-Results: i=1; server2.sourceware.org X-YMail-OSG: EpkWvmkVM1kNuhpvJDf0cGIWkAGJcoN19dJN1aLp8LeLVWlLjTzFVBtIz00wffc yt2ZaZJopeLeojqQldXp5YyWIoRzzMjakHTXoof_K7y5LfXoMMVFXMo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k.yahoo.co.jp with HTTP; Fri, 31 May 2024 10:27:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1717151088; s=yj20110701; d=yahoo.co.jp; h=References:Content-Transfer-Encoding:Content-Type:Subject:From:Cc:To:MIME-Version:Date:Message-ID; bh=XHD4mxxNvxb2MwgMXvwfgocb7aitb+VeiNrZQZwHGB8=; b=mBcdh43ybfP9mWNIJW0idXDmIKpKtRci8zio8thQPwWkm0wBWc1HVO+YyK3vrMV8 HFQnv4tJ2yZ44M49ABfzqT8rJGXPkZK2yidqE4JbFM9fyYwLJ9Vsd+nIGagAVjz2oK6 Uw+Vr+gL+yyaTPfXJOUPWnuz1YBcfhiIYbbj35Pg= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=yj20110701; d=yahoo.co.jp; h=Message-ID:Date:MIME-Version:Cc:From:Content-Type:Content-Transfer-Encoding:References; b=Otet48Y+a+b41uxC5t+SgpcShuFBsdp5L+ZUaNU8+WIpT4XDgl/Ra1pbzR3hc6MP IsyYLA9qf6df5a3WRLQX0PnXm7T49Cr+c1R6Kr+cU91YKnx09nEAw4PT/ZalZ7T8sCt 631CCuAL8Q4fVTJYdM/OAnHhXNGDtk+3o5jncbsI=; Received: by smtphe5002.mail.kks.ynwp.yahoo.co.jp (YJ Hermes SMTP Server) with ESMTPA ID 246ff831ffa9e9e05ffc06f73ce1f9d1; Fri, 31 May 2024 19:27:31 +0900 (JST) Message-ID: <9d37cbb9-501d-4f52-bac9-9ef9d33d6127@yahoo.co.jp> Date: Fri, 31 May 2024 19:24:48 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches@gcc.gnu.org Cc: Max Filippov From: Takayuki 'January June' Suwa Subject: [PATCH 2/2] xtensa: Prepend "(use A0_REG)" to sibling call CALL_INSN_FUNCTION_USAGE instead of emitting it as insn at the end of epilogue Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit References: <9d37cbb9-501d-4f52-bac9-9ef9d33d6127.ref@yahoo.co.jp> X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FROM_FMBLA_NEWDOM28,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: No functional changes. gcc/ChangeLog: * config/xtensa/xtensa-protos.h (xtensa_expand_call): Add the third argument as boolean. (xtensa_expand_epilogue): Remove the first argument. * config/xtensa/xtensa.cc (xtensa_expand_call): Add the third argument "sibcall_p", and modify in order to prepend "(use A0_REG)" to CALL_INSN_FUNCTION_USAGE if the argument is true. (xtensa_expand_epilogue): Remove the first argument "sibcall_p" and its conditional clause. * config/xtensa/xtensa.md (call, call_value, sibcall, sibcall_value): Append a boolean value to the argument of xtensa_expand_call() indicating whether it is sibling call or not. (epilogue): Remove the boolean argument from xtensa_expand_epilogue(), and then append emitting "(return)". (sibcall_epilogue): Remove the boolean argument from xtensa_expand_epilogue(). --- gcc/config/xtensa/xtensa-protos.h | 4 ++-- gcc/config/xtensa/xtensa.cc | 16 ++++++++++------ gcc/config/xtensa/xtensa.md | 13 +++++++------ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h index 834f15e0e48..77553b0453f 100644 --- a/gcc/config/xtensa/xtensa-protos.h +++ b/gcc/config/xtensa/xtensa-protos.h @@ -53,7 +53,7 @@ extern void xtensa_expand_atomic (enum rtx_code, rtx, rtx, rtx, bool); extern void xtensa_emit_loop_end (rtx_insn *, rtx *); extern char *xtensa_emit_branch (bool, rtx *); extern char *xtensa_emit_movcc (bool, bool, bool, rtx *); -extern void xtensa_expand_call (int, rtx *); +extern void xtensa_expand_call (int, rtx *, bool); extern char *xtensa_emit_call (int, rtx *); extern char *xtensa_emit_sibcall (int, rtx *); extern bool xtensa_tls_referenced_p (rtx); @@ -76,7 +76,7 @@ extern void xtensa_setup_frame_addresses (void); extern int xtensa_debugger_regno (int); extern long compute_frame_size (poly_int64); extern void xtensa_expand_prologue (void); -extern void xtensa_expand_epilogue (bool); +extern void xtensa_expand_epilogue (void); extern void xtensa_adjust_reg_alloc_order (void); extern enum reg_class xtensa_regno_to_class (int regno); extern HOST_WIDE_INT xtensa_initial_elimination_offset (int from, int to); diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index 301448c65e2..45dc1be3ff5 100644 --- a/gcc/config/xtensa/xtensa.cc +++ b/gcc/config/xtensa/xtensa.cc @@ -2239,7 +2239,7 @@ xtensa_emit_movcc (bool inverted, bool isfp, bool isbool, rtx *operands) void -xtensa_expand_call (int callop, rtx *operands) +xtensa_expand_call (int callop, rtx *operands, bool sibcall_p) { rtx call; rtx_insn *call_insn; @@ -2281,6 +2281,14 @@ xtensa_expand_call (int callop, rtx *operands) CALL_INSN_FUNCTION_USAGE (call_insn) = gen_rtx_EXPR_LIST (Pmode, clob, CALL_INSN_FUNCTION_USAGE (call_insn)); } + else if (sibcall_p) + { + /* Sibling call requires a return address to the caller, similar to + "return" insn. */ + rtx use = gen_rtx_USE (VOIDmode, gen_rtx_REG (SImode, A0_REG)); + CALL_INSN_FUNCTION_USAGE (call_insn) = + gen_rtx_EXPR_LIST (Pmode, use, CALL_INSN_FUNCTION_USAGE (call_insn)); + } } @@ -3671,7 +3679,7 @@ xtensa_expand_prologue (void) } void -xtensa_expand_epilogue (bool sibcall_p) +xtensa_expand_epilogue (void) { if (!TARGET_WINDOWED_ABI) { @@ -3736,10 +3744,6 @@ xtensa_expand_epilogue (bool sibcall_p) stack_pointer_rtx, EH_RETURN_STACKADJ_RTX)); } - if (sibcall_p) - emit_use (gen_rtx_REG (SImode, A0_REG)); - else - emit_jump_insn (gen_return ()); } void diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index 03e816b8a12..ef826b63e44 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -2553,7 +2553,7 @@ (match_operand 1 "" ""))] "" { - xtensa_expand_call (0, operands); + xtensa_expand_call (0, operands, false); DONE; }) @@ -2574,7 +2574,7 @@ (match_operand 2 "" "")))] "" { - xtensa_expand_call (1, operands); + xtensa_expand_call (1, operands, false); DONE; }) @@ -2595,7 +2595,7 @@ (match_operand 1 "" ""))] "!TARGET_WINDOWED_ABI" { - xtensa_expand_call (0, operands); + xtensa_expand_call (0, operands, true); DONE; }) @@ -2616,7 +2616,7 @@ (match_operand 2 "" "")))] "!TARGET_WINDOWED_ABI" { - xtensa_expand_call (1, operands); + xtensa_expand_call (1, operands, true); DONE; }) @@ -2723,7 +2723,8 @@ [(return)] "" { - xtensa_expand_epilogue (false); + xtensa_expand_epilogue (); + emit_jump_insn (gen_return ()); DONE; }) @@ -2731,7 +2732,7 @@ [(return)] "!TARGET_WINDOWED_ABI" { - xtensa_expand_epilogue (true); + xtensa_expand_epilogue (); DONE; }) -- 2.39.2