aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/cris/cris.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/cris/cris.h')
-rw-r--r--gcc/config/cris/cris.h92
1 files changed, 66 insertions, 26 deletions
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h
index 4aa88466c80..10ae4aa3587 100644
--- a/gcc/config/cris/cris.h
+++ b/gcc/config/cris/cris.h
@@ -1,5 +1,5 @@
/* Definitions for GCC. Part of the machine description for CRIS.
- Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Axis Communications. Written by Hans-Peter Nilsson.
This file is part of GCC.
@@ -115,18 +115,8 @@ extern const char *cris_elinux_stacksize_str;
/* Also provide canonical vN definitions when user specifies an alias.
Note that -melf overrides -maout. */
-/* The `-$' is here mostly due to the integrated preprocessor not
- handling the builtin expansion of "#define __REGISTER_PREFIX__ $"
- gracefully. This is slightly redundant although not incorrect.
- We're quite alone defining REGISTER_PREFIX as "$" so it's unlikely
- someone will fight for us. This year in the mountains.
- Note that for -melinux and -mlinux, command-line -isystem options are
- emitted both before and after the synthesized one. We can't remove all
- of them: a %{<isystem} will only remove the first one and %{<isystem*}
- will not do TRT. Those extra occurrences are harmless anyway. */
#define CPP_SPEC \
- "-$ -D__CRIS_ABI_version=2\
- %{mtune=*:-D__tune_%* %{mtune=v*:-D__CRIS_arch_tune=%*}}\
+ "%{mtune=*:-D__tune_%* %{mtune=v*:-D__CRIS_arch_tune=%*}}\
%{mtune=etrax4:-D__tune_v3 -D__CRIS_arch_tune=3}\
%{mtune=etrax100:-D__tune_v8 -D__CRIS_arch_tune=8}\
%{mtune=svinto:-D__tune_v8 -D__CRIS_arch_tune=8}\
@@ -150,8 +140,7 @@ extern const char *cris_elinux_stacksize_str;
/* For the cris-*-elf subtarget. */
#define CRIS_CPP_SUBTARGET_SPEC \
- "-D__ELF__\
- %{mbest-lib-options:\
+ "%{mbest-lib-options:\
%{!moverride-best-lib-options:\
%{!march=*:%{!metrax*:%{!mcpu=*:-D__tune_v10 -D__CRIS_arch_tune=10}}}}}"
@@ -181,9 +170,17 @@ extern const char *cris_elinux_stacksize_str;
%{!melinux:%{!maout|melf:%{!fno-vtable-gc:-fvtable-gc}}}}}". */
#define CC1PLUS_SPEC ""
+#ifdef HAVE_AS_MUL_BUG_ABORT_OPTION
+#define MAYBE_AS_NO_MUL_BUG_ABORT \
+ "%{mno-mul-bug-workaround:-no-mul-bug-abort} "
+#else
+#define MAYBE_AS_NO_MUL_BUG_ABORT
+#endif
+
/* Override previous definitions (linux.h). */
#undef ASM_SPEC
#define ASM_SPEC \
+ MAYBE_AS_NO_MUL_BUG_ABORT \
"%{v:-v}\
%(asm_subtarget)"
@@ -255,8 +252,23 @@ extern const char *cris_elinux_stacksize_str;
/* Node: Run-time Target */
-/* Only keep the non-varying ones here. */
-#define CPP_PREDEFINES "-Dcris -DCRIS -DGNU_CRIS"
+#define TARGET_CPU_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define_std ("cris"); \
+ builtin_define_std ("CRIS"); \
+ builtin_define_std ("GNU_CRIS"); \
+ builtin_define ("__CRIS_ABI_version=2"); \
+ } \
+ while (0)
+
+#define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("__ELF__"); \
+ } \
+ while (0)
+
/* This needs to be at least 32 bits. */
extern int target_flags;
@@ -327,8 +339,34 @@ extern int target_flags;
#define TARGET_MASK_AVOID_GOTPLT 8192
#define TARGET_AVOID_GOTPLT (target_flags & TARGET_MASK_AVOID_GOTPLT)
+/* Whether or not to work around multiplication instruction hardware bug
+ when generating code for models where it may be present. From the
+ trouble report for Etrax 100 LX: "A multiply operation may cause
+ incorrect cache behaviour under some specific circumstances. The
+ problem can occur if the instruction following the multiply instruction
+ causes a cache miss, and multiply operand 1 (source operand) bits
+ [31:27] matches the logical mapping of the mode register address
+ (0xb0....), and bits [9:2] of operand 1 matches the TLB register
+ address (0x258-0x25f). There is such a mapping in kernel mode or when
+ the MMU is off. Normally there is no such mapping in user mode, and
+ the problem will therefore probably not occur in Linux user mode
+ programs."
+
+ We have no sure-fire way to know from within GCC that we're compiling a
+ user program. For example, -fpic/PIC is used in libgcc which is linked
+ into the kernel. However, the workaround option -mno-mul-bug can be
+ safely used per-package when compiling programs. The same goes for
+ general user-only libraries such as glibc, since there's no user-space
+ driver-like program that gets a mapping of I/O registers (all on the
+ same page, including the TLB registers). */
+#define TARGET_MASK_MUL_BUG 16384
+#define TARGET_MUL_BUG (target_flags & TARGET_MASK_MUL_BUG)
+
#define TARGET_SWITCHES \
{ \
+ {"mul-bug-workaround", TARGET_MASK_MUL_BUG, \
+ N_("Work around bug in multiplication instruction")}, \
+ {"no-mul-bug-workaround", -TARGET_MASK_MUL_BUG, ""}, \
/* No "no-etrax" as it does not really imply any model. \
On the other hand, "etrax" implies the common (and large) \
subset matching all models. */ \
@@ -406,7 +444,7 @@ extern int target_flags;
# define TARGET_DEFAULT \
(TARGET_MASK_SIDE_EFFECT_PREFIXES + TARGET_MASK_STACK_ALIGN \
+ TARGET_MASK_CONST_ALIGN + TARGET_MASK_DATA_ALIGN \
- + TARGET_MASK_PROLOGUE_EPILOGUE)
+ + TARGET_MASK_PROLOGUE_EPILOGUE + TARGET_MASK_MUL_BUG)
#endif
/* For the cris-*-elf subtarget. */
@@ -956,9 +994,8 @@ enum reg_class {NO_REGS, ALL_REGS, LIM_REG_CLASSES};
struct cum_args {int regs;};
/* The regs member is an integer, the number of arguments got into
- registers so far, and lib is nonzero if init_cumulative_args was
- found to generate a call to a library function. */
-#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
+ registers so far. */
+#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \
((CUM).regs = 0)
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
@@ -1246,8 +1283,7 @@ struct cum_args {int regs;};
FIXME: Check and adjust for gcc-2.9x. */
#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) {}
-/* Functionality import from EGCS.
- Kludge to solve Axis-990219: Work around imperfection in
+/* Kludge to solve Axis-990219: Work around imperfection in
reload_load_address1:
(plus (sign_extend (mem:qi (reg))) (reg))
should be reloaded as (plus (reg) (reg)), not
@@ -1255,9 +1291,8 @@ struct cum_args {int regs;};
There are no checks that reload_load_address_1 "reloads"
addresses correctly, so invalidness is not caught or
corrected.
- When the right thing happens, the "something_reloaded" kludge can
- be removed. The right thing does not appear to happen for
- EGCS CVS as of this date (above). */
+ When the right thing happens in reload, the kludge can
+ be removed; still not as of 2003-02-27. */
#define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, IND_LEVELS, WIN) \
do \
@@ -1621,7 +1656,8 @@ call_ ## FUNC (void) \
cris_print_operand (FILE, X, CODE)
/* For delay-slot handling. */
-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) (CODE == '#')
+#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
+ ((CODE) == '#' || (CODE) == '!')
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
cris_print_operand_address (FILE, ADDR)
@@ -1733,10 +1769,14 @@ call_ ## FUNC (void) \
{PLUS, IOR, AND, UMIN}}, \
{"cris_operand_extend_operator", \
{PLUS, MINUS, UMIN}}, \
+ {"cris_additive_operand_extend_operator", \
+ {PLUS, MINUS}}, \
{"cris_extend_operator", \
{ZERO_EXTEND, SIGN_EXTEND}}, \
{"cris_plus_or_bound_operator", \
{PLUS, UMIN}}, \
+ {"cris_mem_op", \
+ {MEM}}, \
{"cris_bdap_operand", \
{SUBREG, REG, LABEL_REF, SYMBOL_REF, MEM, CONST_INT, \
CONST_DOUBLE, CONST, SIGN_EXTEND}}, \