Re: *_ALIGN_MAX_SKIP macros

2010-10-19 Thread DJ Delorie

> This is OK if you add LABEL_ALIGN_MAX_SKIP, LOOP_ALIGN_MAX_SKIP,
> LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP, and JUMP_ALIGN_MAX_SKIP to the
> 
> /* Old target macros that have moved to the target hooks structure.  */
> 
> #pragma GCC poison list in system.h.

Thanks, committed with that change.


Re: *_ALIGN_MAX_SKIP macros

2010-10-12 Thread Ian Lance Taylor
DJ Delorie  writes:

>   * doc/tm.texi.in (TARGET_ASM_JUMP_ALIGN_MAX_SKIP): New.
>   (TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP): Change to hook.
>   (TARGET_ASM_LOOP_ALIGN_MAX_SKIP): Likewise.
>   (TARGET_ASM_LABEL_ALIGN_MAX_SKIP): Likewise.
>
>   * targhooks.h (default_label_align_after_barrier_max_skip,
>   default_loop_align_max_skip, default_label_align_max_skip,
>   default_jump_align_max_skip): Declare.
>
>   * target.def (label_align_after_barrier_max_skip): New.
>   (loop_align_max_skip): New.
>   (label_align_max_skip): New.
>   (jump_align_max_skip): New.
>
>   * final.c (LABEL_ALIGN_MAX_SKIP): Remove.
>   (LOOP_ALIGN_MAX_SKIP): Remove.
>   (LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP): Remove.
>   (JUMP_ALIGN_MAX_SKIP): Remove.
>   (default_label_align_after_barrier_max_skip): New.
>   (default_loop_align_max_skip): New.
>   (default_label_align_max_skip): New.
>   (default_jump_align_max_skip): New.
>   (compute_alignments): Use the new hooks.
>   (shorten_branches): Likewise.

This is OK if you add LABEL_ALIGN_MAX_SKIP, LOOP_ALIGN_MAX_SKIP,
LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP, and JUMP_ALIGN_MAX_SKIP to the

/* Old target macros that have moved to the target hooks structure.  */

#pragma GCC poison list in system.h.

Thanks.

Ian


Re: *_ALIGN_MAX_SKIP macros

2010-10-05 Thread DJ Delorie

> DJ Delorie  writes:
> >  JUMP_ALIGN_MAX_SKIP
> >  LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
> >  LOOP_ALIGN_MAX_SKIP
> >  LABEL_ALIGN_MAX_SKIP
> >
> > None of these macros take any parameters, but for optimal performance
> > on RX, it's key to match the max_skip with the size of the following
> > opcode - there's a penalty only if you branch to an opcode which spans
> > fetch groups, but it's the same penalty as running a NOP opcode, so
> > you don't want to add nops if you don't have to.
> >
> > Can we extend those macros to take the label as a parameter?  From
> > that, the backend could find the next actual insn.
> 
> Seems fine to me.  Looks like none of the existing targets define them
> directly anyhow.
> 
> If you do this, though, turn them into target hooks.  They are currently
> fields in target_flag_state.

How's this?

* doc/tm.texi.in (TARGET_ASM_JUMP_ALIGN_MAX_SKIP): New.
(TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP): Change to hook.
(TARGET_ASM_LOOP_ALIGN_MAX_SKIP): Likewise.
(TARGET_ASM_LABEL_ALIGN_MAX_SKIP): Likewise.

* targhooks.h (default_label_align_after_barrier_max_skip,
default_loop_align_max_skip, default_label_align_max_skip,
default_jump_align_max_skip): Declare.

* target.def (label_align_after_barrier_max_skip): New.
(loop_align_max_skip): New.
(label_align_max_skip): New.
(jump_align_max_skip): New.

* final.c (LABEL_ALIGN_MAX_SKIP): Remove.
(LOOP_ALIGN_MAX_SKIP): Remove.
(LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP): Remove.
(JUMP_ALIGN_MAX_SKIP): Remove.
(default_label_align_after_barrier_max_skip): New.
(default_loop_align_max_skip): New.
(default_label_align_max_skip): New.
(default_jump_align_max_skip): New.
(compute_alignments): Use the new hooks.
(shorten_branches): Likewise.

Index: doc/tm.texi.in
===
--- doc/tm.texi.in  (revision 164701)
+++ doc/tm.texi.in  (working copy)
@@ -8893,26 +8893,32 @@ define the macro.
 Unless it's necessary to inspect the @var{label} parameter, it is better
 to set the variable @var{align_jumps} in the target's
 @code{TARGET_OPTION_OVERRIDE}.  Otherwise, you should try to honor the user's
 selection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation.
 @end defmac
 
