From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1363) id 7BC2A3858409; Wed, 17 Nov 2021 19:48:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BC2A3858409 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Uros Bizjak To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5350] i386: Redefine indirect_thunks_used as HARD_REG_SET. X-Act-Checkin: gcc X-Git-Author: Uros Bizjak X-Git-Refname: refs/heads/master X-Git-Oldrev: 74509b963ef64101ce601a497913c13021994f51 X-Git-Newrev: 69a5b3ca5c8fdd074fbb26fec926fa25fbec77c1 Message-Id: <20211117194842.7BC2A3858409@sourceware.org> Date: Wed, 17 Nov 2021 19:48:42 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Nov 2021 19:48:42 -0000 https://gcc.gnu.org/g:69a5b3ca5c8fdd074fbb26fec926fa25fbec77c1 commit r12-5350-g69a5b3ca5c8fdd074fbb26fec926fa25fbec77c1 Author: Uros Bizjak Date: Wed Nov 17 20:47:48 2021 +0100 i386: Redefine indirect_thunks_used as HARD_REG_SET. Change indirect_thunks_used to HARD_REG_SET to avoid recalculations of correct register numbers and allow usage of SET/TEST_HARD_REG_BIT accessors. 2021-11-17 Uroš Bizjak gcc/ChangeLog: * config/i386/i386.c (indirect_thunks_used): Redefine as HARD_REG_SET. (ix86_code_end): Use TEST_HARD_REG_BIT on indirect_thunks_used. (ix86_output_indirect_branch_via_reg): Use SET_HARD_REG_BIT on indirect_thunks_used. (ix86_output_indirect_function_return): Ditto. Diff: --- gcc/config/i386/i386.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 0c5439dc7a7..c9129ae25e4 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -5733,7 +5733,7 @@ static bool indirect_thunk_needed = false; /* Bit masks of integer registers, which contain branch target, used by call thunk functions. */ -static int indirect_thunks_used; +static HARD_REG_SET indirect_thunks_used; /* True if return thunk function is needed. */ static bool indirect_return_needed = false; @@ -6030,8 +6030,7 @@ ix86_code_end (void) for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++) { - unsigned int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1; - if ((indirect_thunks_used & (1 << i))) + if (TEST_HARD_REG_BIT (indirect_thunks_used, regno)) output_indirect_thunk_function (indirect_thunk_prefix_none, regno, false); } @@ -6041,7 +6040,7 @@ ix86_code_end (void) char name[32]; tree decl; - if ((indirect_thunks_used & (1 << regno))) + if (TEST_HARD_REG_BIT (indirect_thunks_used, regno)) output_indirect_thunk_function (indirect_thunk_prefix_none, regno, false); @@ -16014,12 +16013,8 @@ ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p) != indirect_branch_thunk_inline) { if (cfun->machine->indirect_branch_type == indirect_branch_thunk) - { - int i = regno; - if (i >= FIRST_REX_INT_REG) - i -= (FIRST_REX_INT_REG - LAST_INT_REG - 1); - indirect_thunks_used |= 1 << i; - } + SET_HARD_REG_BIT (indirect_thunks_used, regno); + indirect_thunk_name (thunk_name_buf, regno, need_prefix, false); thunk_name = thunk_name_buf; } @@ -16307,7 +16302,7 @@ ix86_output_indirect_function_return (rtx ret_op) if (need_thunk) { indirect_return_via_cx = true; - indirect_thunks_used |= 1 << CX_REG; + SET_HARD_REG_BIT (indirect_thunks_used, CX_REG); } fprintf (asm_out_file, "\tjmp\t"); assemble_name (asm_out_file, thunk_name);