diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-07 17:17:07 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-08-07 17:17:07 +0000 |
commit | 14e08599fc071226b123c0da28e7dfe9dd931c73 (patch) | |
tree | bf69301266f96ab07cb8e81f040fa1c0f1d8b4cc /gcc/final.c | |
parent | af7760503767f92778c0ff857a0ff50437888996 (diff) | |
download | gcc-14e08599fc071226b123c0da28e7dfe9dd931c73.tar.gz |
* rtl.h (update_alignments): Declare.
* final.c (grow_label_align): New function extracted from...
(shorten_branches): ...here. Call it.
(update_alignments): New function.
* reorg.c (sibling_labels): New variable.
(get_label_before): Add SIBLING parameter. If it is non-zero, push
the new label along with it onto the sibling_labels vector.
(fill_simple_delay_slots): Adjust call to get_label_before.
(fill_slots_from_thread): Likewise.
(relax_delay_slots): Likewise.
(make_return_insns): Likewise.
(dbr_schedule): Invoke update_alignment on the sibling_labels vector.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201575 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/final.c')
-rw-r--r-- | gcc/final.c | 67 |
1 files changed, 48 insertions, 19 deletions
diff --git a/gcc/final.c b/gcc/final.c index b755957bebd..31ced4f483b 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -795,6 +795,53 @@ compute_alignments (void) return 0; } +/* Grow the LABEL_ALIGN array after new labels are created. */ + +static void +grow_label_align (void) +{ + int old = max_labelno; + int n_labels; + int n_old_labels; + + max_labelno = max_label_num (); + + n_labels = max_labelno - min_labelno + 1; + n_old_labels = old - min_labelno + 1; + + label_align = XRESIZEVEC (struct label_alignment, label_align, n_labels); + + /* Range of labels grows monotonically in the function. Failing here + means that the initialization of array got lost. */ + gcc_assert (n_old_labels <= n_labels); + + memset (label_align + n_old_labels, 0, + (n_labels - n_old_labels) * sizeof (struct label_alignment)); +} + +/* Update the already computed alignment information. LABEL_PAIRS is a vector + made up of pairs of labels for which the alignment information of the first + element will be copied from that of the second element. */ + +void +update_alignments (vec<rtx> &label_pairs) +{ + unsigned int i = 0; + rtx iter, label; + + if (max_labelno != max_label_num ()) + grow_label_align (); + + FOR_EACH_VEC_ELT (label_pairs, i, iter) + if (i & 1) + { + LABEL_TO_ALIGNMENT (label) = LABEL_TO_ALIGNMENT (iter); + LABEL_TO_MAX_SKIP (label) = LABEL_TO_MAX_SKIP (iter); + } + else + label = iter; +} + namespace { const pass_data pass_data_compute_alignments = @@ -869,25 +916,7 @@ shorten_branches (rtx first) uid_shuid = XNEWVEC (int, max_uid); if (max_labelno != max_label_num ()) - { - int old = max_labelno; - int n_labels; - int n_old_labels; - - max_labelno = max_label_num (); - - n_labels = max_labelno - min_labelno + 1; - n_old_labels = old - min_labelno + 1; - - label_align = XRESIZEVEC (struct label_alignment, label_align, n_labels); - - /* Range of labels grows monotonically in the function. Failing here - means that the initialization of array got lost. */ - gcc_assert (n_old_labels <= n_labels); - - memset (label_align + n_old_labels, 0, - (n_labels - n_old_labels) * sizeof (struct label_alignment)); - } + grow_label_align (); /* Initialize label_align and set up uid_shuid to be strictly monotonically rising with insn order. */ |