]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/lto-section-out.c
libphobos: core.atomic should have fallback when there's no libatomic.
[thirdparty/gcc.git] / gcc / lto-section-out.c
index 7712db7306e242e8be1589f864c0e1a778f91452..c91e58f04657c2d0bacdc60bcc726b41625f7d83 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions for writing LTO sections.
 
-   Copyright (C) 2009-2015 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
    Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
 
 This file is part of GCC.
@@ -22,33 +22,15 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "tm.h"
+#include "backend.h"
+#include "rtl.h"
 #include "tree.h"
-#include "predict.h"
-#include "vec.h"
-#include "hashtab.h"
-#include "hash-set.h"
-#include "machmode.h"
-#include "hard-reg-set.h"
-#include "input.h"
-#include "function.h"
-#include "basic-block.h"
-#include "tree-ssa-alias.h"
-#include "internal-fn.h"
-#include "gimple-expr.h"
-#include "is-a.h"
 #include "gimple.h"
-#include "expr.h"
-#include "params.h"
-#include "except.h"
-#include "langhooks.h"
-#include "hash-map.h"
-#include "plugin-api.h"
-#include "ipa-ref.h"
 #include "cgraph.h"
 #include "data-streamer.h"
-#include "lto-streamer.h"
+#include "langhooks.h"
 #include "lto-compress.h"
+#include "print-tree.h"
 
 static vec<lto_out_decl_state_ptr> decl_state_stack;
 
@@ -85,9 +67,15 @@ lto_begin_section (const char *name, bool compress)
 {
   lang_hooks.lto.begin_section (name);
 
-  /* FIXME lto: for now, suppress compression if the lang_hook that appends
-     data is anything other than assembler output.  The effect here is that
-     we get compression of IL only in non-ltrans object files.  */
+  if (streamer_dump_file)
+    {
+      if (flag_dump_unnumbered || flag_dump_noaddr)
+         fprintf (streamer_dump_file, "Creating %ssection\n",
+                  compress ? "compressed " : "");
+       else
+         fprintf (streamer_dump_file, "Creating %ssection %s\n",
+                  compress ? "compressed " : "", name);
+    }
   gcc_assert (compression_stream == NULL);
   if (compress)
     compression_stream = lto_start_compression (lto_append_data, NULL);
@@ -118,6 +106,14 @@ lto_write_data (const void *data, unsigned int size)
     lang_hooks.lto.append_data ((const char *)data, size, NULL);
 }
 
+/* Write SIZE bytes starting at DATA to the assembler.  */
+
+void
+lto_write_raw_data (const void *data, unsigned int size)
+{
+  lang_hooks.lto.append_data ((const char *)data, size, NULL);
+}
+
 /* Write all of the chars in OBS to the assembler.  Recycle the blocks
    in obs as this is being done.  */
 
@@ -142,10 +138,6 @@ lto_write_stream (struct lto_output_stream *obs)
       if (!next_block)
        num_chars -= obs->left_in_block;
 
-      /* FIXME lto: WPA mode uses an ELF function as a lang_hook to append
-         output data.  This hook is not happy with the way that compression
-         blocks up output differently to the way it's blocked here.  So for
-         now, we don't compress WPA output.  */
       if (compression_stream)
        lto_compress_block (compression_stream, base, num_chars);
       else
@@ -176,6 +168,12 @@ lto_output_decl_index (struct lto_output_stream *obs,
   if (!existed_p)
     {
       index = encoder->trees.length ();
+      if (streamer_dump_file)
+       {
+         print_node_brief (streamer_dump_file, "    Encoding indexable ",
+                           name, 4);
+         fprintf (streamer_dump_file, "  as %i \n", index);
+       }
       encoder->trees.safe_push (name);
       new_entry_p = TRUE;
     }
@@ -314,6 +312,9 @@ lto_new_out_decl_state (void)
   for (i = 0; i < LTO_N_DECL_STREAMS; i++)
     lto_init_tree_ref_encoder (&state->streams[i]);
 
+  /* At WPA time we do not compress sections by default.  */
+  state->compressed = !flag_wpa;
+
   return state;
 }