+Mon Apr 20 22:37:50 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * final.c (shorten_branches, init_insn_lengths): Move code
+ to free label_align, uid_shuid, insn_lengths, insn_addresses
+ and uid_align from the former function into the latter one;
+ Add code to clear these variables.
+ * sh.h (label_align): Remove declaration.
+
Mon Apr 20 14:48:29 1998 Michael Meissner <meissner@cygnus.com>
* gcc.c (lang_specific_driver): Declare prototype properly so
/* konwn invariant alignment of insn being processed. */
int insn_current_align;
+/* After shorten_branches, for any insn, uid_align[INSN_UID (insn)]
+ gives the next following alignment insn that increases the known
+ alignment, or NULL_RTX if there is no such insn.
+ For any alignment obtained this way, we can again index uid_align with
+ its uid to obtain the next following align that in turn increases the
+ alignment, till we reach NULL_RTX; the sequence obtained this way
+ for each insn we'll call the alignment chain of this insn in the following
+ comments. */
+
+rtx *uid_align;
+int *uid_shuid;
+short *label_align;
+
/* Indicate that branch shortening hasn't yet been done. */
void
init_insn_lengths ()
{
- insn_lengths = 0;
+ if (label_align)
+ {
+ free (label_align);
+ label_align = 0;
+ }
+ if (uid_shuid)
+ {
+ free (uid_shuid);
+ uid_shuid = 0;
+ }
+ if (insn_lengths)
+ {
+ free (insn_lengths);
+ insn_lengths = 0;
+ }
+ if (insn_addresses)
+ {
+ free (insn_addresses);
+ insn_addresses = 0;
+ }
+ if (uid_align)
+ {
+ free (uid_align);
+ uid_align = 0;
+ }
}
/* Obtain the current length of an insn. If branch shortening has been done,
#define INSN_LENGTH_ALIGNMENT(INSN) length_unit_log
#endif
-/* For any insn, uid_align[INSN_UID (insn)] gives the next following
- alignment insn that increases the known alignment, or NULL_RTX if
- there is no such insn.
- For any alignment obtained this way, we can again index uid_align with
- its uid to obtain the next following align that in turn increases the
- alignment, till we reach NULL_RTX; the sequence obtained this way
- for each insn we'll call the alignment chain of this insn in the following
- comments. */
-
-rtx *uid_align;
-int *uid_shuid;
-short *label_align; /* sh.c needs this to calculate constant tables. */
-
#define INSN_SHUID(INSN) (uid_shuid[INSN_UID (INSN)])
static int min_labelno, max_labelno;
/* We must do some computations even when not actually shortening, in
order to get the alignment information for the labels. */
+ init_insn_lengths ();
+
/* Compute maximum UID and allocate label_align / uid_shuid. */
max_uid = get_max_uid ();
max_labelno = max_label_num ();
min_labelno = get_first_label_num ();
- if (label_align)
- free (label_align);
label_align
= (short*) xmalloc ((max_labelno - min_labelno + 1) * sizeof (short));
bzero (label_align, (max_labelno - min_labelno + 1) * sizeof (short));
- if (uid_shuid)
- free (uid_shuid);
uid_shuid = (int *) xmalloc (max_uid * sizeof *uid_shuid);
/* Initialize label_align and set up uid_shuid to be strictly
#ifdef HAVE_ATTR_length
/* Allocate the rest of the arrays. */
- if (insn_lengths)
- free (insn_lengths);
insn_lengths = (short *) xmalloc (max_uid * sizeof (short));
- if (insn_addresses)
- free (insn_addresses);
insn_addresses = (int *) xmalloc (max_uid * sizeof (int));
/* Syntax errors can lead to labels being outside of the main insn stream.
Initialize insn_addresses, so that we get reproducible results. */
bzero ((char *)insn_addresses, max_uid * sizeof *insn_addresses);
- if (uid_align)
- free (uid_align);
uid_align = (rtx *) xmalloc (max_uid * sizeof *uid_align);
varying_length = (char *) xmalloc (max_uid * sizeof (char));