This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: avoid creating temporary rtl in get/has_hard_reg_initial_val
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 08 May 2005 10:18:20 +0100
- Subject: Re: RFA: avoid creating temporary rtl in get/has_hard_reg_initial_val
- References: <87r7gjyv66.fsf@firetop.home> <20050508014019.GB4294@redhat.com>
Richard Henderson <rth@redhat.com> writes:
> On Sat, May 07, 2005 at 03:20:33PM +0100, Richard Sandiford wrote:
>> has_hard_reg_initial_val (enum machine_mode mode, int regno)
> ...
>> ! && REGNO (ivs->entries[i].hard_reg) == (unsigned int) regno)
>
> Please just change the prototype to use unsigned. That
> should be the canonical type for dealing with regnos.
OK, here's what I installed after testing on mips64-elf.
Richard
* integrate.h (get_hard_reg_initial_val): Change type of register
parameter from int to unsigned int.
(has_hard_reg_initial_val): Likewise.
* integrate.c (get_hard_reg_initial_val): Likewise.
(has_hard_reg_initial_val): Likewise. Remove cast to unsigned int.
Index: integrate.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.h,v
retrieving revision 1.33
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.33 integrate.h
--- integrate.h 19 Nov 2004 02:58:33 -0000 1.33
+++ integrate.h 8 May 2005 06:54:42 -0000
@@ -21,12 +21,8 @@ 02111-1307, USA. */
#include "varray.h"
-/* Return a pseudo that corresponds to the value in the specified hard
- reg as of the start of the function (for inlined functions, the
- value at the start of the parent function). */
-extern rtx get_hard_reg_initial_val (enum machine_mode, int);
-/* Likewise, but for common cases. */
-extern rtx has_hard_reg_initial_val (enum machine_mode, int);
+extern rtx get_hard_reg_initial_val (enum machine_mode, unsigned int);
+extern rtx has_hard_reg_initial_val (enum machine_mode, unsigned int);
/* If a pseudo represents an initial hard reg (or expression), return
it, else return NULL_RTX. */
extern rtx get_hard_reg_initial_reg (struct function *, rtx);
Index: integrate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/integrate.c,v
retrieving revision 1.276
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.276 integrate.c
--- integrate.c 7 May 2005 19:05:33 -0000 1.276
+++ integrate.c 8 May 2005 06:54:42 -0000
@@ -297,7 +297,7 @@ get_hard_reg_initial_reg (struct functio
initial value of hard register REGNO. Return an rtx for such a pseudo. */
rtx
-get_hard_reg_initial_val (enum machine_mode mode, int regno)
+get_hard_reg_initial_val (enum machine_mode mode, unsigned int regno)
{
struct initial_value_struct *ivs;
rtx rv;
@@ -335,7 +335,7 @@ get_hard_reg_initial_val (enum machine_m
the associated pseudo if so, otherwise return NULL. */
rtx
-has_hard_reg_initial_val (enum machine_mode mode, int regno)
+has_hard_reg_initial_val (enum machine_mode mode, unsigned int regno)
{
struct initial_value_struct *ivs;
int i;
@@ -344,7 +344,7 @@ has_hard_reg_initial_val (enum machine_m
if (ivs != 0)
for (i = 0; i < ivs->num_entries; i++)
if (GET_MODE (ivs->entries[i].hard_reg) == mode
- && REGNO (ivs->entries[i].hard_reg) == (unsigned int) regno)
+ && REGNO (ivs->entries[i].hard_reg) == regno)
return ivs->entries[i].pseudo;
return NULL_RTX;