[arm-embedded][committed] Fix backport of PR71607: no longer use TARGET_USE_BLOCKS_FOR_CONSTANT_P

Andre Vieira (lists) Andre.SimoesDiasVieira@arm.com
Wed Dec 14 17:06:00 GMT 2016


Hi,

During embedded-6-branch testing we discovered that the patch for
PR71607, that I backported to embedded-6-branch, broke cortex-m0 due to
the new implementation of TARGET_USE_BLOCKS_FOR_CONSTANT_P.

What changed is that TARGET_USE_BLOCKS_FOR_CONSTANT_P did not used to be
defined by ARM and thus it used the default implementation which always
returned false. I read over that detail last time...
The current implementation on embedded-6 returns false if
arm_disable_literal_pool is true and true otherwise. As I said I had not
expected this function to already be returning false to begin with. This
does however mean that we do not (correctly?) use this target hook to
control what goes into literal pools in text and what not. It also means
we don't need to for -mslow-flash-data as and since it breaks cortex-m0
I will be removing it, reverting back to the default implementation.

I will be changing the patch for trunk to reflect these findings, even
though this did not show up during trunk testing.

Tested with various arm-none-eabi configurations: -mcpu=cortex-m0/m3/m7
and -march=armv8-m.baseline.

Cheers,
Andre

gcc/ChangeLog.arm:
2016-12-14  Andre Vieira  <andre.simoesdiasvieira@arm.com>

        * config/arm/arm.c (TARGET_USE_BLOCKS_FOR_CONSTANT_P): Remove.
        (arm_use_blocks_for_constant_p): Remove.

gcc/testsuite/ChangeLog.arm:
2016-12-14  Andre Vieira  <andre.simoesdiasvieira@arm.com>

        * gcc.target/arm/thumb2-slow-flash-data-3.c: Add extra scan.
        * gcc.target/arm/thumb2-slow-flash-data-5.c: Likewise.
-------------- next part --------------
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 323019896ac430fde645bd7e198c0a903be98d7d..a76c950c53dba315ea051cd451a64173025b89d9 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -308,7 +308,6 @@ static section *arm_function_section (tree, enum node_frequency, bool, bool);
 static bool arm_asm_elf_flags_numeric (unsigned int flags, unsigned int *num);
 static unsigned int arm_elf_section_type_flags (tree decl, const char *name,
 						int reloc);
-static bool arm_use_blocks_for_constant_p (machine_mode var, const_rtx x);
 
 

 /* Table of machine attributes.  */
@@ -759,9 +758,6 @@ static const struct attribute_spec arm_attribute_table[] =
 #undef TARGET_SECTION_TYPE_FLAGS
 #define TARGET_SECTION_TYPE_FLAGS arm_elf_section_type_flags
 
-#undef TARGET_USE_BLOCKS_FOR_CONSTANT_P
-#define TARGET_USE_BLOCKS_FOR_CONSTANT_P arm_use_blocks_for_constant_p
-
 struct gcc_target targetm = TARGET_INITIALIZER;
 

 /* Obstack for minipool constant handling.  */
@@ -31605,15 +31601,4 @@ bool arm_coproc_ldc_stc_legitimate_address (rtx op)
     }
   return false;
 }
-
-/* Implements the TARGET_USE_BLOCKS_FOR_CONSTANT_P hook.
-
-   If we have disabled the generation of constants inside a literal pool, then
-   this function returns false.  Otherwise, return true.  */
-
-static bool
-arm_use_blocks_for_constant_p (machine_mode /* var */, const_rtx /* x */)
-{
-  return !arm_disable_literal_pool;
-}
 #include "gt-arm.h"
diff --git a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-3.c b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-3.c
index d25ba87413cb949e5e2162dbf4e695e205b01a34..f4c17c9fa855301d9d0290ca8ca4697fb416e3f7 100644
--- a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-3.c
+++ b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-3.c
@@ -22,3 +22,5 @@ fn3 ()
   a[1] = b;
   fn1 (a);
 }
+
+/* { dg-final { scan-assembler-not "\\.(float|l\\?double|\d?byte|short|int|long|quad|word)\\s+\[^.\]" } } */
diff --git a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-5.c b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-5.c
index 7d1b2384738c7f495be257a46e6587bf43b6534a..9cc2539b31d3c01516e2b3c102b58e111627d254 100644
--- a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-5.c
+++ b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data-5.c
@@ -12,3 +12,4 @@ foo (void)
 }
 
 /* { dg-final { scan-assembler-not "#1\\.0e\\+0" } } */
+/* { dg-final { scan-assembler-not "\\.(float|l\\?double|\d?byte|short|int|long|quad|word)\\s+\[^.\]" } } */


More information about the Gcc-patches mailing list