summaryrefslogtreecommitdiffstats
path: root/gcc/final.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-28 02:17:26 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2000-07-28 02:17:26 +0000
commit47fc0706efc3899bb63c2fa9a1e36fc77d988a8d (patch)
treeef8a8d9eb4fda8faa814cb484ce4a1e01ef25372 /gcc/final.c
parentbc7af38963b4b5186f45a61993821982bcd83134 (diff)
downloadppe42-gcc-47fc0706efc3899bb63c2fa9a1e36fc77d988a8d.tar.gz
ppe42-gcc-47fc0706efc3899bb63c2fa9a1e36fc77d988a8d.zip
* Makefile.in (INSN_ATTR_H): New macro. Replace all dependencies
on insn-attr.h with it. * genattr.c: Generate `#include "insn-addr.h"' if HAVE_ATTR_length. * insn-addr.h: New header. (insn_addresses_): Renamed from insn_addresses. (INSN_ADDRESSES_DEFN, INSN_ADDRESSES, INSN_ADDRESSES_ALLOC, INSN_ADDRESSES_FREE, INSN_ADDRESSES_SET_P, INSN_ADDRESSES_SIZE, INSN_ADDRESSES_NEW): New macros. * genattrtab.c (write_test_expr): Use new macros. * final.c (insn_addresses, init_insn_lengths): Likewise. (align_fuzz, shorten_branches): Likewise. (final): Likewise. Do not reject new insns if their addresses have been added to INSN_ADDRESSES. * config/arm/arm.c, config/avr/avr.c: Use new macros. * config/h8300/h8300.c, config/i370/i370.c: Likewise. * config/m88k/m88k.c, config/pa/pa.c, config/pa/pa.md: Likewise. * config/sparc/sparc.c, config/sparc/sparc.md: Likewise. * config/sh/sh.c: Likewise. (output_branchy_insn): Use INSN_ADDRESSES_NEW. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35307 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/gcc/final.c b/gcc/final.c
index e655637644f..1fc72c9402b 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -612,7 +612,10 @@ dbr_sequence_length ()
`insn_current_length'. */
static short *insn_lengths;
-int *insn_addresses;
+
+#ifdef HAVE_ATTR_length
+varray_type insn_addresses_;
+#endif
/* Max uid for which the above arrays are valid. */
static int insn_lengths_max_uid;
@@ -665,11 +668,9 @@ init_insn_lengths ()
insn_lengths = 0;
insn_lengths_max_uid = 0;
}
- if (insn_addresses)
- {
- free (insn_addresses);
- insn_addresses = 0;
- }
+#ifdef HAVE_ATTR_length
+ INSN_ADDRESSES_FREE ();
+#endif
if (uid_align)
{
free (uid_align);
@@ -889,7 +890,7 @@ align_fuzz (start, end, known_align_log, growth)
int align_addr, new_align;
uid = INSN_UID (align_label);
- align_addr = insn_addresses[uid] - insn_lengths[uid];
+ align_addr = INSN_ADDRESSES (uid) - insn_lengths[uid];
if (uid_shuid[uid] > end_shuid)
break;
known_align_log = LABEL_TO_ALIGNMENT (align_label);
@@ -1135,7 +1136,7 @@ shorten_branches (first)
insn_lengths_max_uid = max_uid;
/* Syntax errors can lead to labels being outside of the main insn stream.
Initialize insn_addresses, so that we get reproducible results. */
- insn_addresses = (int *) xcalloc (max_uid, sizeof (int));
+ INSN_ADDRESSES_ALLOC (max_uid);
varying_length = (char *) xcalloc (max_uid, sizeof (char));
@@ -1242,7 +1243,7 @@ shorten_branches (first)
}
}
- insn_addresses[uid] = insn_current_address;
+ INSN_ADDRESSES (uid) = insn_current_address;
if (GET_CODE (insn) == NOTE || GET_CODE (insn) == BARRIER
|| GET_CODE (insn) == CODE_LABEL)
@@ -1298,8 +1299,8 @@ shorten_branches (first)
if ((varying_length[inner_uid]
= insn_variable_length_p (inner_insn)) != 0)
varying_length[uid] = 1;
- insn_addresses[inner_uid] = (insn_current_address +
- insn_lengths[uid]);
+ INSN_ADDRESSES (inner_uid) = (insn_current_address
+ + insn_lengths[uid]);
}
else
varying_length[inner_uid] = 0;
@@ -1353,7 +1354,7 @@ shorten_branches (first)
}
else
insn_lengths[uid] = 0;
- insn_addresses[uid] = insn_current_address;
+ INSN_ADDRESSES (uid) = insn_current_address;
continue;
}
@@ -1361,8 +1362,8 @@ shorten_branches (first)
if (length_align < insn_current_align)
insn_current_align = length_align;
- insn_last_address = insn_addresses[uid];
- insn_addresses[uid] = insn_current_address;
+ insn_last_address = INSN_ADDRESSES (uid);
+ INSN_ADDRESSES (uid) = insn_current_address;
#ifdef CASE_VECTOR_SHORTEN_MODE
if (optimize && GET_CODE (insn) == JUMP_INSN
@@ -1374,9 +1375,9 @@ shorten_branches (first)
rtx min_lab = XEXP (XEXP (body, 2), 0);
rtx max_lab = XEXP (XEXP (body, 3), 0);
addr_diff_vec_flags flags = ADDR_DIFF_VEC_FLAGS (body);
- int rel_addr = insn_addresses[INSN_UID (rel_lab)];
- int min_addr = insn_addresses[INSN_UID (min_lab)];
- int max_addr = insn_addresses[INSN_UID (max_lab)];
+ int rel_addr = INSN_ADDRESSES (INSN_UID (rel_lab));
+ int min_addr = INSN_ADDRESSES (INSN_UID (min_lab));
+ int max_addr = INSN_ADDRESSES (INSN_UID (max_lab));
rtx prev;
int rel_align = 0;
@@ -1491,7 +1492,7 @@ shorten_branches (first)
int inner_uid = INSN_UID (inner_insn);
int inner_length;
- insn_addresses[inner_uid] = insn_current_address;
+ INSN_ADDRESSES (inner_uid) = insn_current_address;
/* insn_current_length returns 0 for insns with a
non-varying length. */
@@ -2018,7 +2019,7 @@ final (first, file, optimize, prescan)
for (insn = NEXT_INSN (first); insn;)
{
#ifdef HAVE_ATTR_length
- if (INSN_UID (insn) >= insn_lengths_max_uid)
+ if (INSN_UID (insn) >= INSN_ADDRESSES_SIZE ())
{
#ifdef STACK_REGS
/* Irritatingly, the reg-stack pass is creating new instructions
@@ -2032,7 +2033,7 @@ final (first, file, optimize, prescan)
#endif
}
else
- insn_current_address = insn_addresses[INSN_UID (insn)];
+ insn_current_address = INSN_ADDRESSES (INSN_UID (insn));
#endif /* HAVE_ATTR_length */
insn = final_scan_insn (insn, file, optimize, prescan, 0);
OpenPOWER on IntegriCloud