This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] completely hookize CONDITIONAL_REGISTER_USAGE


On Thu, 18 Nov 2010, Nathan Froyd wrote:

> The patch below hookizes CONDITIONAL_REGISTER_USAGE and hookizes all
> targets.  This is pretty straightforward, but a couple of targets stood
> out as a bit unusual:
> 
> - pa had an unusual definition of CONDITIONAL_REGISTER_USAGE for 32-bit
>   and 64-bit targets.  I think I got the logic right; Dave, would you
>   mind double-checking my merging?

> diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
> index 57858a7..0e84b0a 100644
> --- a/gcc/config/pa/pa.c
> +++ b/gcc/config/pa/pa.c
> @@ -181,6 +181,7 @@ static rtx pa_delegitimize_address (rtx);
>  static bool pa_print_operand_punct_valid_p (unsigned char);
>  static rtx pa_internal_arg_pointer (void);
>  static bool pa_can_eliminate (const int, const int);
> +static void pa_conditional_register_usage (void);
>  
>  /* The following extra sections are only used for SOM.  */
>  static GTY(()) section *som_readonly_data_section;
> @@ -386,6 +387,8 @@ static const struct default_options pa_option_optimization_table[] =
>  #define TARGET_INTERNAL_ARG_POINTER pa_internal_arg_pointer
>  #undef TARGET_CAN_ELIMINATE
>  #define TARGET_CAN_ELIMINATE pa_can_eliminate
> +#undef TARGET_CONDITIONAL_REGISTER_USAGE
> +#define TARGET_CONDITIONAL_REGISTER_USAGE pa_conditional_register_usage
>  
>  struct gcc_target targetm = TARGET_INITIALIZER;
>  
> @@ -10176,4 +10179,24 @@ pa_initial_elimination_offset (int from, int to)
>    return offset;
>  }
>  
> +static void
> +pa_conditional_register_usage (void)
> +{
> +  int i;

Insert newline.

> +  if (TARGET_32BIT && !TARGET_PA_11)

Change TARGET_32BIT to !TARGET_64BIT.  As far as I know, TARGET_32BIT
isn't defined.

> +    {
> +      for (i = 56; i < 88; i++)

Change '< 88' to '<= FP_REG_LAST' as below.

> +	fixed_regs[i] = call_used_regs[i] = 1;
> +      for (i = 33; i < 88; i += 2)

Change 88 to 56.  Previous loop has disabled all the floating
point registers from 56 through 87.

> +	fixed_regs[i] = call_used_regs[i] = 1;
> +    }
> +  if (TARGET_DISABLE_FPREGS || TARGET_SOFT_FLOAT)
> +    {
> +      for (i = FP_REG_FIRST; i <= FP_REG_LAST; i++)
> +	fixed_regs[i] = call_used_regs[i] = 1;
> +    }
> +  if (flag_pic)
> +    fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;
> +}
> +
>  #include "gt-pa.h"

Thanks for the cleanup,
Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]