[PATCH] [GCC] Don't use section anchors for declarations that don't fit in a single...
authorTamar Christina <tamar.christina@arm.com>
Thu, 18 Aug 2016 08:45:53 +0000 (08:45 +0000)
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>
Thu, 18 Aug 2016 08:45:53 +0000 (08:45 +0000)
On behalf of Tamar Christina  <tamar.christina@arm.com>.

gcc/

* varasm.c (default_use_anchors_for_symbol_p): Reject too large decls.

Co-Authored-By: Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
From-SVN: r239561

gcc/ChangeLog
gcc/varasm.c

index 17dab645a9530aefd152ee776fbb2e95ed85ef42..5d89dbb8e5e829bd21701dee29e7ac0570dcade4 100644 (file)
@@ -1,3 +1,8 @@
+2016-08-18  Tamar Christina  <tamar.christina@arm.com>
+           Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
+
+       * varasm.c (default_use_anchors_for_symbol_p): Reject too large decls.
+
 2016-08-18  Richard Biener  <rguenther@suse.de>
 
        * ssa-iterators.h (ssa_vuse_operand): New inline.
index e747d2c4721cee34d05e21e9c7eaee9906da7f71..00a9b30e73cc03236ead949e42758fb75a1879fb 100644 (file)
@@ -6793,6 +6793,15 @@ default_use_anchors_for_symbol_p (const_rtx symbol)
         sections that should be marked as small in the section directive.  */
       if (targetm.in_small_data_p (decl))
        return false;
+
+      /* Don't use section anchors for decls that won't fit inside a single
+        anchor range to reduce the amount of instructions require to refer
+        to the entire declaration.  */
+      if (decl && DECL_SIZE (decl)
+        && tree_to_shwi (DECL_SIZE (decl))
+           >= (targetm.max_anchor_offset * BITS_PER_UNIT))
+       return false;
+
     }
   return true;
 }