diff options
author | J"orn Rennecke <joern.rennecke@st.com> | 2005-09-20 21:48:36 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2005-09-20 22:48:36 +0100 |
commit | 070a7956aa83825d8cdcc0d1b73aa64a0383ce84 (patch) | |
tree | b5aed08c2aba5538d50f0915cdd9050b95ec600d /gcc/final.c | |
parent | 9972f30d1c2b29cdfc35421bbb5f4902ff0a1879 (diff) | |
download | gcc-070a7956aa83825d8cdcc0d1b73aa64a0383ce84.zip gcc-070a7956aa83825d8cdcc0d1b73aa64a0383ce84.tar.gz gcc-070a7956aa83825d8cdcc0d1b73aa64a0383ce84.tar.bz2 |
re PR rtl-optimization/23898 (basic block reordering excessively increases code size; get_uncond_jump_length pessimistic)
PR rtl-optimization/23898
* output.h (get_attr_min_length): Declare.
* final.c (get_attr_length_1): New function, broken out of:
(get_attr_length).
(get_attr_min_length): New function.
* bb-reorder.c (copy_bb_p, get_uncond_jump_length): Use it.
(duplicate_computed_gotos): Likewise.
* genattr.c (insn_min_length): Generate declaration.
* genattrtab.c (min_fn, min_attr_value): New functions.
(make_length_attrs): Generate insn_min_length.
From-SVN: r104468
Diffstat (limited to 'gcc/final.c')
-rw-r--r-- | gcc/final.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/gcc/final.c b/gcc/final.c index e1a4c18..f827069 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -383,10 +383,11 @@ init_insn_lengths (void) } /* Obtain the current length of an insn. If branch shortening has been done, - get its actual length. Otherwise, get its maximum length. */ - -int -get_attr_length (rtx insn ATTRIBUTE_UNUSED) + get its actual length. Otherwise, use FALLBACK_FN to calcualte the + length. */ +static inline int +get_attr_length_1 (rtx insn ATTRIBUTE_UNUSED, + int (*fallback_fn) (rtx) ATTRIBUTE_UNUSED) { #ifdef HAVE_ATTR_length rtx body; @@ -404,7 +405,7 @@ get_attr_length (rtx insn ATTRIBUTE_UNUSED) return 0; case CALL_INSN: - length = insn_default_length (insn); + length = fallback_fn (insn); break; case JUMP_INSN: @@ -415,7 +416,7 @@ get_attr_length (rtx insn ATTRIBUTE_UNUSED) ADDR_VEC_ALIGN. */ } else - length = insn_default_length (insn); + length = fallback_fn (insn); break; case INSN: @@ -424,12 +425,12 @@ get_attr_length (rtx insn ATTRIBUTE_UNUSED) return 0; else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0) - length = asm_insn_count (body) * insn_default_length (insn); + length = asm_insn_count (body) * fallback_fn (insn); else if (GET_CODE (body) == SEQUENCE) for (i = 0; i < XVECLEN (body, 0); i++) length += get_attr_length (XVECEXP (body, 0, i)); else - length = insn_default_length (insn); + length = fallback_fn (insn); break; default: @@ -444,6 +445,22 @@ get_attr_length (rtx insn ATTRIBUTE_UNUSED) return 0; #endif /* not HAVE_ATTR_length */ } + +/* Obtain the current length of an insn. If branch shortening has been done, + get its actual length. Otherwise, get its maximum length. */ +int +get_attr_length (rtx insn) +{ + return get_attr_length_1 (insn, insn_default_length); +} + +/* Obtain the current length of an insn. If branch shortening has been done, + get its actual length. Otherwise, get its minimum length. */ +int +get_attr_min_length (rtx insn) +{ + return get_attr_length_1 (insn, insn_min_length); +} /* Code to handle alignment inside shorten_branches. */ |