Commit 2148624a by J"orn Rennecke Committed by Joern Rennecke

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
parent 69972997
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> 2000-02-22 Andrew Haley <aph@cygnus.com>
* config/mips/mips.h (GAS_ASM_SPEC): Pass -mgp32/-mgp64 to gas. * config/mips/mips.h (GAS_ASM_SPEC): Pass -mgp32/-mgp64 to gas.
......
...@@ -36,6 +36,7 @@ extern const char *output_far_jump PARAMS ((rtx, rtx)); ...@@ -36,6 +36,7 @@ extern const char *output_far_jump PARAMS ((rtx, rtx));
extern void machine_dependent_reorg PARAMS ((rtx)); extern void machine_dependent_reorg PARAMS ((rtx));
extern struct rtx_def *sfunc_uses_reg PARAMS ((rtx)); extern struct rtx_def *sfunc_uses_reg PARAMS ((rtx));
extern int barrier_align 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_zero_operand PARAMS ((rtx));
extern int fp_one_operand PARAMS ((rtx)); extern int fp_one_operand PARAMS ((rtx));
extern int fp_int_operand PARAMS ((rtx)); extern int fp_int_operand PARAMS ((rtx));
......
...@@ -2786,6 +2786,30 @@ barrier_align (barrier_or_label) ...@@ -2786,6 +2786,30 @@ barrier_align (barrier_or_label)
return CACHE_LOG; 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. /* Exported to toplev.c.
Do a final pass over the function, just before delayed branch Do a final pass over the function, just before delayed branch
......
...@@ -351,7 +351,8 @@ do { \ ...@@ -351,7 +351,8 @@ do { \
barrier_align (LABEL_AFTER_BARRIER) barrier_align (LABEL_AFTER_BARRIER)
#define LOOP_ALIGN(A_LABEL) \ #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) \ #define LABEL_ALIGN(A_LABEL) \
( \ ( \
......
...@@ -1134,7 +1134,7 @@ shorten_branches (first) ...@@ -1134,7 +1134,7 @@ shorten_branches (first)
break; break;
else if (GET_CODE (label) == CODE_LABEL) else if (GET_CODE (label) == CODE_LABEL)
{ {
log = LOOP_ALIGN (insn); log = LOOP_ALIGN (label);
if (max_log < log) if (max_log < log)
{ {
max_log = log; max_log = log;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment