Hi,

The source file rs6000.c was split up into several smaller source files
through commit 1acf024.  However, variable "altivec_builtin_mask_for_load" and
"builtin_mode_to_type[MAX_MACHINE_MODE][2]" were marked with the wrong syntax
"GTY(([options])) type name", which led these two variables were not marked as
roots correctly and wrongly GCed.  And when "altivec_builtin_mask_for_load"
was wrongly GCed, the compiling for openJDK is failed with ICEs enabling
precompiled header under mcpu=power7.  So roots must be declared using one of
the following syntaxes: "extern GTY(([options])) type name;" and "static
GTY(([options])) type name;".

And the following patch adds variable "altivec_builtin_mask_for_load" and
"builtin_mode_to_type[MAX_MACHINE_MODE][2]" into the roots array.

Bootstrap and regression tests were done on powerpc64le-linux-gnu (LE) with no
regressions.  Is it OK for trunk?

Thanks,
Bin Bin Lv

gcc/ChangLog

2020-03-03  Bin Bin Lv  <s...@linux.ibm.com>

        * config/rs6000/rs6000-internal.h (altivec_builtin_mask_for_load,
        builtin_mode_to_type[MAX_MACHINE_MODE][2]): Remove GTY(()).
        * config/rs6000/rs6000.h (altivec_builtin_mask_for_load,
        builtin_mode_to_type[MAX_MACHINE_MODE][2]): Add an extern GTY(())
        declaration.
        * config/rs6000/rs6000.h (MAX_MACHINE_MODE): Include the header file
        for MAX_MACHINE_MODE.
        * config/rs6000/rs6000.c (altivec_builtin_mask_for_load,
        builtin_mode_to_type[MAX_MACHINE_MODE][2]): Remove the GTY(())
        declaration and add the definition.
---
 gcc/config/rs6000/rs6000-internal.h | 4 ++--
 gcc/config/rs6000/rs6000.c          | 4 ++--
 gcc/config/rs6000/rs6000.h          | 6 ++++++
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-internal.h 
b/gcc/config/rs6000/rs6000-internal.h
index a23e956..202b2b2 100644
--- a/gcc/config/rs6000/rs6000-internal.h
+++ b/gcc/config/rs6000/rs6000-internal.h
@@ -187,7 +187,7 @@ extern bool rs6000_passes_long_double;
 extern bool rs6000_passes_vector;
 extern bool rs6000_returns_struct;
 extern bool cpu_builtin_p;
-extern GTY(()) tree builtin_mode_to_type[MAX_MACHINE_MODE][2];
-extern GTY(()) tree altivec_builtin_mask_for_load;
+extern tree builtin_mode_to_type[MAX_MACHINE_MODE][2];
+extern tree altivec_builtin_mask_for_load;
 
 #endif
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 9910b27..0faf44b 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -99,7 +99,7 @@
 #endif
 
 /* Support targetm.vectorize.builtin_mask_for_load.  */
-GTY(()) tree altivec_builtin_mask_for_load;
+tree altivec_builtin_mask_for_load;
 
 #ifdef USING_ELFOS_H
 /* Counter for labels which are to be placed in .fixup.  */
@@ -196,7 +196,7 @@ enum reg_class rs6000_constraints[RS6000_CONSTRAINT_MAX];
 int rs6000_vector_align[NUM_MACHINE_MODES];
 
 /* Map selected modes to types for builtins.  */
-GTY(()) tree builtin_mode_to_type[MAX_MACHINE_MODE][2];
+tree builtin_mode_to_type[MAX_MACHINE_MODE][2];
 
 /* What modes to automatically generate reciprocal divide estimate (fre) and
    reciprocal sqrt (frsqrte) for.  */
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 1697186..3844bec 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -35,6 +35,10 @@
 #include "config/rs6000/rs6000-modes.h"
 #endif
 
+#ifndef MAX_MACHINE_MODE
+#include "insn-modes.h"
+#endif
+
 /* Definitions for the object file format.  These are set at
    compile-time.  */
 
@@ -2488,6 +2492,8 @@ enum rs6000_builtin_type_index
 
 extern GTY(()) tree rs6000_builtin_types[RS6000_BTI_MAX];
 extern GTY(()) tree rs6000_builtin_decls[RS6000_BUILTIN_COUNT];
+extern GTY(()) tree builtin_mode_to_type[MAX_MACHINE_MODE][2];
+extern GTY(()) tree altivec_builtin_mask_for_load;
 
 #ifndef USED_FOR_TARGET
 /* A C structure for machine-specific, per-function data.
-- 
1.8.3.1

Reply via email to