summaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-20 21:48:36 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-20 21:48:36 +0000
commit16afa8ae1933c570085475a7ea0fbdf9b8880b47 (patch)
treeb5aed08c2aba5538d50f0915cdd9050b95ec600d /gcc/final.c
parentd65b8df84253ce7cbef6fea4afb9af5b870e1751 (diff)
downloadgcc-16afa8ae1933c570085475a7ea0fbdf9b8880b47.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104468 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/gcc/final.c b/gcc/final.c
index e1a4c189cf6..f8270698ecb 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. */