Commit 16956f6e by Doug Evans

sparc.c (sparc_cpu_string): Delete.

	* sparc/sparc.c (sparc_cpu_string): Delete.
	(sparc_select): New global.
	(sparc_override_options): Handle -mtune=xxx.

From-SVN: r11338
parent 6afca97d
...@@ -111,11 +111,17 @@ static void sparc_init_modes (); ...@@ -111,11 +111,17 @@ static void sparc_init_modes ();
/* Option handling. */ /* Option handling. */
/* This is assigned the value of -mcpu=. */ struct sparc_cpu_select sparc_select[] =
char *sparc_cpu_string; {
/* switch name, tune arch */
{ (char *)0, "default", 1, 1 },
{ (char *)0, "-mcpu=", 1, 1 },
{ (char *)0, "-mtune=", 1, 0 },
{ 0, 0 }
};
/* CPU type. This is set from TARGET_CPU_DEFAULT and -mcpu=. */ /* CPU type. This is set from TARGET_CPU_DEFAULT and -m{cpu,tune}=xxx. */
enum attr_cpu sparc_cpu; enum processor_type sparc_cpu;
/* Validate and override various options, and do some machine dependent /* Validate and override various options, and do some machine dependent
initialization. */ initialization. */
...@@ -123,77 +129,84 @@ enum attr_cpu sparc_cpu; ...@@ -123,77 +129,84 @@ enum attr_cpu sparc_cpu;
void void
sparc_override_options () sparc_override_options ()
{ {
/* Map TARGET_CPU_DEFAULT to value for -mcpu=. */ /* Map TARGET_CPU_DEFAULT to value for -m{arch,tune}=. */
static struct cpu_default { static struct cpu_default {
int cpu; int cpu;
char *name; char *name;
} cpu_default[] = { } cpu_default[] = {
{ TARGET_CPU_sparc, "common" }, { TARGET_CPU_sparc, "cypress" },
{ TARGET_CPU_sparclet, "sparclet" }, { TARGET_CPU_sparclet, "90c701" },
{ TARGET_CPU_sparclite, "sparclite" }, { TARGET_CPU_sparclite, "f930" },
{ TARGET_CPU_sparc64, "v9" }, { TARGET_CPU_sparc64, "ultrasparc" },
{ 0, 0 } { 0 }
}; };
struct cpu_default *m; struct cpu_default *def;
/* Map -mcpu= names to internally usable values. */ /* Table of values for -m{cpu,tune}=. */
static struct cpu_table { static struct cpu_table {
char *name; char *name;
enum attr_cpu cpu; enum processor_type processor;
int disable; int disable;
int enable; int enable;
} cpu_table[] = { } cpu_table[] = {
{ "common", CPU_COMMON, MASK_ISA, 0 }, { "v7", PROCESSOR_V7, MASK_ISA, 0 },
{ "cypress", CPU_CYPRESS, MASK_ISA, 0 }, { "cypress", PROCESSOR_CYPRESS, MASK_ISA, 0 },
/* generic v8 */ { "v8", PROCESSOR_V8, MASK_ISA, MASK_V8 },
{ "v8", CPU_V8, MASK_ISA, MASK_V8 },
/* TI TMS390Z55 supersparc */ /* TI TMS390Z55 supersparc */
{ "supersparc", CPU_SUPERSPARC, MASK_ISA, MASK_V8 }, { "supersparc", PROCESSOR_SUPERSPARC, MASK_ISA, MASK_V8 },
{ "sparclite", CPU_SPARCLITE, MASK_ISA, MASK_SPARCLITE }, { "sparclite", PROCESSOR_SPARCLITE, MASK_ISA, MASK_SPARCLITE },
/* The Fujitsu MB86930 is the original sparclite chip, with no fpu. /* The Fujitsu MB86930 is the original sparclite chip, with no fpu.
The Fujitsu MB86934 is the recent sparclite chip, with an fpu. */ The Fujitsu MB86934 is the recent sparclite chip, with an fpu. */
{ "f930", CPU_SPARCLITE, MASK_ISA+MASK_FPU, MASK_SPARCLITE }, { "f930", PROCESSOR_F930, MASK_ISA|MASK_FPU, MASK_SPARCLITE },
{ "f934", CPU_SPARCLITE, MASK_ISA, MASK_SPARCLITE+MASK_FPU }, { "f934", PROCESSOR_F934, MASK_ISA, MASK_SPARCLITE|MASK_FPU },
{ "sparclet", PROCESSOR_SPARCLET, MASK_ISA, MASK_SPARCLET },
/* TEMIC sparclet */ /* TEMIC sparclet */
{ "sparclet", CPU_SPARCLET, MASK_ISA, MASK_SPARCLET }, { "90c701", PROCESSOR_90C701, MASK_ISA, MASK_SPARCLET },
/* generic v9 */ /* "v9" is used to specify a true 64 bit architecture.
{ "v9", CPU_V9, MASK_ISA, MASK_V9 }, "v8plus" is what Sun calls Solaris2 running on UltraSPARC's. */
{ "v8plus", PROCESSOR_V8PLUS, MASK_ISA, MASK_V9 },
#if SPARC_ARCH64
{ "v9", PROCESSOR_V9, MASK_ISA, MASK_V9 },
#endif
/* TI ultrasparc */ /* TI ultrasparc */
{ "ultrasparc", CPU_ULTRASPARC, MASK_ISA, MASK_V9 }, { "ultrasparc", PROCESSOR_ULTRASPARC, MASK_ISA, MASK_V9 },
{ 0 } { 0 }
}; };
struct cpu_table *p; struct cpu_table *cpu;
struct sparc_cpu_select *sel;
/* If -mcpu=foo wasn't specified, set the default. */ /* Set the default. */
if (! sparc_cpu_string) for (def = &cpu_default[0]; def->name; ++def)
{ if (def->cpu == TARGET_CPU_DEFAULT)
for (m = &cpu_default[0]; m->name; ++m)
if (m->cpu == TARGET_CPU_DEFAULT)
break; break;
if (! m->name) if (! def->name)
abort (); abort ();
sparc_cpu_string = m->name; sparc_select[0].string = def->name;
}
/* Set cpu type and isa flags. */ for (sel = &sparc_select[0]; sel->name; ++sel)
for (p = &cpu_table[0]; p->name; ++p)
{ {
if (strcmp (p->name, sparc_cpu_string) == 0) if (sel->string)
{ {
sparc_cpu = p->cpu; for (cpu = &cpu_table[0]; cpu->name; ++cpu)
target_flags &= ~p->disable; if (! strcmp (sel->string, cpu->name))
target_flags |= p->enable; {
break; if (sel->set_tune_p)
sparc_cpu = cpu->processor;
if (sel->set_arch_p)
{
target_flags &= ~cpu->disable;
target_flags |= cpu->enable;
} }
break;
} }
if (! p->name)
error ("bad value (%s) for -mcpu= switch", sparc_cpu_string);
if ((sparc_cpu == CPU_V9 || sparc_cpu == CPU_ULTRASPARC) if (! cpu->name)
&& ! SPARC_V9) error ("bad value (%s) for %s switch", sel->string, sel->name);
error ("sparc64 is not supported by this configuration"); }
}
if ((sparc_cpu == CPU_V9 || sparc_cpu == CPU_ULTRASPARC) /* Use the deprecated v8 insns for sparc64 in 32 bit mode. */
&& TARGET_ARCH32) if (TARGET_V9 && TARGET_ARCH32)
target_flags |= MASK_DEPRECATED_V8_INSNS; target_flags |= MASK_DEPRECATED_V8_INSNS;
/* Do various machine dependent initializations. */ /* Do various machine dependent initializations. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment