arc.c (arc_cpu_string): Make static.

* config/arc/arc.c (arc_cpu_string): Make static.  Default to "base"
	(arc_text_string, arc_data_string, arc_rodata_string): Make static.
	(TARGET_HANDLE_OPTION): Override default.
	(arc_handle_option): New function.
	(arc_init): Remove code to set arch_cpu_string.
	* config/arc/arc.h (target_flags, TARGET_MASK_MANGLE_CPU)
	(TARGET_MANGLE_CPU, TARGET_MASK_MANGLE_CPU_LIBGCC)
	(TARGET_MANGLE_CPU_LIBGCC, TARGET_MASK_ALIGN_LOOPS, TARGET_ALIGN_LOOPS)
	(TARGET_MASK_BIG_ENDIAN, TARGET_BIG_ENDIAN, TARGET_MASK_NO_COND_EXEC)
	(TARGET_NO_COND_EXEC, TARGET_SWITCHES, TARGET_DEFAULT)
	(SUBTARGET_SWITCHES, arc_cpu_string, arc_text_string, arc_data_string)
	(arc_rodata_string, TARGET_OPTIONS): Delete.
	* config/arc/arc.opt: New file.

From-SVN: r96607
This commit is contained in:
Richard Sandiford 2005-03-17 13:49:48 +00:00 committed by Richard Sandiford
parent 7416ab0243
commit 3ff01d4d50
4 changed files with 91 additions and 90 deletions

View File

@ -1,3 +1,19 @@
2005-03-17 Richard Sandiford <rsandifo@redhat.com>
* config/arc/arc.c (arc_cpu_string): Make static. Default to "base"
(arc_text_string, arc_data_string, arc_rodata_string): Make static.
(TARGET_HANDLE_OPTION): Override default.
(arc_handle_option): New function.
(arc_init): Remove code to set arch_cpu_string.
* config/arc/arc.h (target_flags, TARGET_MASK_MANGLE_CPU)
(TARGET_MANGLE_CPU, TARGET_MASK_MANGLE_CPU_LIBGCC)
(TARGET_MANGLE_CPU_LIBGCC, TARGET_MASK_ALIGN_LOOPS, TARGET_ALIGN_LOOPS)
(TARGET_MASK_BIG_ENDIAN, TARGET_BIG_ENDIAN, TARGET_MASK_NO_COND_EXEC)
(TARGET_NO_COND_EXEC, TARGET_SWITCHES, TARGET_DEFAULT)
(SUBTARGET_SWITCHES, arc_cpu_string, arc_text_string, arc_data_string)
(arc_rodata_string, TARGET_OPTIONS): Delete.
* config/arc/arc.opt: New file.
2005-03-17 Richard Henderson <rth@redhat.com>
* doc/extend.texi (Weak Pragmas): New section.

View File