+...@hook TARGET_ASM_JUMP_ALIGN_MAX_SKIP
+The maximum number of bytes to skip before @var{label} when applying
+...@code{jump_align}.  This works only if
+...@code{asm_output_max_skip_align} is defined.
+...@end deftypefn
+
 @defmac LABEL_ALIGN_AFTER_BARRIER (@var{label})
 The alignment (log base 2) to put in front of @var{label}, which follows
 a @code{BARRIER}.
 
 This macro need not be defined if you don't want any special alignment
 to be done at such a time.  Most machine descriptions do not currently
 define the macro.
 @end defmac
 
-...@defmac LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
-The maximum number of bytes to skip when applying
+...@hook TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
+The maximum number of bytes to skip before @var{label} when applying
 @code{LABEL_ALIGN_AFTER_BARRIER}.  This works only if
 @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
-...@end defmac
+...@end deftypefn
 
 @defmac LOOP_ALIGN (@var{label})
 The alignment (log base 2) to put in front of @var{label}, which follows
 a @code{NOTE_INSN_LOOP_BEG} note.
 
 This macro need not be defined if you don't want any special alignment
@@ -8922,32 +8928,34 @@ define the macro.
 Unless it's necessary to inspect the @var{label} parameter, it is better
 to set the variable @code{align_loops} in the target's
 @code{TARGET_OPTION_OVERRIDE}.  Otherwise, you should try to honor the user's
 selection in @code{align_loops} in a @code{LOOP_ALIGN} implementation.
 @end defmac
 
-...@defmac LOOP_ALIGN_MAX_SKIP
-The maximum number of bytes to skip when applying @code{LOOP_ALIGN}.
-This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
-...@end defmac
+...@hook TARGET_ASM_LOOP_ALIGN_MAX_SKIP
+The maximum number of bytes to skip when applying @code{LOOP_ALIGN} to
+...@var{label}.  This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is
+defined.
+...@end deftypefn
 
 @defmac LABEL_ALIGN (@var{label})
 The alignment (log base 2) to put in front of @var{label}.
 If @code{LABEL_ALIGN_AFTER_BARRIER} / @code{LOOP_ALIGN} specify a different 
alignment,
 the maximum of the specified values is used.
 
 Unless it's necessary to inspect the @var{label} parameter, it is better
 to set the variable @code{align_labels} in the target's
 @code{TARGET_OPTION_OVERRIDE}.  Otherwise, you should try to honor the user's
 selection in @code{align_labels} in a @code{LABEL_ALIGN} implementation.
 @end defmac
 
-...@defmac LABEL_ALIGN_MAX_SKIP
-The maximum number of bytes to skip when applying @code{LABEL_ALIGN}.
-This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
-...@end defmac
+...@hook TARG

Re: *_ALIGN_MAX_SKIP macros

2010-07-27 Thread Ian Lance Taylor
DJ Delorie  writes:

>  JUMP_ALIGN_MAX_SKIP
>  LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
>  LOOP_ALIGN_MAX_SKIP
>  LABEL_ALIGN_MAX_SKIP
>
> None of these macros take any parameters, but for optimal performance
> on RX, it's key to match the max_skip with the size of the following
> opcode - there's a penalty only if you branch to an opcode which spans
> fetch groups, but it's the same penalty as running a NOP opcode, so
> you don't want to add nops if you don't have to.
>
> Can we extend those macros to take the label as a parameter?  From
> that, the backend could find the next actual insn.

Seems fine to me.  Looks like none of the existing targets define them
directly anyhow.

If you do this, though, turn them into target hooks.  They are currently
fields in target_flag_state.

Ian


*_ALIGN_MAX_SKIP macros

2010-07-27 Thread DJ Delorie

 JUMP_ALIGN_MAX_SKIP
 LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
 LOOP_ALIGN_MAX_SKIP
 LABEL_ALIGN_MAX_SKIP

None of these macros take any parameters, but for optimal performance
on RX, it's key to match the max_skip with the size of the following
opcode - there's a penalty only if you branch to an opcode which spans
fetch groups, but it's the same penalty as running a NOP opcode, so
you don't want to add nops if you don't have to.

Can we extend those macros to take the label as a parameter?  From
that, the backend could find the next actual insn.