]> gcc.gnu.org Git - gcc.git/commitdiff
re PR lto/64374 (LTO ICE in extract_insn, at recog.c:2327)
authorJakub Jelinek <jakub@redhat.com>
Wed, 25 Feb 2015 06:46:22 +0000 (07:46 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 25 Feb 2015 06:46:22 +0000 (07:46 +0100)
PR lto/64374
* target.def (target_option_stream_in): New target hook.
* tree-streamer-in.c (streamer_read_tree_bitfields): Invoke
targetm.target_option.post_stream_in if non-NULL.
* doc/tm.texi.in: Add @hook TARGET_OPTION_POST_STREAM_IN.
* doc/tm.texi: Updated.
* config/i386/i386.c (ix86_function_specific_post_stream_in): New
function.
(TARGET_OPTION_POST_STREAM_IN): Redefine.

From-SVN: r220958

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/target.def
gcc/tree-streamer-in.c

index 776821bb5453948213517cb163c439aa0e00494e..dd8db64f130fbb7444791dfde76f16292d883a2b 100644 (file)
@@ -1,3 +1,15 @@
+2015-02-25  Jakub Jelinek  <jakub@redhat.com>
+
+       PR lto/64374
+       * target.def (target_option_stream_in): New target hook.
+       * tree-streamer-in.c (streamer_read_tree_bitfields): Invoke
+       targetm.target_option.post_stream_in if non-NULL.
+       * doc/tm.texi.in: Add @hook TARGET_OPTION_POST_STREAM_IN.
+       * doc/tm.texi: Updated.
+       * config/i386/i386.c (ix86_function_specific_post_stream_in): New
+       function.
+       (TARGET_OPTION_POST_STREAM_IN): Redefine.
+
 2015-02-24  Jeff Law  <law@redhat.com>
 
        PR target/65117
index 66200216d3fe7200963daddef2bcb744ea1b9387..bc4fb4be39959f2f3291986569ccb8939d562677 100644 (file)
@@ -2463,6 +2463,7 @@ static void ix86_function_specific_save (struct cl_target_option *,
                                         struct gcc_options *opts);
 static void ix86_function_specific_restore (struct gcc_options *opts,
                                            struct cl_target_option *);
+static void ix86_function_specific_post_stream_in (struct cl_target_option *);
 static void ix86_function_specific_print (FILE *, int,
                                          struct cl_target_option *);
 static bool ix86_valid_target_attribute_p (tree, tree, tree, int);
@@ -4571,6 +4572,57 @@ ix86_function_specific_restore (struct gcc_options *opts,
     set_ix86_tune_features (ix86_tune, false);
 }
 
+/* Adjust target options after streaming them in.  This is mainly about
+   reconciling them with global options.  */
+
+static void
+ix86_function_specific_post_stream_in (struct cl_target_option *ptr)
+{
+  /* flag_pic is a global option, but ix86_cmodel is target saved option
+     partly computed from flag_pic.  If flag_pic is on, adjust x_ix86_cmodel
+     for PIC, or error out.  */
+  if (flag_pic)
+    switch (ptr->x_ix86_cmodel)
+      {
+      case CM_SMALL:
+       ptr->x_ix86_cmodel = CM_SMALL_PIC;
+       break;
+
+      case CM_MEDIUM:
+       ptr->x_ix86_cmodel = CM_MEDIUM_PIC;
+       break;
+
+      case CM_LARGE:
+       ptr->x_ix86_cmodel = CM_LARGE_PIC;
+       break;
+
+      case CM_KERNEL:
+       error ("code model %s does not support PIC mode", "kernel");
+       break;
+
+      default:
+       break;
+      }
+  else
+    switch (ptr->x_ix86_cmodel)
+      {
+      case CM_SMALL_PIC:
+       ptr->x_ix86_cmodel = CM_SMALL;
+       break;
+
+      case CM_MEDIUM_PIC:
+       ptr->x_ix86_cmodel = CM_MEDIUM;
+       break;
+
+      case CM_LARGE_PIC:
+       ptr->x_ix86_cmodel = CM_LARGE;
+       break;
+
+      default:
+       break;
+      }
+}
+
 /* Print the current options */
 
 static void
@@ -52007,6 +52059,9 @@ ix86_initialize_bounds (tree var, tree lb, tree ub, tree *stmts)
 #undef TARGET_OPTION_RESTORE
 #define TARGET_OPTION_RESTORE ix86_function_specific_restore
 
+#undef TARGET_OPTION_POST_STREAM_IN
+#define TARGET_OPTION_POST_STREAM_IN ix86_function_specific_post_stream_in
+
 #undef TARGET_OPTION_PRINT
 #define TARGET_OPTION_PRINT ix86_function_specific_print
 
index 6f36ec624d2008dcf017d1e48e2caffbd451d7fb..6e5d2c0441109c4c5cefaa41def909ebfcd2ee81 100644 (file)
@@ -9905,6 +9905,12 @@ information in the @code{struct cl_target_option} structure for
 function-specific options to the @code{struct gcc_options} structure.
 @end deftypefn
 
+@deftypefn {Target Hook} void TARGET_OPTION_POST_STREAM_IN (struct cl_target_option *@var{ptr})
+This hook is called to update target-specific information in the
+@code{struct cl_target_option} structure after it is streamed in from
+LTO bytecode.
+@end deftypefn
+
 @deftypefn {Target Hook} void TARGET_OPTION_PRINT (FILE *@var{file}, int @var{indent}, struct cl_target_option *@var{ptr})
 This hook is called to print any additional target-specific
 information in the @code{struct cl_target_option} structure for
index 121c3057ba2e9f179a45850e81df16e053acb4c3..16d5df769afbf8ef139d3df03a4197b8aad92c15 100644 (file)
@@ -7251,6 +7251,8 @@ on this implementation detail.
 
 @hook TARGET_OPTION_RESTORE
 
+@hook TARGET_OPTION_POST_STREAM_IN
+
 @hook TARGET_OPTION_PRINT
 
 @hook TARGET_OPTION_PRAGMA_PARSE
index 035dece8fa5d615b8e5a452236eebfb9a6e1e395..a00181aa9bb721cd626d8402f40894549fd6026a 100644 (file)
@@ -5501,6 +5501,15 @@ information in the @code{struct cl_target_option} structure for\n\
 function-specific options to the @code{struct gcc_options} structure.",
  void, (struct gcc_options *opts, struct cl_target_option *ptr), NULL)
 
+/* Function to update target-specific option information after being
+   streamed in.  */
+DEFHOOK
+(post_stream_in,
+ "This hook is called to update target-specific information in the\n\
+@code{struct cl_target_option} structure after it is streamed in from\n\
+LTO bytecode.",
+ void, (struct cl_target_option *ptr), NULL)
+
 /* Function to print any extra target state from the target options
    structure.  */
 DEFHOOK
index b4b648238519fbbe0213f3abd25e67a818e45913..94b6e51e87376c54c25e7223c31ce9f4a1003dbd 100644 (file)
@@ -559,7 +559,11 @@ streamer_read_tree_bitfields (struct lto_input_block *ib,
 
 #ifndef ACCEL_COMPILER
   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
-    cl_target_option_stream_in (data_in, &bp, TREE_TARGET_OPTION (expr));
+    {
+      cl_target_option_stream_in (data_in, &bp, TREE_TARGET_OPTION (expr));
+      if (targetm.target_option.post_stream_in)
+       targetm.target_option.post_stream_in (TREE_TARGET_OPTION (expr));
+    }
 #endif
 
   if (code == OMP_CLAUSE)
This page took 0.133884 seconds and 5 git commands to generate.