Patchwork Rs6000 infrastructure cleanup (switches), revised patch #2d

login
register
mail settings
Submitter Michael Meissner
Date Oct. 9, 2012, 11:01 p.m.
Message ID <20121009230143.GB22469@ibm-tiger.the-meissners.org>
Download mbox | patch
Permalink /patch/190510/
State New
Headers show

Comments

Michael Meissner - Oct. 9, 2012, 11:01 p.m.
This patch is a preparation patch for the main infrastructure patch.  It
changes the types of the builtin masks and target options from unsigned/signed
int to HOST_WIDE_INT.  I built this with #2c also installed (but the two
patches are independent).  It bootstraped and had no regressions.  Is it ok to
install?

2012-10-09  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Change
	builtin mask, target flags masks type to HOST_WIDE_INT in
	preparation for growing the number of ISA switches from 31 to 63.

	* config/rs6000/rs6000.opt (rs6000_builtin_mask): Make mask type
	HOST_WIDE_INT.

	* config/rs6000/rs6000.c (struct builtin_description): Make
	builtin mask field HOST_WIDE_INT.  Make target flags field
	HOST_WIDE_INT in preparation for growing the # of ISA switches.
	(struct rs6000_builtin_info_type): Likewise.
	(struct rs6000_ptt): Likewise.
	(rs6000_builtin_mask_calculate): Likewise.
	(rs6000_invalid_builtin): Likewise.
	(rs6000_builtin_decl): Likewise.
	(rs6000_common_init_builtins): Likewise.
	(rs6000_darwin_file_start): Likewise.
	(rs6000_final_prescan_insn): Likewise.
	(rs6000_inner_target_options): Likewise.
	(build_target_option_node): Likewise.
	(rs6000_function_specific_print): Likewise.
	(DEBUG_FMT_W): New format for printing HOST_WIDE_INT in hex.

	* config/rs6000/rs6000-protos.h (rs6000_builtin_mask_calculate):
	Make target flags, builtin masks arguments/return values
	HOST_WIDE_INT in preparation for growing the number of ISA from 31
	to 63.
	(rs6000_target_modify_macros): Likewise.
	(rs6000_target_modify_macros_ptr): Likewise.
David Edelsohn - Oct. 10, 2012, 1:17 a.m.
On Tue, Oct 9, 2012 at 7:01 PM, Michael Meissner
<meissner@linux.vnet.ibm.com> wrote:
> This patch is a preparation patch for the main infrastructure patch.  It
> changes the types of the builtin masks and target options from unsigned/signed
> int to HOST_WIDE_INT.  I built this with #2c also installed (but the two
> patches are independent).  It bootstraped and had no regressions.  Is it ok to
> install?
>
> 2012-10-09  Michael Meissner  <meissner@linux.vnet.ibm.com>
>
>         * config/rs6000/rs6000-c.c (rs6000_target_modify_macros): Change
>         builtin mask, target flags masks type to HOST_WIDE_INT in
>         preparation for growing the number of ISA switches from 31 to 63.
>
>         * config/rs6000/rs6000.opt (rs6000_builtin_mask): Make mask type
>         HOST_WIDE_INT.
>
>         * config/rs6000/rs6000.c (struct builtin_description): Make
>         builtin mask field HOST_WIDE_INT.  Make target flags field
>         HOST_WIDE_INT in preparation for growing the # of ISA switches.
>         (struct rs6000_builtin_info_type): Likewise.
>         (struct rs6000_ptt): Likewise.
>         (rs6000_builtin_mask_calculate): Likewise.
>         (rs6000_invalid_builtin): Likewise.
>         (rs6000_builtin_decl): Likewise.
>         (rs6000_common_init_builtins): Likewise.
>         (rs6000_darwin_file_start): Likewise.
>         (rs6000_final_prescan_insn): Likewise.
>         (rs6000_inner_target_options): Likewise.
>         (build_target_option_node): Likewise.
>         (rs6000_function_specific_print): Likewise.
>         (DEBUG_FMT_W): New format for printing HOST_WIDE_INT in hex.
>
>         * config/rs6000/rs6000-protos.h (rs6000_builtin_mask_calculate):
>         Make target flags, builtin masks arguments/return values
>         HOST_WIDE_INT in preparation for growing the number of ISA from 31
>         to 63.
>         (rs6000_target_modify_macros): Likewise.
>         (rs6000_target_modify_macros_ptr): Likewise.

This patch is okay.

Thanks, David

Patch

Index: gcc/config/rs6000/rs6000-c.c
===================================================================
--- gcc/config/rs6000/rs6000-c.c	(revision 192265)
+++ gcc/config/rs6000/rs6000-c.c	(working copy)
@@ -285,12 +285,15 @@  rs6000_define_or_undefine_macro (bool de
    have both the target flags and the builtin flags as arguments.  */
 
 void
-rs6000_target_modify_macros (bool define_p, int flags, unsigned bu_mask)
+rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags,
+			     HOST_WIDE_INT bu_mask)
 {
   if (TARGET_DEBUG_BUILTIN || TARGET_DEBUG_TARGET)
-    fprintf (stderr, "rs6000_target_modify_macros (%s, 0x%x, 0x%x)\n",
+    fprintf (stderr,
+	     "rs6000_target_modify_macros (%s, " HOST_WIDE_INT_PRINT_HEX
+	     ", " HOST_WIDE_INT_PRINT_HEX ")\n",
 	     (define_p) ? "define" : "undef",
-	     (unsigned) flags, bu_mask);
+	     flags, bu_mask);
 
   /* target_flags based options.  */
   rs6000_define_or_undefine_macro (define_p, "_ARCH_PPC");
Index: gcc/config/rs6000/rs6000.opt
===================================================================
--- gcc/config/rs6000/rs6000.opt	(revision 192265)
+++ gcc/config/rs6000/rs6000.opt	(working copy)
@@ -80,7 +80,7 @@  unsigned int rs6000_recip_control
 
 ;; Mask of what builtin functions are allowed
 TargetVariable
-unsigned int rs6000_builtin_mask
+HOST_WIDE_INT rs6000_builtin_mask
 
 ;; Debug flags
 TargetVariable
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 192265)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -214,7 +214,7 @@  static GTY(()) section *toc_section;
 
 struct builtin_description
 {
-  const unsigned int mask;
+  const HOST_WIDE_INT mask;
   const enum insn_code icode;
   const char *const name;
   const enum rs6000_builtins code;
@@ -288,7 +288,7 @@  typedef rtx (*gen_2arg_fn_t) (rtx, rtx, 
 /* Pointer to function (in rs6000-c.c) that can define or undefine target
    macros that have changed.  Languages that don't support the preprocessor
    don't link in rs6000-c.c, so we can't call it directly.  */
-void (*rs6000_target_modify_macros_ptr) (bool, int, unsigned);
+void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT, HOST_WIDE_INT);
 
 
 /* Target cpu costs.  */
@@ -894,7 +894,7 @@  struct processor_costs ppca2_cost = {
 struct rs6000_builtin_info_type {
   const char *name;
   const enum insn_code icode;
-  const unsigned mask;
+  const HOST_WIDE_INT mask;
   const unsigned attr;
 };
 
@@ -1505,7 +1505,7 @@  struct rs6000_ptt
 {
   const char *const name;		/* Canonical processor name.  */
   const enum processor_type processor;	/* Processor type enum value.  */
-  const int target_enable;		/* Target flags to enable.  */
+  const HOST_WIDE_INT target_enable;	/* Target flags to enable.  */
 };
 
 static struct rs6000_ptt const processor_target_table[] =
@@ -1719,6 +1719,7 @@  rs6000_debug_reg_print (int first_regno,
 #define DEBUG_FMT_D "%-32s= %d\n"
 #define DEBUG_FMT_X "%-32s= 0x%x\n"
 #define DEBUG_FMT_S "%-32s= %s\n"
+#define DEBUG_FMT_W "%-32s= " HOST_WIDEST_INT_PRINT_HEX "\n"
 
 /* Print various interesting information with -mdebug=reg.  */
 static void
@@ -1948,7 +1949,7 @@  rs6000_debug_reg_global (void)
 	   (int)END_BUILTINS);
   fprintf (stderr, DEBUG_FMT_D, "Number of rs6000 builtins",
 	   (int)RS6000_BUILTIN_COUNT);
-  fprintf (stderr, DEBUG_FMT_X, "Builtin mask", rs6000_builtin_mask);
+  fprintf (stderr, DEBUG_FMT_W, "Builtin mask", rs6000_builtin_mask);
 }
 
 /* Initialize the various global tables that are based on register size.  */
@@ -2354,7 +2355,7 @@  darwin_rs6000_override_options (void)
    bits, and some options like SPE and PAIRED are no longer in
    target_flags.  */
 
-unsigned
+HOST_WIDE_INT
 rs6000_builtin_mask_calculate (void)
 {
   return (((TARGET_ALTIVEC)		    ? RS6000_BTM_ALTIVEC  : 0)
@@ -2381,7 +2382,7 @@  rs6000_option_override_internal (bool gl
   /* The default cpu requested at configure time, if any.  */
   const char *implicit_cpu = OPTION_TARGET_CPU_DEFAULT;
 
-  int set_masks;
+  HOST_WIDE_INT set_masks;
   int cpu_index;
   int tune_index;
   struct cl_target_option *main_target_opt
@@ -3176,7 +3177,9 @@  rs6000_option_override_internal (bool gl
      target_flags.  */
   rs6000_builtin_mask = rs6000_builtin_mask_calculate ();
   if (TARGET_DEBUG_BUILTIN || TARGET_DEBUG_TARGET)
-    fprintf (stderr, "new builtin mask = 0x%x%s%s%s%s\n", rs6000_builtin_mask,
+    fprintf (stderr,
+	     "new builtin mask = " HOST_WIDE_INT_PRINT_HEX "%s%s%s%s\n",
+	     rs6000_builtin_mask,
 	     (rs6000_builtin_mask & RS6000_BTM_ALTIVEC) ? ", altivec" : "",
 	     (rs6000_builtin_mask & RS6000_BTM_VSX)     ? ", vsx"     : "",
 	     (rs6000_builtin_mask & RS6000_BTM_PAIRED)  ? ", paired"  : "",
@@ -11274,7 +11277,7 @@  rs6000_invalid_builtin (enum rs6000_buil
 {
   size_t uns_fncode = (size_t)fncode;
   const char *name = rs6000_builtin_info[uns_fncode].name;
-  unsigned fnmask = rs6000_builtin_info[uns_fncode].mask;
+  HOST_WIDE_INT fnmask = rs6000_builtin_info[uns_fncode].mask;
 
   gcc_assert (name != NULL);
   if ((fnmask & RS6000_BTM_CELL) != 0)
@@ -11311,7 +11314,7 @@  rs6000_expand_builtin (tree exp, rtx tar
   size_t i;
   rtx ret;
   bool success;
-  unsigned mask = rs6000_builtin_info[uns_fcode].mask;
+  HOST_WIDE_INT mask = rs6000_builtin_info[uns_fcode].mask;
   bool func_valid_p = ((rs6000_builtin_mask & mask) == mask);
 
   if (TARGET_DEBUG_BUILTIN)
@@ -11694,7 +11697,7 @@  rs6000_init_builtins (void)
 static tree
 rs6000_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
 {
-  unsigned fnmask;
+  HOST_WIDE_INT fnmask;
 
   if (code >= RS6000_BUILTIN_COUNT)
     return error_mark_node;
@@ -12566,7 +12569,7 @@  rs6000_common_init_builtins (void)
   tree v2si_ftype_qi = NULL_TREE;
   tree v2si_ftype_v2si_qi = NULL_TREE;
   tree v2si_ftype_int_qi = NULL_TREE;
-  unsigned builtin_mask = rs6000_builtin_mask;
+  HOST_WIDE_INT builtin_mask = rs6000_builtin_mask;
 
   if (!TARGET_PAIRED_FLOAT)
     {
@@ -12588,7 +12591,7 @@  rs6000_common_init_builtins (void)
   for (i = 0; i < ARRAY_SIZE (bdesc_3arg); i++, d++)
     {
       tree type;
-      unsigned mask = d->mask;
+      HOST_WIDE_INT mask = d->mask;
 
       if ((mask & builtin_mask) != mask)
 	{
@@ -12629,7 +12632,7 @@  rs6000_common_init_builtins (void)
     {
       enum machine_mode mode0, mode1, mode2;
       tree type;
-      unsigned mask = d->mask;
+      HOST_WIDE_INT mask = d->mask;
 
       if ((mask & builtin_mask) != mask)
 	{
@@ -12692,7 +12695,7 @@  rs6000_common_init_builtins (void)
     {
       enum machine_mode mode0, mode1;
       tree type;
-      unsigned mask = d->mask;
+      HOST_WIDE_INT mask = d->mask;
 
       if ((mask & builtin_mask) != mask)
 	{
@@ -25246,7 +25249,7 @@  rs6000_darwin_file_start (void)
   {
     const char *arg;
     const char *name;
-    int if_set;
+    HOST_WIDE_INT if_set;
   } mapping[] = {
     { "ppc64", "ppc64", MASK_64BIT },
     { "970", "ppc970", MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64 },
@@ -27379,7 +27382,7 @@  rs6000_final_prescan_insn (rtx insn, rtx
 
 struct rs6000_opt_mask {
   const char *name;		/* option name */
-  int mask;			/* mask to set */
+  HOST_WIDE_INT mask;		/* mask to set */
   bool invert;			/* invert sense of mask */
   bool valid_target;		/* option is a target option */
 };
@@ -27531,7 +27534,7 @@  rs6000_inner_target_options (tree args, 
 	      for (i = 0; i < ARRAY_SIZE (rs6000_opt_masks); i++)
 		if (strcmp (r, rs6000_opt_masks[i].name) == 0)
 		  {
-		    int mask = rs6000_opt_masks[i].mask;
+		    HOST_WIDE_INT mask = rs6000_opt_masks[i].mask;
 
 		    if (!rs6000_opt_masks[i].valid_target)
 		      not_valid_p = true;
@@ -27755,8 +27758,8 @@  rs6000_pragma_target_parse (tree args, t
   tree prev_tree = build_target_option_node ();
   tree cur_tree;
   struct cl_target_option *prev_opt, *cur_opt;
-  unsigned prev_bumask, cur_bumask, diff_bumask;
-  int prev_flags, cur_flags, diff_flags;
+  HOST_WIDE_INT prev_flags, cur_flags, diff_flags;
+  HOST_WIDE_INT prev_bumask, cur_bumask, diff_bumask;
 
   if (TARGET_DEBUG_TARGET)
     {
@@ -27936,7 +27939,7 @@  rs6000_function_specific_print (FILE *fi
 {
   size_t i;
   int flags = ptr->x_target_flags;
-  unsigned bu_mask = ptr->x_rs6000_builtin_mask;
+  HOST_WIDE_INT bu_mask = ptr->x_rs6000_builtin_mask;
 
   /* Print the various mask options.  */
   for (i = 0; i < ARRAY_SIZE (rs6000_opt_masks); i++)
@@ -27958,7 +27961,8 @@  rs6000_function_specific_print (FILE *fi
     }
 
   /* Print the various builtin flags.  */
-  fprintf (file, "%*sbuiltin mask = 0x%x\n", indent, "", bu_mask);
+  fprintf (file, "%*sbuiltin mask = " HOST_WIDE_INT_PRINT_HEX "\n",
+	   indent, "", bu_mask);
   for (i = 0; i < ARRAY_SIZE (rs6000_builtin_mask_names); i++)
     if ((bu_mask & rs6000_builtin_mask_names[i].mask) != 0)
       {
Index: gcc/config/rs6000/rs6000-protos.h
===================================================================
--- gcc/config/rs6000/rs6000-protos.h	(revision 192265)
+++ gcc/config/rs6000/rs6000-protos.h	(working copy)
@@ -176,7 +176,7 @@  extern void rs6000_call_indirect_aix (rt
 extern void rs6000_aix_asm_output_dwarf_table_ref (char *);
 extern void get_ppc476_thunk_name (char name[32]);
 extern bool rs6000_overloaded_builtin_p (enum rs6000_builtins);
-extern unsigned rs6000_builtin_mask_calculate (void);
+extern HOST_WIDE_INT rs6000_builtin_mask_calculate (void);
 
 /* Declare functions in rs6000-c.c */
 
@@ -185,8 +185,9 @@  extern void rs6000_cpu_cpp_builtins (str
 #ifdef TREE_CODE
 extern bool rs6000_pragma_target_parse (tree, tree);
 #endif
-extern void rs6000_target_modify_macros (bool, int, unsigned);
-extern void (*rs6000_target_modify_macros_ptr) (bool, int, unsigned);
+extern void rs6000_target_modify_macros (bool, HOST_WIDE_INT, HOST_WIDE_INT);
+extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT,
+						HOST_WIDE_INT);
 
 #if TARGET_MACHO
 char *output_call (rtx, rtx *, int, int);