cgraphunit.c (ipa_passes): Handle flag_generate_offload.
authorIlya Verbin <ilya.verbin@intel.com>
Fri, 28 Nov 2014 12:23:55 +0000 (12:23 +0000)
committerIlya Verbin <iverbin@gcc.gnu.org>
Fri, 28 Nov 2014 12:23:55 +0000 (12:23 +0000)
gcc/
* cgraphunit.c (ipa_passes): Handle flag_generate_offload.
(symbol_table::compile): Set flag_generate_offload if there is something
to offload.
* common.opt (flag_generate_offload): New Variable declaration.
* dwarf2out.c (dwarf2out_finish): Handle flag_generate_offload.
* ipa-inline-analysis.c (inline_generate_summary): Do not skip if
flag_generate_offload is set.
* lto-streamer.c (gate_lto_out): Handle flag_generate_offload.
* passes.c (ipa_write_summaries): Do not skip if flag_generate_offload
is set.
* toplev.c (compile_file): Emit LTO marker if offload info has been
previously emitted.  Do not emit lto_slim marker if
flag_generate_offload is without flag_generate_lto.
* tree.c (free_lang_data): Do not skip if flag_generate_offload is set.

From-SVN: r218147

gcc/ChangeLog
gcc/cgraphunit.c
gcc/common.opt
gcc/dwarf2out.c
gcc/ipa-inline-analysis.c
gcc/lto-streamer.c
gcc/passes.c
gcc/toplev.c
gcc/tree.c

index 3c33c21..4e6da0c 100644 (file)
@@ -1,3 +1,20 @@
+2014-11-28  Ilya Verbin  <ilya.verbin@intel.com>
+
+       * cgraphunit.c (ipa_passes): Handle flag_generate_offload.
+       (symbol_table::compile): Set flag_generate_offload if there is something
+       to offload.
+       * common.opt (flag_generate_offload): New Variable declaration.
+       * dwarf2out.c (dwarf2out_finish): Handle flag_generate_offload.
+       * ipa-inline-analysis.c (inline_generate_summary): Do not skip if
+       flag_generate_offload is set.
+       * lto-streamer.c (gate_lto_out): Handle flag_generate_offload.
+       * passes.c (ipa_write_summaries): Do not skip if flag_generate_offload
+       is set.
+       * toplev.c (compile_file): Emit LTO marker if offload info has been
+       previously emitted.  Do not emit lto_slim marker if
+       flag_generate_offload is without flag_generate_lto.
+       * tree.c (free_lang_data): Do not skip if flag_generate_offload is set.
+
 2014-11-28  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/arm/arm-cores.def (cortex-a17.cortex-a7): New entry.
index 2fd99a7..fed1a3e 100644 (file)
@@ -2075,7 +2075,7 @@ ipa_passes (void)
     }
 
   /* Some targets need to handle LTO assembler output specially.  */
-  if (flag_generate_lto)
+  if (flag_generate_lto || flag_generate_offload)
     targetm.asm_out.lto_start ();
 
   if (!in_lto_p)
@@ -2092,7 +2092,7 @@ ipa_passes (void)
        }
     }
 
-  if (flag_generate_lto)
+  if (flag_generate_lto || flag_generate_offload)
     targetm.asm_out.lto_end ();
 
   if (!flag_ltrans && (in_lto_p || !flag_lto || flag_fat_lto_objects))
@@ -2176,10 +2176,10 @@ symbol_table::compile (void)
 
   /* Offloading requires LTO infrastructure.  */
   if (!in_lto_p && g->have_offload)
-    flag_generate_lto = 1;
+    flag_generate_offload = 1;
 
   /* If LTO is enabled, initialize the streamer hooks needed by GIMPLE.  */
-  if (flag_generate_lto)
+  if (flag_generate_lto || flag_generate_offload)
     lto_streamer_hooks_init ();
 
   /* Don't run the IPA passes if there was any error or sorry messages.  */
index 41c8d4e..752d939 100644 (file)
@@ -67,6 +67,10 @@ int *param_values
 Variable
 int flag_generate_lto
 
+; Nonzero if we should write GIMPLE bytecode for offload compilation.
+Variable
+int flag_generate_offload = 0
+
 ; True to warn about any objects definitions whose size is larger
 ; than N bytes.  Also want about function definitions whose returned
 ; values are larger than N bytes, where N is 'larger_than_size'.
index b7f93f0..ca1e3ef 100644 (file)
@@ -24423,7 +24423,8 @@ dwarf2out_finish (const char *filename)
       /* When generating LTO bytecode we can not generate new assembler
          names at this point and all important decls got theirs via
         free-lang-data.  */
