Commit 733f53f5 by Doug Evans

sparc.c (sparc_cpu_string,sparc_cpu): New globals.

	* sparc/sparc.c (sparc_cpu_string,sparc_cpu): New globals.
	(sparc_override_options): Set ISA and CPU from sparc_cpu_string.
	Delete tests for v9 switches if not v9.

From-SVN: r11318
parent 1b11c012
...@@ -111,39 +111,86 @@ static void sparc_init_modes (); ...@@ -111,39 +111,86 @@ static void sparc_init_modes ();
/* Option handling. */ /* Option handling. */
/* This is assigned the value of -mcpu=. */
char *sparc_cpu_string;
/* CPU type. This is set from TARGET_CPU_DEFAULT and -mcpu=. */
enum attr_cpu sparc_cpu;
/* Validate and override various options, and do some machine dependent /* Validate and override various options, and do some machine dependent
initialization. */ initialization. */
void void
sparc_override_options () sparc_override_options ()
{ {
/* Check for any conflicts in the choice of options. */ /* Map TARGET_CPU_DEFAULT to value for -mcpu=. */
/* ??? This stuff isn't really usable yet. */ static struct cpu_default {
int cpu;
if (! TARGET_ARCH64) char *name;
} cpu_default[] = {
{ TARGET_CPU_sparc, "common" },
{ TARGET_CPU_sparclet, "sparclet" },
{ TARGET_CPU_sparclite, "sparclite" },
{ TARGET_CPU_sparc64, "v9" },
{ 0, 0 }
};
struct cpu_default *m;
/* Map -mcpu= names to internally usable values. */
static struct cpu_table {
char *name;
enum attr_cpu cpu;
int disable;
int enable;
} cpu_table[] = {
{ "common", CPU_COMMON, MASK_ISA, 0 },
{ "cypress", CPU_CYPRESS, MASK_ISA, 0 },
/* generic v8 */
{ "v8", CPU_V8, MASK_ISA, MASK_V8 },
/* TI TMS390Z55 supersparc */
{ "supersparc", CPU_SUPERSPARC, MASK_ISA, MASK_V8 },
{ "sparclite", CPU_SPARCLITE, MASK_ISA, MASK_SPARCLITE },
/* The Fujitsu MB86930 is the original sparclite chip, with no fpu.
The Fujitsu MB86934 is the recent sparclite chip, with an fpu. */
{ "f930", CPU_SPARCLITE, MASK_ISA+MASK_FPU, MASK_SPARCLITE },
{ "f934", CPU_SPARCLITE, MASK_ISA, MASK_SPARCLITE+MASK_FPU },
/* TEMIC sparclet */
{ "sparclet", CPU_SPARCLET, MASK_ISA, MASK_SPARCLET },
/* generic v9 */
{ "v9", CPU_V9, MASK_ISA, MASK_V9 },
/* TI ultrasparc */
{ "ultrasparc", CPU_ULTRASPARC, MASK_ISA, MASK_V9 },
{ 0 }
};
struct cpu_table *p;
/* If -mcpu=foo wasn't specified, set the default. */
if (! sparc_cpu_string)
{ {
if (target_flags & MASK_CODE_MODEL) for (m = &cpu_default[0]; m->name; ++m)
error ("code model support is only available with -mv9"); if (m->cpu == TARGET_CPU_DEFAULT)
if (TARGET_INT64) break;
error ("-mint64 is only available with -mv9"); if (! m->name)
if (TARGET_LONG64) abort ();
error ("-mlong64 is only available with -mv9"); sparc_cpu_string = m->name;
if (TARGET_PTR64)
error ("-mptr64 is only available with -mv9");
if (TARGET_STACK_BIAS)
error ("-mstack-bias is only available with -mv9");
} }
else
/* Set cpu type and isa flags. */
for (p = &cpu_table[0]; p->name; ++p)
{ {
/* ??? Are there any options that aren't usable with v9. if (strcmp (p->name, sparc_cpu_string) == 0)
-munaligned-doubles? */ {
sparc_cpu = p->cpu;
target_flags &= ~p->disable;
target_flags |= p->enable;
break;
}
} }
if (! p->name)
error ("bad value (%s) for -mcpu= switch", sparc_cpu_string);
/* Check for conflicts in cpu specification. if ((sparc_cpu == CPU_V9 || sparc_cpu == CPU_ULTRASPARC)
If we use -mcpu=xxx, this can be removed. */ && TARGET_ARCH32)
target_flags |= MASK_DEPRECATED_V8_INSNS;
if ((TARGET_V8 != 0) + (TARGET_SPARCLITE != 0) + (TARGET_V9 != 0) > 1)
error ("conflicting architectures defined");
/* Do various machine dependent initializations. */ /* Do various machine dependent initializations. */
sparc_init_modes (); sparc_init_modes ();
......
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