[PATCH] Make sparc's "struct processor_costs" private to sparc.c

David Miller davem@davemloft.net
Sat Oct 22 13:01:00 GMT 2011


We used to actually need to get at 'sparc_costs' in sparc.h but those
days are long gone.

Committed to trunk.

	* config/sparc/sparc.h (sparc_costs): Remove extern decl.
	(struct processor_costs): Move from here..
	* config/sparc/sparc.c (struct processor_costs): To here.
	(sparc_costs): Mark static.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180324 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog            |    5 +++
 gcc/config/sparc/sparc.c |   77 ++++++++++++++++++++++++++++++++++++++++++++-
 gcc/config/sparc/sparc.h |   78 ----------------------------------------------
 3 files changed, 81 insertions(+), 79 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 74b3d01..a09af51 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -5,6 +5,11 @@
 	* config/sparc/sparc.c (TARGET_SECONDARY_RELOAD): Redefine.
 	(sparc_secondary_reload): New function.
 
+	* config/sparc/sparc.h (sparc_costs): Remove extern decl.
+	(struct processor_costs): Move from here..
+	* config/sparc/sparc.c (struct processor_costs): To here.
+	(sparc_costs): Mark static.
+
 2011-10-21  Paul Brook  <paul@codesourcery.com>
 
 	* config/c6x/c6x.c (c6x_asm_emit_except_personality,
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 5dbb914..717594d 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -59,6 +59,81 @@ along with GCC; see the file COPYING3.  If not see
 #include "opts.h"
 
 /* Processor costs */
+
+struct processor_costs {
+  /* Integer load */
+  const int int_load;
+
+  /* Integer signed load */
+  const int int_sload;
+
+  /* Integer zeroed load */
+  const int int_zload;
+
+  /* Float load */
+  const int float_load;
+
+  /* fmov, fneg, fabs */
+  const int float_move;
+
+  /* fadd, fsub */
+  const int float_plusminus;
+
+  /* fcmp */
+  const int float_cmp;
+
+  /* fmov, fmovr */
+  const int float_cmove;
+
+  /* fmul */
+  const int float_mul;
+
+  /* fdivs */
+  const int float_div_sf;
+
+  /* fdivd */
+  const int float_div_df;
+
+  /* fsqrts */
+  const int float_sqrt_sf;
+
+  /* fsqrtd */
+  const int float_sqrt_df;
+
+  /* umul/smul */
+  const int int_mul;
+
+  /* mulX */
+  const int int_mulX;
+
+  /* integer multiply cost for each bit set past the most
+     significant 3, so the formula for multiply cost becomes:
+
+	if (rs1 < 0)
+	  highest_bit = highest_clear_bit(rs1);
+	else
+	  highest_bit = highest_set_bit(rs1);
+	if (highest_bit < 3)
+	  highest_bit = 3;
+	cost = int_mul{,X} + ((highest_bit - 3) / int_mul_bit_factor);
+
+     A value of zero indicates that the multiply costs is fixed,
+     and not variable.  */
+  const int int_mul_bit_factor;
+
+  /* udiv/sdiv */
+  const int int_div;
+
+  /* divX */
+  const int int_divX;
+
+  /* movcc, movr */
+  const int int_cmove;
+
+  /* penalty for shifts, due to scheduling rules etc. */
+  const int shift_penalty;
+};
+
 static const
 struct processor_costs cypress_costs = {
   COSTS_N_INSNS (2), /* int load */
@@ -299,7 +374,7 @@ struct processor_costs niagara3_costs = {
   0, /* shift penalty */
 };
 
-const struct processor_costs *sparc_costs = &cypress_costs;
+static const struct processor_costs *sparc_costs = &cypress_costs;
 
 #ifdef HAVE_AS_RELAX_OPTION
 /* If 'as' and 'ld' are relaxing tail call insns into branch always, use
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 9b7835e..d9ce9df 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -27,84 +27,6 @@ along with GCC; see the file COPYING3.  If not see
 /* Note that some other tm.h files include this one and then override
    whatever definitions are necessary.  */
 
-/* Define the specific costs for a given cpu */
-
-struct processor_costs {
-  /* Integer load */
-  const int int_load;
-
-  /* Integer signed load */
-  const int int_sload;
-
-  /* Integer zeroed load */
-  const int int_zload;
-
-  /* Float load */
-  const int float_load;
-
-  /* fmov, fneg, fabs */
-  const int float_move;
-
-  /* fadd, fsub */
-  const int float_plusminus;
-
-  /* fcmp */
-  const int float_cmp;
-
-  /* fmov, fmovr */
-  const int float_cmove;
-
-  /* fmul */
-  const int float_mul;
-
-  /* fdivs */
-  const int float_div_sf;
-
-  /* fdivd */
-  const int float_div_df;
-
-  /* fsqrts */
-  const int float_sqrt_sf;
-
-  /* fsqrtd */
-  const int float_sqrt_df;
-
-  /* umul/smul */
-  const int int_mul;
-
-  /* mulX */
-  const int int_mulX;
-
-  /* integer multiply cost for each bit set past the most
-     significant 3, so the formula for multiply cost becomes:
-
-	if (rs1 < 0)
-	  highest_bit = highest_clear_bit(rs1);
-	else
-	  highest_bit = highest_set_bit(rs1);
-	if (highest_bit < 3)
-	  highest_bit = 3;
-	cost = int_mul{,X} + ((highest_bit - 3) / int_mul_bit_factor);
-
-     A value of zero indicates that the multiply costs is fixed,
-     and not variable.  */
-  const int int_mul_bit_factor;
-
-  /* udiv/sdiv */
-  const int int_div;
-
-  /* divX */
-  const int int_divX;
-
-  /* movcc, movr */
-  const int int_cmove;
-
-  /* penalty for shifts, due to scheduling rules etc. */
-  const int shift_penalty;
-};
-
-extern const struct processor_costs *sparc_costs;
-
 #define TARGET_CPU_CPP_BUILTINS() sparc_target_macros ()
 
 /* Specify this in a cover file to provide bi-architecture (32/64) support.  */
-- 
1.7.6.401.g6a319



More information about the Gcc-patches mailing list