diff options
author | J"orn Rennecke <amylaar@cygnus.co.uk> | 2000-02-23 17:18:15 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2000-02-23 17:18:15 +0000 |
commit | 2148624a44cb575edab51bf505687e4f8ca6445d (patch) | |
tree | 8baf5d722de68518d2c8e380ff3c3c6fb2dd680f | |
parent | 699729979c5feecfdf5dfc50e1991b3732cbd040 (diff) | |
download | gcc-2148624a44cb575edab51bf505687e4f8ca6445d.zip gcc-2148624a44cb575edab51bf505687e4f8ca6445d.tar.gz gcc-2148624a44cb575edab51bf505687e4f8ca6445d.tar.bz2 |
final.c (shorten_branches): Make value passed to LABEL_ALIGN conform to documentation.
* final.c (shorten_branches): Make value passed to LABEL_ALIGN
conform to documentation.
* sh.h (LABEL_ALIGN): If aligning loops, call sh_label_align
to check for special cases.
* sh-protos.h (sh_label_align): Declare.
* sh.c (sh_label_align): Define.
From-SVN: r32114
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/sh/sh-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/sh/sh.c | 24 | ||||
-rw-r--r-- | gcc/config/sh/sh.h | 3 | ||||
-rw-r--r-- | gcc/final.c | 2 |
5 files changed, 37 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6a7833b5..fa8f35e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +Wed Feb 23 16:42:21 2000 J"orn Rennecke <amylaar@cygnus.co.uk> + + * final.c (shorten_branches): Make value passed to LABEL_ALIGN + conform to documentation. + * sh.h (LABEL_ALIGN): If aligning loops, call sh_label_align + to check for special cases. + * sh-protos.h (sh_label_align): Declare. + * sh.c (sh_label_align): Define. + 2000-02-22 Andrew Haley <aph@cygnus.com> * config/mips/mips.h (GAS_ASM_SPEC): Pass -mgp32/-mgp64 to gas. diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h index bb96225..273444b 100644 --- a/gcc/config/sh/sh-protos.h +++ b/gcc/config/sh/sh-protos.h @@ -36,6 +36,7 @@ extern const char *output_far_jump PARAMS ((rtx, rtx)); extern void machine_dependent_reorg PARAMS ((rtx)); extern struct rtx_def *sfunc_uses_reg PARAMS ((rtx)); extern int barrier_align PARAMS ((rtx)); +extern int sh_loop_align PARAMS ((rtx)); extern int fp_zero_operand PARAMS ((rtx)); extern int fp_one_operand PARAMS ((rtx)); extern int fp_int_operand PARAMS ((rtx)); diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 696c73c..8c10ca5 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -2786,6 +2786,30 @@ barrier_align (barrier_or_label) return CACHE_LOG; } +/* If we are inside a phony loop, almost any kind of label can turn up as the + first one in the loop. Aligning a braf label causes incorrect switch + destination addresses; we can detect braf labels because they are + followed by a BARRIER. + Applying loop alignment to small constant or switch tables is a waste + of space, so we suppress this too. */ +int +sh_loop_align (label) + rtx label; +{ + rtx next = label; + + do + next = next_nonnote_insn (next); + while (next && GET_CODE (next) == CODE_LABEL); + + if (! next + || GET_RTX_CLASS (GET_CODE (next)) != 'i' + || GET_CODE (PATTERN (next)) == ADDR_DIFF_VEC + || recog_memoized (next) == CODE_FOR_consttable_2) + return 0; + return 2; +} + /* Exported to toplev.c. Do a final pass over the function, just before delayed branch diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index ac80d28..808febf 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -351,7 +351,8 @@ do { \ barrier_align (LABEL_AFTER_BARRIER) #define LOOP_ALIGN(A_LABEL) \ - ((! optimize || TARGET_HARVARD || TARGET_SMALLCODE) ? 0 : 2) + ((! optimize || TARGET_HARVARD || TARGET_SMALLCODE) \ + ? 0 : sh_loop_align (A_LABEL)) #define LABEL_ALIGN(A_LABEL) \ ( \ diff --git a/gcc/final.c b/gcc/final.c index c38b5ae..d5096fb 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1134,7 +1134,7 @@ shorten_branches (first) break; else if (GET_CODE (label) == CODE_LABEL) { - log = LOOP_ALIGN (insn); + log = LOOP_ALIGN (label); if (max_log < log) { max_log = log; |