public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Move some i386 code to filescope
@ 2007-05-07 21:13 Mike Stump
  2007-05-21 22:09 ` Mike Stump
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Stump @ 2007-05-07 21:13 UTC (permalink / raw)
  To: gcc-patches

I have a pragma for darwin that wants to be able to access these
values... by moving them to filescope instead of function local, I can
then access them.  I want to get at things like:

  processor_target_table[ix86_tune].cost

Ok?

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 124358)
+++ config/i386/i386.c	(working copy)
@@ -1606,6 +1606,35 @@
     }
 }
 
+static struct ptt
+{
+  const struct processor_costs *cost;	/* Processor costs */
+  const int target_enable;			/* Target flags to enable.  */
+  const int target_disable;			/* Target flags to disable.  */
+  const int align_loop;			/* Default alignments.  */
+  const int align_loop_max_skip;
+  const int align_jump;
+  const int align_jump_max_skip;
+  const int align_func;
+}
+const processor_target_table[PROCESSOR_max] =
+  {
+    {&i386_cost, 0, 0, 4, 3, 4, 3, 4},
+    {&i486_cost, 0, 0, 16, 15, 16, 15, 16},
+    {&pentium_cost, 0, 0, 16, 7, 16, 7, 16},
+    {&pentiumpro_cost, 0, 0, 16, 15, 16, 7, 16},
+    {&geode_cost, 0, 0, 0, 0, 0, 0, 0},
+    {&k6_cost, 0, 0, 32, 7, 32, 7, 32},
+    {&athlon_cost, 0, 0, 16, 7, 16, 7, 16},
+    {&pentium4_cost, 0, 0, 0, 0, 0, 0, 0},
+    {&k8_cost, 0, 0, 16, 7, 16, 7, 16},
+    {&nocona_cost, 0, 0, 0, 0, 0, 0, 0},
+    {&core2_cost, 0, 0, 16, 7, 16, 7, 16},
+    {&generic32_cost, 0, 0, 16, 7, 16, 7, 16},
+    {&generic64_cost, 0, 0, 16, 7, 16, 7, 16},
+    {&amdfam10_cost, 0, 0, 32, 24, 32, 7, 32}
+  };
+
 /* Sometimes certain combinations of command options do not make
    sense on a particular target machine.  You can define a macro
    `OVERRIDE_OPTIONS' to take account of this.  This macro, if
@@ -1625,35 +1654,6 @@
   /* Comes from final.c -- no real reason to change it.  */
 #define MAX_CODE_ALIGN 16
 
