aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2011-08-12 07:59:09 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2011-08-12 07:59:09 +0000
commit20fe71c2560921c35b7c378d27a8d61500439711 (patch)
tree13fd8f83df7d9fe25e4c107208cfe829da4888a6
parent786eeca2bd357b27138987413cba69fd1aa486a9 (diff)
downloadgcc-20fe71c2560921c35b7c378d27a8d61500439711.zip
gcc-20fe71c2560921c35b7c378d27a8d61500439711.tar.gz
gcc-20fe71c2560921c35b7c378d27a8d61500439711.tar.bz2
arm.c (get_label_padding): New function.
gcc/ * config/arm/arm.c (get_label_padding): New function. (create_fix_barrier, md_reorg): Likewise. From-SVN: r177689
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/arm/arm.c26
2 files changed, 29 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5d6e2d0..b3c154c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-12 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/arm/arm.c (get_label_padding): New function.
+ (create_fix_barrier, md_reorg): Likewise.
+
2011-08-11 Uros Bizjak <ubizjak@gmail.com>
PR target/49781
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 6cd80f8..afa989e 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -11719,6 +11719,19 @@ get_jump_table_size (rtx insn)
return 0;
}
+/* Return the maximum amount of padding that will be inserted before
+ label LABEL. */
+
+static HOST_WIDE_INT
+get_label_padding (rtx label)
+{
+ HOST_WIDE_INT align, min_insn_size;
+
+ align = 1 << label_to_alignment (label);
+ min_insn_size = TARGET_THUMB ? 2 : 4;
+ return align > min_insn_size ? align - min_insn_size : 0;
+}
+
/* Move a minipool fix MP from its current location to before MAX_MP.
If MAX_MP is NULL, then MP doesn't need moving, but the addressing
constraints may need updating. */
@@ -12265,8 +12278,12 @@ create_fix_barrier (Mfix *fix, HOST_WIDE_INT max_address)
within range. */
gcc_assert (GET_CODE (from) != BARRIER);
- /* Count the length of this insn. */
- count += get_attr_length (from);
+ /* Count the length of this insn. This must stay in sync with the
+ code that pushes minipool fixes. */
+ if (LABEL_P (from))
+ count += get_label_padding (from);
+ else
+ count += get_attr_length (from);
/* If there is a jump table, add its length. */
tmp = is_jump_table (from);
@@ -12696,6 +12713,11 @@ arm_reorg (void)
insn = table;
}
}
+ else if (LABEL_P (insn))
+ /* Add the worst-case padding due to alignment. We don't add
+ the _current_ padding because the minipool insertions
+ themselves might change it. */
+ address += get_label_padding (insn);
}
fix = minipool_fix_head;