aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog26
-rw-r--r--gcc/doc/tm.texi30
-rw-r--r--gcc/doc/tm.texi.in30
-rw-r--r--gcc/final.c51
-rw-r--r--gcc/system.h4
-rw-r--r--gcc/target.def32
-rw-r--r--gcc/targhooks.h5
7 files changed, 134 insertions, 44 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5831956..9260c60 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,29 @@
+2010-10-19 DJ Delorie <dj@redhat.com>
+
+ * 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.
+ * doc/tm.texi: Regenerate.
+ * 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.
+ * system.h (poison): Add those macros to the list.
+ * 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.
+
2010-10-19 Richard Henderson <rth@redhat.com>
* config/i386/i386.c (bdesc_multi_arg): Use fma4i_fmadd_<mode>.
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 941e2e1..a4f33a7 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -8978,6 +8978,12 @@ to set the variable @var{align_jumps} in the target's
selection in @var{align_jumps} in a @code{JUMP_ALIGN} implementation.
@end defmac
+@deftypefn {Target Hook} int TARGET_ASM_JUMP_ALIGN_MAX_SKIP (rtx @var{label})
+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}.
@@ -8987,11 +8993,11 @@ 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
+@deftypefn {Target Hook} int TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP (rtx @var{label})
+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
@@ -9007,10 +9013,11 @@ to set the variable @code{align_loops} in the target'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
+@deftypefn {Target Hook} int TARGET_ASM_LOOP_ALIGN_MAX_SKIP (rtx @var{label})
+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}.
@@ -9023,10 +9030,11 @@ to set the variable @code{align_labels} in the target'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
+@deftypefn {Target Hook} int TARGET_ASM_LABEL_ALIGN_MAX_SKIP (rtx @var{label})
+The maximum number of bytes to skip when applying @code{LABEL_ALIGN}
+to @var{label}. This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN}
+is defined.
+@end deftypefn
@defmac ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
A C statement to output to the stdio stream @var{stream} an assembler
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index 604802b..a9592b1 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -8958,6 +8958,12 @@ to set the variable @var{align_jumps} in the target'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}.
@@ -8967,11 +8973,11 @@ 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
@@ -8987,10 +8993,11 @@ to set the variable @code{align_loops} in the target'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}.
@@ -9003,10 +9010,11 @@ to set the variable @code{align_labels} in the target'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 TARGET_ASM_LABEL_ALIGN_MAX_SKIP
+The maximum number of bytes to skip when applying @code{LABEL_ALIGN}
+to @var{label}. This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN}
+is defined.
+@end deftypefn
@defmac ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
A C statement to output to the stdio stream @var{stream} an assembler
diff --git a/gcc/final.c b/gcc/final.c
index 5409a3d..fb4ab26 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -68,6 +68,7 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "basic-block.h"
#include "target.h"
+#include "targhooks.h"
#include "debug.h"
#include "expr.h"
#include "cfglayout.h"
@@ -497,33 +498,41 @@ get_attr_min_length (rtx insn)
#define LABEL_ALIGN(LABEL) align_labels_log
#endif
-#ifndef LABEL_ALIGN_MAX_SKIP
-#define LABEL_ALIGN_MAX_SKIP align_labels_max_skip
-#endif
-
#ifndef LOOP_ALIGN
#define LOOP_ALIGN(LABEL) align_loops_log
#endif
-#ifndef LOOP_ALIGN_MAX_SKIP
-#define LOOP_ALIGN_MAX_SKIP align_loops_max_skip
-#endif
-
#ifndef LABEL_ALIGN_AFTER_BARRIER
#define LABEL_ALIGN_AFTER_BARRIER(LABEL) 0
#endif
-#ifndef LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
-#define LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP 0
-#endif
-
#ifndef JUMP_ALIGN
#define JUMP_ALIGN(LABEL) align_jumps_log
#endif
-#ifndef JUMP_ALIGN_MAX_SKIP
-#define JUMP_ALIGN_MAX_SKIP align_jumps_max_skip
-#endif
+int
+default_label_align_after_barrier_max_skip (rtx insn ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+int
+default_loop_align_max_skip (rtx insn ATTRIBUTE_UNUSED)
+{
+ return align_loops_max_skip;
+}
+
+int
+default_label_align_max_skip (rtx insn ATTRIBUTE_UNUSED)
+{
+ return align_labels_max_skip;
+}
+
+int
+default_jump_align_max_skip (rtx insn ATTRIBUTE_UNUSED)
+{
+ return align_jumps_max_skip;
+}
#ifndef ADDR_VEC_ALIGN
static int
@@ -731,7 +740,7 @@ compute_alignments (void)
continue;
}
max_log = LABEL_ALIGN (label);
- max_skip = LABEL_ALIGN_MAX_SKIP;
+ max_skip = targetm.asm_out.label_align_max_skip (label);
FOR_EACH_EDGE (e, ei, bb->preds)
{
@@ -775,7 +784,7 @@ compute_alignments (void)
if (max_log < log)
{
max_log = log;
- max_skip = JUMP_ALIGN_MAX_SKIP;
+ max_skip = targetm.asm_out.jump_align_max_skip (label);
}
}
/* In case block is frequent and reached mostly by non-fallthru edge,
@@ -792,7 +801,7 @@ compute_alignments (void)
if (max_log < log)
{
max_log = log;
- max_skip = LOOP_ALIGN_MAX_SKIP;
+ max_skip = targetm.asm_out.loop_align_max_skip (label);
}
}
LABEL_TO_ALIGNMENT (label) = max_log;
@@ -925,7 +934,7 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
if (max_log < log)
{
max_log = log;
- max_skip = LABEL_ALIGN_MAX_SKIP;
+ max_skip = targetm.asm_out.label_align_max_skip (insn);
}
}
/* ADDR_VECs only take room if read-only data goes into the text
@@ -938,7 +947,7 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
if (max_log < log)
{
max_log = log;
- max_skip = LABEL_ALIGN_MAX_SKIP;
+ max_skip = targetm.asm_out.label_align_max_skip (insn);
}
}
LABEL_TO_ALIGNMENT (insn) = max_log;
@@ -958,7 +967,7 @@ shorten_branches (rtx first ATTRIBUTE_UNUSED)
if (max_log < log)
{
max_log = log;
- max_skip = LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP;
+ max_skip = targetm.asm_out.label_align_after_barrier_max_skip (label);
}
break;
}
diff --git a/gcc/system.h b/gcc/system.h
index 5131fed..7e5b048 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -717,7 +717,9 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
TRAMPOLINE_ADJUST_ADDRESS STATIC_CHAIN STATIC_CHAIN_INCOMING \
RETURN_POPS_ARGS UNITS_PER_SIMD_WORD OVERRIDE_OPTIONS \
OPTIMIZATION_OPTIONS CLASS_LIKELY_SPILLED_P \
- USING_SJLJ_EXCEPTIONS TARGET_UNWIND_INFO
+ USING_SJLJ_EXCEPTIONS TARGET_UNWIND_INFO \
+ LABEL_ALIGN_MAX_SKIP LOOP_ALIGN_MAX_SKIP \
+ LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP JUMP_ALIGN_MAX_SKIP
/* Other obsolete target macros, or macros that used to be in target
headers and were not used, and may be obsolete or may never have
diff --git a/gcc/target.def b/gcc/target.def
index cdfa903..82f3040 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -101,6 +101,38 @@ DEFHOOKPOD
DEFHOOKPOD (aligned_op, "*", struct asm_int_op, TARGET_ASM_ALIGNED_INT_OP)
DEFHOOKPOD (unaligned_op, "*", struct asm_int_op, TARGET_ASM_UNALIGNED_INT_OP)
+/* The maximum number of bytes to skip when applying
+ LABEL_ALIGN_AFTER_BARRIER. */
+DEFHOOK
+(label_align_after_barrier_max_skip,
+ "",
+ int, (rtx label),
+ default_label_align_after_barrier_max_skip)
+
+/* The maximum number of bytes to skip when applying
+ LOOP_ALIGN. */
+DEFHOOK
+(loop_align_max_skip,
+ "",
+ int, (rtx label),
+ default_loop_align_max_skip)
+
+/* The maximum number of bytes to skip when applying
+ LABEL_ALIGN. */
+DEFHOOK
+(label_align_max_skip,
+ "",
+ int, (rtx label),
+ default_label_align_max_skip)
+
+/* The maximum number of bytes to skip when applying
+ JUMP_ALIGN. */
+DEFHOOK
+(jump_align_max_skip,
+ "",
+ int, (rtx label),
+ default_jump_align_max_skip)
+
/* Try to output the assembler code for an integer object whose
value is given by X. SIZE is the size of the object in bytes and
ALIGNED_P indicates whether it is aligned. Return true if
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index f594679..7b640cc 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -162,3 +162,8 @@ extern enum unwind_info_type default_debug_unwind_info (void);
extern enum unwind_info_type default_except_unwind_info (void);
extern enum unwind_info_type dwarf2_except_unwind_info (void);
extern enum unwind_info_type sjlj_except_unwind_info (void);
+
+extern int default_label_align_after_barrier_max_skip (rtx);
+extern int default_loop_align_max_skip (rtx);
+extern int default_label_align_max_skip (rtx);
+extern int default_jump_align_max_skip (rtx);