@ -43,8 +43,8 @@ Boston, MA 02111-1307, USA. */
#include "target.h"
#include "target-def.h"
/* Which cpu we're compiling for (NULL(=base), ???). */
const char *arc_cpu_string;
/* Which cpu we're compiling for. */
static const char *arc_cpu_string = "base";
int arc_cpu_type;
/* Name of mangle string to add to symbols to separate code compiled for each
@ -57,9 +57,9 @@ rtx arc_compare_op0, arc_compare_op1;
/* Name of text, data, and rodata sections, as specified on command line.
Selected by -m{text,data,rodata} flags. */
const char *arc_text_string = ARC_DEFAULT_TEXT_SECTION;
const char *arc_data_string = ARC_DEFAULT_DATA_SECTION;
const char *arc_rodata_string = ARC_DEFAULT_RODATA_SECTION;
static const char *arc_text_string = ARC_DEFAULT_TEXT_SECTION;
static const char *arc_data_string = ARC_DEFAULT_DATA_SECTION;
static const char *arc_rodata_string = ARC_DEFAULT_RODATA_SECTION;
/* Name of text, data, and rodata sections used in varasm.c. */
const char *arc_text_section;
@ -86,6 +86,7 @@ static int arc_ccfsm_target_label;
arc_print_operand. */
static int last_insn_set_cc_p;
static int current_insn_set_cc_p;
static bool arc_handle_option (size_t, const char *, int);
static void record_cc_ref (rtx);
static void arc_init_reg_tables (void);
static int get_arc_condition_code (rtx);
@ -126,6 +127,9 @@ static bool arc_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
#undef TARGET_ASM_EXTERNAL_LIBCALL
#define TARGET_ASM_EXTERNAL_LIBCALL arc_external_libcall
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION arc_handle_option
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS arc_rtx_costs
#undef TARGET_ADDRESS_COST
@ -150,6 +154,38 @@ static bool arc_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
struct gcc_target targetm = TARGET_INITIALIZER;
/* Implement TARGET_HANDLE_OPTION. */
static bool
arc_handle_option (size_t code, const char *arg, int value ATTRIBUTE_UNUSED)
{
switch (code)
{
case OPT_mcpu_:
if (strcmp (arg, "base") == 0 || ARC_EXTENSION_CPU (arg))
{
arc_cpu_string = arg;
return true;
}
return false;
case OPT_mtext_:
arc_text_string = arg;
return true;
case OPT_mdata_:
arc_data_string = arg;
return true;
case OPT_mrodata_:
arc_rodata_string = arg;
return true;
default:
return true;
}
}
/* Called by OVERRIDE_OPTIONS to initialize various things. */
void
@ -157,24 +193,6 @@ arc_init (void)
{
char *tmp;
if (arc_cpu_string == 0
|| !strcmp (arc_cpu_string, "base"))
{
/* Ensure we have a printable value for the .cpu pseudo-op. */
arc_cpu_string = "base";
arc_cpu_type = 0;
arc_mangle_cpu = NULL;
}
else if (ARC_EXTENSION_CPU (arc_cpu_string))
; /* nothing to do */
else
{
error ("bad value (%s) for -mcpu switch", arc_cpu_string);
arc_cpu_string = "base";
arc_cpu_type = 0;
arc_mangle_cpu = NULL;
}
/* Set the pseudo-ops for the various standard sections. */
arc_text_section = tmp = xmalloc (strlen (arc_text_string) + sizeof (ARC_SECTION_FORMAT) + 1);
sprintf (tmp, ARC_SECTION_FORMAT, arc_text_string);

View File

@ -72,79 +72,12 @@ Boston, MA 02111-1307, USA. */
#define ENDFILE_SPEC "crtfini.o%s"
/* Run-time compilation parameters selecting different hardware subsets. */
extern int target_flags;
/* Mangle all user symbols for the specified cpu.
ARC's can be shipped in which a collection of cpus are coupled together.
Each CPU may be different in some way, and thus we may need to distinguish
code compiled for one to ensure it isn't linked with code compiled for
another. */
#define TARGET_MASK_MANGLE_CPU 1
#define TARGET_MANGLE_CPU (target_flags & TARGET_MASK_MANGLE_CPU)
#if 0
/* Mangle libgcc symbols by adding a suffix for the specified cpu. */
#define TARGET_MASK_MANGLE_CPU_LIBGCC 2
#define TARGET_MANGLE_CPU_LIBGCC (target_flags & TARGET_MASK_MANGLE_CPU_LIBGCC)
#endif
/* Align loops to 32 byte boundaries (cache line size). */
#define TARGET_MASK_ALIGN_LOOPS 4
#define TARGET_ALIGN_LOOPS (target_flags & TARGET_MASK_ALIGN_LOOPS)
/* Big Endian. */
#define TARGET_MASK_BIG_ENDIAN 8
#define TARGET_BIG_ENDIAN (target_flags & TARGET_MASK_BIG_ENDIAN)
/* Turn off conditional execution optimization,
so we can see how well it does, or in case it's buggy. */
#define TARGET_MASK_NO_COND_EXEC 0x10
#define TARGET_NO_COND_EXEC (target_flags & TARGET_MASK_NO_COND_EXEC)
/* Macro to define tables used to set the flags.
This is a list in braces of pairs in braces,
each pair being { "NAME", VALUE }
where VALUE is the bits to set or minus the bits to clear.
An empty string NAME is used to identify the default VALUE. */
#define TARGET_SWITCHES \
{ \
{ "mangle-cpu", TARGET_MASK_MANGLE_CPU }, \
{ "no-mangle-cpu", -TARGET_MASK_MANGLE_CPU }, \
/* { "mangle-cpu-libgcc", TARGET_MASK_MANGLE_CPU_LIBGCC }, */ \
/* { "no-mangle-cpu-libgcc", -TARGET_MASK_MANGLE_CPU_LIBGCC }, */ \
{ "align-loops", TARGET_MASK_ALIGN_LOOPS }, \
{ "no-align-loops", -TARGET_MASK_ALIGN_LOOPS }, \
{ "big-endian", TARGET_MASK_BIG_ENDIAN }, \
{ "little-endian", -TARGET_MASK_BIG_ENDIAN }, \
{ "no-cond-exec", TARGET_MASK_NO_COND_EXEC }, \
SUBTARGET_SWITCHES \
{ "", TARGET_DEFAULT } \
}
#define TARGET_DEFAULT (0)
#define SUBTARGET_SWITCHES
/* Instruction set characteristics.
These are internal macros, set by the appropriate -mcpu= option. */
/* Nonzero means the cpu has a barrel shifter. */
#define TARGET_SHIFTER 0
extern const char *arc_cpu_string;
extern const char *arc_text_string,*arc_data_string,*arc_rodata_string;
#define TARGET_OPTIONS \
{ \
{ "cpu=", &arc_cpu_string, 0}, \
{ "text=", &arc_text_string, 0}, \
{ "data=", &arc_data_string, 0}, \
{ "rodata=", &arc_rodata_string, 0}, \
}
/* Which cpu we're compiling for. */
extern int arc_cpu_type;

34
gcc/config/arc/arc.opt Normal file
View File

@ -0,0 +1,34 @@
malign-loops
Target Undocumented Report Mask(ALIGN_LOOPS)
mbig-endian
Target Undocumented Report RejectNegative Mask(BIG_ENDIAN)
mlittle-endian
Target Undocumented Report RejectNegative InverseMask(BIG_ENDIAN)
mmangle-cpu
Target Report Mask(MANGLE_CPU)
Prepend the name of the cpu to all public symbol names
; mmangle-cpu-libgcc
; Target Undocumented Mask(MANGLE_CPU_LIBGC)
mno-cond-exec
Target Undocumented Report RejectNegative Mask(NO_COND_EXEC)
mcpu=
Target RejectNegative Joined
-mcpu=CPU Compile code for ARC variant CPU
mtext=
Target RejectNegative Joined
-mtext=SECTION Put functions in SECTION
mdata=
Target RejectNegative Joined
-mdata=SECTION Put data in SECTION
mrodata=
Target RejectNegative Joined
-mrodata=SECTION Put read-only data in SECTION