-  static struct ptt
-    {
-      const struct processor_costs *cost;	/* Processor costs */
-      const int target_enable;			/* Target flags to enable.  */
-      const int target_disable;			/* Target flags to disable.  */
-      const int align_loop;			/* Default alignments.  */
-      const int align_loop_max_skip;
-      const int align_jump;
-      const int align_jump_max_skip;
-      const int align_func;
-    }
-  const processor_target_table[PROCESSOR_max] =
-    {
-      {&i386_cost, 0, 0, 4, 3, 4, 3, 4},
-      {&i486_cost, 0, 0, 16, 15, 16, 15, 16},
-      {&pentium_cost, 0, 0, 16, 7, 16, 7, 16},
-      {&pentiumpro_cost, 0, 0, 16, 15, 16, 7, 16},
-      {&geode_cost, 0, 0, 0, 0, 0, 0, 0},
-      {&k6_cost, 0, 0, 32, 7, 32, 7, 32},
-      {&athlon_cost, 0, 0, 16, 7, 16, 7, 16},
-      {&pentium4_cost, 0, 0, 0, 0, 0, 0, 0},
-      {&k8_cost, 0, 0, 16, 7, 16, 7, 16},
-      {&nocona_cost, 0, 0, 0, 0, 0, 0, 0},
-      {&core2_cost, 0, 0, 16, 7, 16, 7, 16},
-      {&generic32_cost, 0, 0, 16, 7, 16, 7, 16},
-      {&generic64_cost, 0, 0, 16, 7, 16, 7, 16},
-      {&amdfam10_cost, 0, 0, 32, 24, 32, 7, 32}
-    };
-
   static const char * const cpu_names[] = TARGET_CPU_DEFAULT_NAMES;
   static struct pta
     {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Move some i386 code to filescope
  2007-05-07 21:13 Move some i386 code to filescope Mike Stump
@ 2007-05-21 22:09 ` Mike Stump
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Stump @ 2007-05-21 22:09 UTC (permalink / raw)
  To: Mike Stump; +Cc: gcc-patches

Any objections to moving it?

On May 7, 2007, at 2:13 PM, Mike Stump wrote:
> I have a pragma for darwin that wants to be able to access these
> values... by moving them to filescope instead of function local, I can
> then access them.  I want to get at things like:
>
>   processor_target_table[ix86_tune].cost
>
> Ok?
>
> Index: config/i386/i386.c
> ===================================================================
> --- config/i386/i386.c	(revision 124358)
> +++ config/i386/i386.c	(working copy)
> @@ -1606,6 +1606,35 @@
>      }
>  }
>
> +static struct ptt
> +{
> +  const struct processor_costs *cost;	/* Processor costs */
> +  const int target_enable;			/* Target flags to enable.  */
> +  const int target_disable;			/* Target flags to disable.  */
> +  const int align_loop;			/* Default alignments.  */
> +  const int align_loop_max_skip;
> +  const int align_jump;
> +  const int align_jump_max_skip;
> +  const int align_func;
> +}
> +const processor_target_table[PROCESSOR_max] =
> +  {
> +    {&i386_cost, 0, 0, 4, 3, 4, 3, 4},
> +    {&i486_cost, 0, 0, 16, 15, 16, 15, 16},
> +    {&pentium_cost, 0, 0, 16, 7, 16, 7, 16},
> +    {&pentiumpro_cost, 0, 0, 16, 15, 16, 7, 16},
> +    {&geode_cost, 0, 0, 0, 0, 0, 0, 0},
> +    {&k6_cost, 0, 0, 32, 7, 32, 7, 32},
> +    {&athlon_cost, 0, 0, 16, 7, 16, 7, 16},
> +    {&pentium4_cost, 0, 0, 0, 0, 0, 0, 0},
> +    {&k8_cost, 0, 0, 16, 7, 16, 7, 16},
> +    {&nocona_cost, 0, 0, 0, 0, 0, 0, 0},
> +    {&core2_cost, 0, 0, 16, 7, 16, 7, 16},
> +    {&generic32_cost, 0, 0, 16, 7, 16, 7, 16},
> +    {&generic64_cost, 0, 0, 16, 7, 16, 7, 16},
> +    {&amdfam10_cost, 0, 0, 32, 24, 32, 7, 32}
> +  };
> +
>  /* Sometimes certain combinations of command options do not make
>     sense on a particular target machine.  You can define a macro
>     `OVERRIDE_OPTIONS' to take account of this.  This macro, if
> @@ -1625,35 +1654,6 @@
>    /* Comes from final.c -- no real reason to change it.  */
>  #define MAX_CODE_ALIGN 16
>
> -  static struct ptt
> -    {
> -      const struct processor_costs *cost;	/* Processor costs */
> -      const int target_enable;			/* Target flags to enable.  */
> -      const int target_disable;			/* Target flags to disable.  */
> -      const int align_loop;			/* Default alignments.  */
> -      const int align_loop_max_skip;
> -      const int align_jump;
> -      const int align_jump_max_skip;
> -      const int align_func;
> -    }
> -  const processor_target_table[PROCESSOR_max] =
> -    {
> -      {&i386_cost, 0, 0, 4, 3, 4, 3, 4},
> -      {&i486_cost, 0, 0, 16, 15, 16, 15, 16},
> -      {&pentium_cost, 0, 0, 16, 7, 16, 7, 16},
> -      {&pentiumpro_cost, 0, 0, 16, 15, 16, 7, 16},
> -      {&geode_cost, 0, 0, 0, 0, 0, 0, 0},
> -      {&k6_cost, 0, 0, 32, 7, 32, 7, 32},
> -      {&athlon_cost, 0, 0, 16, 7, 16, 7, 16},
> -      {&pentium4_cost, 0, 0, 0, 0, 0, 0, 0},
> -      {&k8_cost, 0, 0, 16, 7, 16, 7, 16},
> -      {&nocona_cost, 0, 0, 0, 0, 0, 0, 0},
> -      {&core2_cost, 0, 0, 16, 7, 16, 7, 16},
> -      {&generic32_cost, 0, 0, 16, 7, 16, 7, 16},
> -      {&generic64_cost, 0, 0, 16, 7, 16, 7, 16},
> -      {&amdfam10_cost, 0, 0, 32, 24, 32, 7, 32}
> -    };
> -
>    static const char * const cpu_names[] = TARGET_CPU_DEFAULT_NAMES;
>    static struct pta
>      {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Move some i386 code to filescope
@ 2007-05-22  5:49 Uros Bizjak
  0 siblings, 0 replies; 3+ messages in thread
From: Uros Bizjak @ 2007-05-22  5:49 UTC (permalink / raw)
  To: GCC Patches; +Cc: Mike Stump

Hello!

> I have a pragma for darwin that wants to be able to access these
> values... by moving them to filescope instead of function local, I can
> then access them.  I want to get at things like:

> processor_target_table[ix86_tune].cost

But there is global variable "ix86_cost" just for this purpose. It is
initialized to selected -mtune= target as:

  if (optimize_size)
    ix86_cost = &size_cost;
  else
    ix86_cost = processor_target_table[ix86_tune].cost;

Uros.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-22  5:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-07 21:13 Move some i386 code to filescope Mike Stump
2007-05-21 22:09 ` Mike Stump
2007-05-22  5:49 Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).