public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5350] i386: Redefine indirect_thunks_used as HARD_REG_SET.
@ 2021-11-17 19:48 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2021-11-17 19:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:69a5b3ca5c8fdd074fbb26fec926fa25fbec77c1

commit r12-5350-g69a5b3ca5c8fdd074fbb26fec926fa25fbec77c1
Author: Uros Bizjak <ubizjak@gmail.com>
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  <ubizjak@gmail.com>
    
    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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-17 19:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 19:48 [gcc r12-5350] i386: Redefine indirect_thunks_used as HARD_REG_SET Uros Bizjak

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).