summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-24 17:25:28 +0000
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-24 17:25:28 +0000
commit9f9a3b393c3b6e7e3baea9e5cba2c43985bec30a (patch)
tree3bb18fefa62c52ec1cc450c0d02be66ce2ddcfc8
parentd9b7a8da48772a435b8ae8cc04871c5c16a306cc (diff)
downloadgcc-9f9a3b393c3b6e7e3baea9e5cba2c43985bec30a.tar.gz
* config/rx/rx.h (LABEL_ALIGN_FOR_BARRIER): Define.
(ASM_OUTPUT_MAX_SKIP_ALIGN): Define. * config/rx/rx.c (rx_option_override): Set align_jumps, align_loops and align_labels if not set by the user. (rx_align_for_label): New function. (rx_max_skip_for_label): New function. (TARGET_ASM_JUMP_ALIGN_MAX_SKIP): Define. (TARGET_ASM_LOOP_ALIGN_MAX_SKIP): Define. (TARGET_ASM_LABEL_ALIGN_MAX_SKIP): Define. (TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP): Define. * config/rx/rx-protos.h (rx_align_for_label): Add prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171420 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config/rx/rx-protos.h1
-rw-r--r--gcc/config/rx/rx.c46
-rw-r--r--gcc/config/rx/rx.h19
4 files changed, 80 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a0b54d12574..046aea78990 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2011-03-24 Nick Clifton <nickc@redhat.com>
+
+ * config/rx/rx.h (LABEL_ALIGN_FOR_BARRIER): Define.
+ (ASM_OUTPUT_MAX_SKIP_ALIGN): Define.
+ * config/rx/rx.c (rx_option_override): Set align_jumps,
+ align_loops and align_labels if not set by the user.
+ (rx_align_for_label): New function.
+ (rx_max_skip_for_label): New function.
+ (TARGET_ASM_JUMP_ALIGN_MAX_SKIP): Define.
+ (TARGET_ASM_LOOP_ALIGN_MAX_SKIP): Define.
+ (TARGET_ASM_LABEL_ALIGN_MAX_SKIP): Define.
+ (TARGET_ASM_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP): Define.
+ * config/rx/rx-protos.h (rx_align_for_label): Add prototype.
+
2011-03-24 Richard Sandiford <richard.sandiford@linaro.org>
PR rtl-optimization/48263
diff --git a/gcc/config/rx/rx-protos.h b/gcc/config/rx/rx-protos.h
index a6ae416e6dc..ab04fdd7ce0 100644
--- a/gcc/config/rx/rx-protos.h
+++ b/gcc/config/rx/rx-protos.h
@@ -26,6 +26,7 @@
#define Fargs CUMULATIVE_ARGS
#define Rcode enum rtx_code
+extern int rx_align_for_label (void);
extern void rx_expand_prologue (void);
extern int rx_initial_elimination_offset (int, int);
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index bec921b1eff..a6a63ac01ab 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -2350,6 +2350,13 @@ rx_option_override (void)
flag_strict_volatile_bitfields = 1;
rx_override_options_after_change ();
+
+ if (align_jumps == 0 && ! optimize_size)
+ align_jumps = 3;
+ if (align_loops == 0 && ! optimize_size)
+ align_loops = 3;
+ if (align_labels == 0 && ! optimize_size)
+ align_labels = 3;
}
/* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */
@@ -2740,8 +2747,47 @@ rx_match_ccmode (rtx insn, enum machine_mode cc_mode)
return true;
}
+
+int
+rx_align_for_label (void)
+{
+ return optimize_size ? 1 : 3;
+}
+
+static int
+rx_max_skip_for_label (rtx lab)
+{
+ int opsize;
+ rtx op;
+
+ if (lab == NULL_RTX)
+ return 0;
+ op = lab;
+ do
+ {
+ op = next_nonnote_nondebug_insn (op);
+ }
+ while (op && (LABEL_P (op)
+ || (INSN_P (op) && GET_CODE (PATTERN (op)) == USE)));
+ if (!op)
+ return 0;
+
+ opsize = get_attr_length (op);
+ if (opsize >= 0 && opsize < 8)
+ return opsize - 1;
+ return 0;
+}
+#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 e3966ed173d..bd54a2b954f 100644
--- a/gcc/config/rx/rx.h
+++ b/gcc/config/rx/rx.h
@@ -413,6 +413,25 @@ typedef unsigned int CUMULATIVE_ARGS;
#undef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX "_"
+#define LABEL_ALIGN_AFTER_BARRIER(x) rx_align_for_label ()
+
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(STREAM, LOG, MAX_SKIP) \
+ do \
+ { \
+ if ((LOG) == 0 || (MAX_SKIP) == 0) \
+ break; \
+ if (TARGET_AS100_SYNTAX) \
+ { \
+ if ((LOG) >= 2) \
+ fprintf (STREAM, "\t.ALIGN 4\t; %d alignment actually requested\n", 1 << (LOG)); \
+ else \
+ fprintf (STREAM, "\t.ALIGN 2\n"); \
+ } \
+ else \
+ fprintf (STREAM, "\t.balign %d,3,%d\n", 1 << (LOG), (MAX_SKIP)); \
+ } \
+ while (0)
+
#define ASM_OUTPUT_ALIGN(STREAM, LOG) \
do \
{ \