diff options
author | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-01 05:49:16 +0000 |
---|---|---|
committer | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-01 05:49:16 +0000 |
commit | 2ef7687b7b3f425f303f876738212a0f0ee883fb (patch) | |
tree | 3748c4b19fefbeba9a6320eb38c3640e4c85681f /gcc/config/cris/cris.h | |
parent | 4f2e7aceb7414af39652beeaef7fe213b170d8f6 (diff) | |
download | gcc-2ef7687b7b3f425f303f876738212a0f0ee883fb.tar.gz |
Add CRIS atomic patterns for 1, 2, and 4 bytes.
* config/cris/cris.c (cris_emit_trap_for_misalignment): New function.
* config/cris/cris-protos.h: Declare it.
* config/cris/cris.h [!TARGET_DEFAULT, TARGET_CPU_DEFAULT == 32]
(TARGET_DEFAULT): Add alignment by 32.
[!TARGET_DEFAULT, TARGET_CPU_DEFAULT == 10] (TARGET_DEFAULT): New
case, as TARGET_CPU_DEFAULT == 0 but with alignment as for
TARGET_CPU_DEFAULT == 32.
(TARGET_TRAP_UNALIGNED_ATOMIC): New macro.
* config/cris/cris.md: Include sync.md. Avoid allocating specific
numbers by replacing the define_constants for all UNSPECs with the
equivalent define_c_enum construct.
* config/cris/cris.opt (mtrap-unaligned-atomic): New option.
* config/cris/sync.md: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188096 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/cris/cris.h')
-rw-r--r-- | gcc/config/cris/cris.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 78fbe684078..0660b494a49 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -286,15 +286,25 @@ extern int cris_cpu_version; #define TARGET_CPU_DEFAULT CRIS_CPU_BASE #endif -/* Default target_flags if no switches specified. */ +/* Default target_flags if no switches specified. + The alignment-by-32 is to make builtin atomic support for v10 and v32 + work for *-elf for types without specified alignment (like plain + "int"). See top comment in sync.md. */ #ifndef TARGET_DEFAULT # if TARGET_CPU_DEFAULT == 32 # define TARGET_DEFAULT \ (MASK_STACK_ALIGN \ + MASK_CONST_ALIGN + MASK_DATA_ALIGN \ + + MASK_ALIGN_BY_32 \ + MASK_PROLOGUE_EPILOGUE) -# else /* 10 */ -# define TARGET_DEFAULT \ +# elif TARGET_CPU_DEFAULT == 10 +# define TARGET_DEFAULT \ + (MASK_SIDE_EFFECT_PREFIXES + MASK_STACK_ALIGN \ + + MASK_CONST_ALIGN + MASK_DATA_ALIGN \ + + MASK_ALIGN_BY_32 \ + + MASK_PROLOGUE_EPILOGUE + MASK_MUL_BUG) +# else /* 0 */ +# define TARGET_DEFAULT \ (MASK_SIDE_EFFECT_PREFIXES + MASK_STACK_ALIGN \ + MASK_CONST_ALIGN + MASK_DATA_ALIGN \ + MASK_PROLOGUE_EPILOGUE + MASK_MUL_BUG) @@ -314,6 +324,16 @@ extern int cris_cpu_version; #define TARGET_TRAP_USING_BREAK8 \ (cris_trap_using_break8 == 2 ? TARGET_HAS_BREAK : cris_trap_using_break8) +/* The < v10 atomics turn off interrupts, so they don't need alignment. + Incidentally, by default alignment is off there causing variables to + be default unaligned all over, so we'd have to make support + libraries use a proper atomic type (instead of "int"), one we'd + specify as aligned. */ +#define TARGET_TRAP_UNALIGNED_ATOMIC \ + (cris_trap_unaligned_atomic == 2 \ + ? (TARGET_V32 || cris_cpu_version == 10) \ + : cris_trap_unaligned_atomic) + /* Node: Storage Layout */ #define BITS_BIG_ENDIAN 0 |