diff options
author | Martin Liska <mliska@suse.cz> | 2018-07-17 11:19:27 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-07-17 09:19:27 +0000 |
commit | e6de53356769e13178975c18b4ce019a800ea946 (patch) | |
tree | 76fa6fbb2e76fcb986efcbb0143316749fbf1e29 /gcc/config/rx | |
parent | 118f2d8bc3e6804996ca2953b86454ec950054bf (diff) | |
download | gcc-e6de53356769e13178975c18b4ce019a800ea946.zip gcc-e6de53356769e13178975c18b4ce019a800ea946.tar.gz gcc-e6de53356769e13178975c18b4ce019a800ea946.tar.bz2 |
Clean up of new format of -falign-FOO.
2018-07-17 Martin Liska <mliska@suse.cz>
* align.h: New file.
* config/alpha/alpha.c (alpha_align_insns_1): Use align_functions directly.
* config/i386/i386.c (ix86_avoid_jump_mispredicts): Use new return type
align_flags of label_to_alignment.
* config/m32r/m32r.h (LOOP_ALIGN): Wrap returned values into align_flags
class.
* config/m68k/m68k.c: Do not use removed align_labels_value and
align_loops_value.
* config/nds32/nds32.h (JUMP_ALIGN): Wrap result into align_flags class.
(LOOP_ALIGN): Likewise.
(LABEL_ALIGN): Likewise.
* config/powerpcspe/powerpcspe.c (TARGET_ASM_LOOP_ALIGN_MAX_SKIP):
Remove not used macro.
(rs6000_loop_align): Change return type to align_flags.
(rs6000_loop_align_max_skip): Remove.
* config/rs6000/rs6000-protos.h (rs6000_loop_align):
Change return type to align_flags.
* config/rs6000/rs6000.c (TARGET_ASM_LOOP_ALIGN_MAX_SKIP):
Remove not used macro.
(rs6000_loop_align): Change return type to align_flags.
(rs6000_loop_align_max_skip): Remove.
* config/rx/rx.h (JUMP_ALIGN): Wrap integer values
* config/rx/rx-protos.h (rx_align_for_label): Make it
static function.
* config/rx/rx.c (rx_align_for_label): Change return type
to align_flags.
(rx_max_skip_for_label): Remove TARGET_ASM_*_ALIGN_MAX_SKIP
macro definitions.
into align_flags class.
(LABEL_ALIGN): Likewise.
(LOOP_ALIGN): Likewise.
* config/s390/s390.c (s390_label_align): Use align_flags
class member.
(s390_asm_output_function_label): Likewise.
* config/sh/sh.c (sh_override_options_after_change):
Use align_flags class directly without macros.
(find_barrier): Likewise.
(barrier_align): Likewise.
(sh_loop_align): Likewise.
* config/spu/spu.c (spu_option_override):
Use align_flags_tuple::get_value instead of removed macros.
(spu_sched_init): Likewise.
* config/spu/spu.h (GTY): Likewise.
* config/visium/visium.c (visium_option_override):
Set "8" as default secondary alignment.
* config/visium/visium.h (SUBALIGN_LOG): Define to 3
in order to guarantee secondary alignment of 8.
* coretypes.h: Include align.h header file.
* doc/tm.texi: Remove TARGET_ASM_JUMP_ALIGN_MAX_SKIP,
TARGET_ASM_LOOP_ALIGN_MAX_SKIP, TARGET_ASM_LABEL_ALIGN_MAX_SKIP
and TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP macros.
* doc/tm.texi.in: Likewise.
* final.c (struct label_alignment): Remove not used structure.
(LABEL_ALIGN): Change type to align_flags.
(LOOP_ALIGN): Likewise.
(JUMP_ALIGN): Likewise.
(default_loop_align_max_skip): Remove.
(default_label_align_max_skip): Likewise.
(default_jump_align_max_skip): Likewise.
(default_label_align_after_barrier_max_skip):
(LABEL_TO_ALIGNMENT): Change to access label_align vector.
(LABEL_TO_MAX_SKIP): Remove.
(label_to_alignment): Return align_flags type instead of integer.
(label_to_max_skip): Remove.
(align_fuzz): Use align_flags type.
(compute_alignments): Use align_flags type and use align_flags::max
to combine multiple alignments.
(grow_label_align): Grow vec instead of C array.
(update_alignments): Assign just LABEL_TO_ALIGNMENT.
(shorten_branches): Use align_flags type and use align_flags::max
to combine multiple alignments.
(final_scan_insn_1): Remove usage of secondary alignment that comes
from label alignment, but instead use proper secondary alignment
which is computed in grow_label_align.
* flags.h (struct align_flags_tuple): Move to align.h.
(struct align_flags): Likewise.
(state_align_loops): Rename to align_loops.
(state_align_jumps): Rename to align_jumps.
(state_align_labels): Rename to align_labels.
(state_align_functions): Rename to align_functions.
(align_loops_log): Remove.
(align_jumps_log): Remove.
(align_labels_log): Remove.
(align_functions_log): Remove.
(align_loops_max_skip): Remove.
(align_jumps_max_skip): Remove.
(align_labels_max_skip): Remove.
(align_functions_max_skip): Remove.
(align_loops_value): Remove.
(align_jumps_value): Remove.
(align_labels_value): Remove.
(align_functions_value): Remove.
* output.h (label_to_alignment): Change return type to align_flags.
(label_to_max_skip): Remove.
* target.def: Remove loop_align_max_skip, label_align_max_skip,
jump_align_max_skip macros.
* targhooks.h (default_loop_align_max_skip): Remove.
(default_label_align_max_skip): Likewise.
(default_jump_align_max_skip): Likewise.
(default_label_align_after_barrier_max_skip): Remove.
* toplev.c (read_log_maxskip): Use ::normalize function.
(parse_N_M): Remove not used argument and also call ::normalize.
(parse_alignment_opts): Do not pass unused arguments.
* varasm.c (assemble_start_function): Use directly align_functions
instead of removed macros.
* system.h: Do not poison removed macros.
2018-07-17 Martin Liska <mliska@suse.cz>
* gcc.target/powerpc/loop_align.c: Update scanned pattern.
From-SVN: r262804
Diffstat (limited to 'gcc/config/rx')
-rw-r--r-- | gcc/config/rx/rx-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/rx/rx.c | 59 | ||||
-rw-r--r-- | gcc/config/rx/rx.h | 6 |
3 files changed, 36 insertions, 31 deletions
diff --git a/gcc/config/rx/rx-protos.h b/gcc/config/rx/rx-protos.h index 0bb885d..7e9817c 100644 --- a/gcc/config/rx/rx-protos.h +++ b/gcc/config/rx/rx-protos.h @@ -50,7 +50,7 @@ private: #ifdef RTX_CODE extern int rx_adjust_insn_length (rtx_insn *, int); -extern int rx_align_for_label (rtx, int); +extern align_flags rx_align_for_label (rtx_insn *, int); extern void rx_emit_stack_popm (rtx *, bool); extern void rx_emit_stack_pushm (rtx *); extern char * rx_gen_move_template (rtx *, bool); diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index af97bef..c2669ed 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -3308,23 +3308,6 @@ rx_match_ccmode (rtx insn, machine_mode cc_mode) return true; } -int -rx_align_for_label (rtx lab, int uses_threshold) -{ - /* This is a simple heuristic to guess when an alignment would not be useful - because the delay due to the inserted NOPs would be greater than the delay - due to the misaligned branch. If uses_threshold is zero then the alignment - is always useful. */ - if (LABEL_P (lab) && LABEL_NUSES (lab) < uses_threshold) - return 0; - - if (optimize_size) - return 0; - /* These values are log, not bytes. */ - if (rx_cpu_type == RX100 || rx_cpu_type == RX200) - return 2; /* 4 bytes */ - return 3; /* 8 bytes */ -} static int rx_max_skip_for_label (rtx_insn *lab) @@ -3350,10 +3333,41 @@ rx_max_skip_for_label (rtx_insn *lab) opsize = get_attr_length (op); if (opsize >= 0 && opsize < 8) - return opsize - 1; + return MAX (0, opsize - 1); return 0; } +static int +rx_align_log_for_label (rtx_insn *lab, int uses_threshold) +{ + /* This is a simple heuristic to guess when an alignment would not be useful + because the delay due to the inserted NOPs would be greater than the delay + due to the misaligned branch. If uses_threshold is zero then the alignment + is always useful. */ + if (LABEL_P (lab) && LABEL_NUSES (lab) < uses_threshold) + return 0; + + if (optimize_size) + return 0; + + /* Return zero if max_skip not a positive number. */ + int max_skip = rx_max_skip_for_label (lab); + if (max_skip <= 0) + return 0; + + /* These values are log, not bytes. */ + if (rx_cpu_type == RX100 || rx_cpu_type == RX200) + return 2; /* 4 bytes */ + return 3; /* 8 bytes */ +} + +align_flags +rx_align_for_label (rtx_insn *lab, int uses_threshold) +{ + return align_flags (rx_align_log_for_label (lab, uses_threshold), + rx_max_skip_for_label (lab)); +} + /* Compute the real length of the extending load-and-op instructions. */ int @@ -3633,15 +3647,6 @@ rx_modes_tieable_p (machine_mode mode1, machine_mode mode2) #undef TARGET_CAN_INLINE_P #define TARGET_CAN_INLINE_P rx_ok_to_inline -#undef TARGET_ASM_JUMP_ALIGN_MAX_SKIP -#define TARGET_ASM_JUMP_ALIGN_MAX_SKIP rx_max_skip_for_label -#undef TARGET_ASM_LOOP_ALIGN_MAX_SKIP -#define TARGET_ASM_LOOP_ALIGN_MAX_SKIP rx_max_skip_for_label -#undef TARGET_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP -#define TARGET_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP rx_max_skip_for_label -#undef TARGET_ASM_LABEL_ALIGN_MAX_SKIP -#define TARGET_ASM_LABEL_ALIGN_MAX_SKIP rx_max_skip_for_label - #undef TARGET_FUNCTION_VALUE #define TARGET_FUNCTION_VALUE rx_function_value diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h index 2f5a0e9..c87bb96 100644 --- a/gcc/config/rx/rx.h +++ b/gcc/config/rx/rx.h @@ -417,9 +417,9 @@ typedef unsigned int CUMULATIVE_ARGS; /* Compute the alignment needed for label X in various situations. If the user has specified an alignment then honour that, otherwise use rx_align_for_label. */ -#define JUMP_ALIGN(x) (align_jumps_log > 0 ? align_jumps_log : rx_align_for_label (x, 0)) -#define LABEL_ALIGN(x) (align_labels_log > 0 ? align_labels_log : rx_align_for_label (x, 3)) -#define LOOP_ALIGN(x) (align_loops_log > 0 ? align_loops_log : rx_align_for_label (x, 2)) +#define JUMP_ALIGN(x) (align_jumps.levels[0].log > 0 ? align_jumps : align_flags (rx_align_for_label (x, 0))) +#define LABEL_ALIGN(x) (align_labels.levels[0].log > 0 ? align_labels : align_flags (rx_align_for_label (x, 3))) +#define LOOP_ALIGN(x) (align_loops.levels[0].log > 0 ? align_loops : align_flags (rx_align_for_label (x, 2))) #define LABEL_ALIGN_AFTER_BARRIER(x) rx_align_for_label (x, 0) #define ASM_OUTPUT_MAX_SKIP_ALIGN(STREAM, LOG, MAX_SKIP) \ |