-      if ((!flag_generate_lto || DECL_ASSEMBLER_NAME_SET_P (decl))
+      if (((!flag_generate_lto && !flag_generate_offload)
+          || DECL_ASSEMBLER_NAME_SET_P (decl))
          && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
        {
          add_linkage_attr (node->die, decl);
index 2f2993c..9d62722 100644 (file)
@@ -4031,7 +4031,7 @@ inline_generate_summary (void)
 
   /* When not optimizing, do not bother to analyze.  Inlining is still done
      because edge redirection needs to happen there.  */
-  if (!optimize && !flag_generate_lto && !flag_wpa)
+  if (!optimize && !flag_generate_lto && !flag_generate_offload && !flag_wpa)
     return;
 
   function_insertion_hook_holder =
index e8347dc..af20330 100644 (file)
@@ -328,7 +328,7 @@ lto_streamer_init (void)
 bool
 gate_lto_out (void)
 {
-  return ((flag_generate_lto || in_lto_p)
+  return ((flag_generate_lto || flag_generate_offload || in_lto_p)
          /* Don't bother doing anything if the program has errors.  */
          && !seen_error ());
 }
index a3be0bb..74b40e5 100644 (file)
@@ -2466,7 +2466,7 @@ ipa_write_summaries (bool offload_lto_mode)
   struct cgraph_node *node;
   struct cgraph_node **order;
 
-  if (!flag_generate_lto || seen_error ())
+  if ((!flag_generate_lto && !flag_generate_offload) || seen_error ())
     return;
 
   select_what_to_stream (offload_lto_mode);
index 6e6adfa..2f547bf 100644 (file)
@@ -639,7 +639,7 @@ compile_file (void)
      We used to emit an undefined reference here, but this produces
      link errors if an object file with IL is stored into a shared
      library without invoking lto1.  */
-  if (flag_generate_lto)
+  if (flag_generate_lto || flag_generate_offload)
     {
 #if defined ASM_OUTPUT_ALIGNED_DECL_COMMON
       ASM_OUTPUT_ALIGNED_DECL_COMMON (asm_out_file, NULL_TREE,
@@ -653,23 +653,23 @@ compile_file (void)
                         (unsigned HOST_WIDE_INT) 1,
                         (unsigned HOST_WIDE_INT) 1);
 #endif
-      /* Let linker plugin know that this is a slim object and must be LTOed
-         even when user did not ask for it.  */
-      if (!flag_fat_lto_objects)
-        {
+    }
+
+  /* Let linker plugin know that this is a slim object and must be LTOed
+     even when user did not ask for it.  */
+  if (flag_generate_lto && !flag_fat_lto_objects)
+    {
 #if defined ASM_OUTPUT_ALIGNED_DECL_COMMON
-         ASM_OUTPUT_ALIGNED_DECL_COMMON (asm_out_file, NULL_TREE,
-                                         "__gnu_lto_slim",
-                                         (unsigned HOST_WIDE_INT) 1, 8);
+      ASM_OUTPUT_ALIGNED_DECL_COMMON (asm_out_file, NULL_TREE, "__gnu_lto_slim",
+                                     (unsigned HOST_WIDE_INT) 1, 8);
 #elif defined ASM_OUTPUT_ALIGNED_COMMON
-         ASM_OUTPUT_ALIGNED_COMMON (asm_out_file, "__gnu_lto_slim",
-                                    (unsigned HOST_WIDE_INT) 1, 8);
+      ASM_OUTPUT_ALIGNED_COMMON (asm_out_file, "__gnu_lto_slim",
+                                (unsigned HOST_WIDE_INT) 1, 8);
 #else
-         ASM_OUTPUT_COMMON (asm_out_file, "__gnu_lto_slim",
-                            (unsigned HOST_WIDE_INT) 1,
-                            (unsigned HOST_WIDE_INT) 1);
+      ASM_OUTPUT_COMMON (asm_out_file, "__gnu_lto_slim",
+                        (unsigned HOST_WIDE_INT) 1,
+                        (unsigned HOST_WIDE_INT) 1);
 #endif
-        }
     }
 
   /* Attach a special .ident directive to the end of the file to identify
index 1d5e4f6..f6a6d04 100644 (file)
@@ -5730,7 +5730,7 @@ free_lang_data (void)
 
   /* If we are the LTO frontend we have freed lang-specific data already.  */
   if (in_lto_p
-      || !flag_generate_lto)
+      || (!flag_generate_lto && !flag_generate_offload))
     return 0;
 
   /* Allocate and assign alias sets to the standard integer types