diff mbox series

regrename: Use PC instead of CC0 to hide operands

Message ID 3aa23ad5174d53a97b5e863c63e3713f888f6edd.1569920562.git.segher@kernel.crashing.org
State New
Headers show
Series regrename: Use PC instead of CC0 to hide operands | expand

Commit Message

Segher Boessenkool Oct. 1, 2019, 9:14 a.m. UTC
The regrename pass temporarily changes some operand RTL to CC0 so that
note_stores and scan_rtx don't see those operands.  CC0 is deprecated
and we want to remove it, so we need to use something else here.
PC fits the bill fine.

Tested on powerpc64-linux {-m32,-m64}.  Is this okay for trunk?


Segher


2019-10-01  Segher Boessenkool  <segher@kernel.crashing.org>

	* regrename.c (hide_operands): Use pc_rtx instead of cc0_rtx.

---
 gcc/regrename.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Richard Sandiford Oct. 1, 2019, 9:18 a.m. UTC | #1
Segher Boessenkool <segher@kernel.crashing.org> writes:
> The regrename pass temporarily changes some operand RTL to CC0 so that
> note_stores and scan_rtx don't see those operands.  CC0 is deprecated
> and we want to remove it, so we need to use something else here.
> PC fits the bill fine.
>
> Tested on powerpc64-linux {-m32,-m64}.  Is this okay for trunk?
>
>
> Segher
>
>
> 2019-10-01  Segher Boessenkool  <segher@kernel.crashing.org>
>
> 	* regrename.c (hide_operands): Use pc_rtx instead of cc0_rtx.
>
> ---
>  gcc/regrename.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/regrename.c b/gcc/regrename.c
> index 8c3bae8..ed1dcde 100644
> --- a/gcc/regrename.c
> +++ b/gcc/regrename.c
> @@ -1517,7 +1517,7 @@ scan_rtx (rtx_insn *insn, rtx *loc, enum reg_class cl, enum scan_actions action,
>  }
>  
>  /* Hide operands of the current insn (of which there are N_OPS) by
> -   substituting cc0 for them.
> +   substituting pc for them.
>     Previous values are stored in the OLD_OPERANDS and OLD_DUPS.
>     For every bit set in DO_NOT_HIDE, we leave the operand alone.
>     If INOUT_AND_EC_ONLY is set, we only do this for OP_INOUT type operands
> @@ -1541,7 +1541,7 @@ hide_operands (int n_ops, rtx *old_operands, rtx *old_dups,
>  	continue;
>        if (!inout_and_ec_only || recog_data.operand_type[i] == OP_INOUT
>  	  || op_alt[i].earlyclobber)
> -	*recog_data.operand_loc[i] = cc0_rtx;
> +	*recog_data.operand_loc[i] = pc_rtx;
>      }
>    for (i = 0; i < recog_data.n_dups; i++)
>      {
> @@ -1551,7 +1551,7 @@ hide_operands (int n_ops, rtx *old_operands, rtx *old_dups,
>  	continue;
>        if (!inout_and_ec_only || recog_data.operand_type[opn] == OP_INOUT
>  	  || op_alt[opn].earlyclobber)
> -	*recog_data.dup_loc[i] = cc0_rtx;
> +	*recog_data.dup_loc[i] = pc_rtx;
>      }
>  }

It's mentioned by name later too:

	  /* Step 2: Mark chains for which we have reads outside operands
	     as unrenamable.
	     We do this by munging all operands into CC0, and closing
	     everything remaining.  */

OK with the same change there.

Thanks,
Richard
Segher Boessenkool Oct. 1, 2019, 11:40 a.m. UTC | #2
On Tue, Oct 01, 2019 at 10:18:37AM +0100, Richard Sandiford wrote:
> Segher Boessenkool <segher@kernel.crashing.org> writes:
> It's mentioned by name later too:
> 
> 	  /* Step 2: Mark chains for which we have reads outside operands
> 	     as unrenamable.
> 	     We do this by munging all operands into CC0, and closing
> 	     everything remaining.  */

Ah yes, I had that in a later patch.  I have patches that get rid of CC0
everywhere, except in the targets that actually use CC0 still, and there
are some examples in the manual that need to be rewritten.  If anyone
wants these patches, just ask please.

> OK with the same change there.

Done, committed.  Thanks!


Segher
Paul Koning Oct. 1, 2019, 1:16 p.m. UTC | #3
On Oct 1, 2019, at 5:14 AM, Segher Boessenkool <segher@kernel.crashing.org> wrote:
> 
> The regrename pass temporarily changes some operand RTL to CC0 so that
> note_stores and scan_rtx don't see those operands.  CC0 is deprecated
> and we want to remove it, so we need to use something else here.
> PC fits the bill fine.

CC0 is, presumably, not part of GENERAL_REGS, but PC is, in some ports.  Does that cause a problem here? 

	paul
Richard Sandiford Oct. 1, 2019, 1:43 p.m. UTC | #4
Paul Koning <paulkoning@comcast.net> writes:
> On Oct 1, 2019, at 5:14 AM, Segher Boessenkool <segher@kernel.crashing.org> wrote:
>> 
>> The regrename pass temporarily changes some operand RTL to CC0 so that
>> note_stores and scan_rtx don't see those operands.  CC0 is deprecated
>> and we want to remove it, so we need to use something else here.
>> PC fits the bill fine.
>
> CC0 is, presumably, not part of GENERAL_REGS, but PC is, in some ports.  Does that cause a problem here? 

"PC" here is the special rtx pc_rtx, which represents (pc) rather than
a (reg ...).  It's distinct from real PC registers like r15 on AArch32.

Richard
diff mbox series

Patch

diff --git a/gcc/regrename.c b/gcc/regrename.c
index 8c3bae8..ed1dcde 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1517,7 +1517,7 @@  scan_rtx (rtx_insn *insn, rtx *loc, enum reg_class cl, enum scan_actions action,
 }
 
 /* Hide operands of the current insn (of which there are N_OPS) by
-   substituting cc0 for them.
+   substituting pc for them.
    Previous values are stored in the OLD_OPERANDS and OLD_DUPS.
    For every bit set in DO_NOT_HIDE, we leave the operand alone.
    If INOUT_AND_EC_ONLY is set, we only do this for OP_INOUT type operands
@@ -1541,7 +1541,7 @@  hide_operands (int n_ops, rtx *old_operands, rtx *old_dups,
 	continue;
       if (!inout_and_ec_only || recog_data.operand_type[i] == OP_INOUT
 	  || op_alt[i].earlyclobber)
-	*recog_data.operand_loc[i] = cc0_rtx;
+	*recog_data.operand_loc[i] = pc_rtx;
     }
   for (i = 0; i < recog_data.n_dups; i++)
     {
@@ -1551,7 +1551,7 @@  hide_operands (int n_ops, rtx *old_operands, rtx *old_dups,
 	continue;
       if (!inout_and_ec_only || recog_data.operand_type[opn] == OP_INOUT
 	  || op_alt[opn].earlyclobber)
-	*recog_data.dup_loc[i] = cc0_rtx;
+	*recog_data.dup_loc[i] = pc_rtx;
     }
 }