diff gcc/lto-section-in.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line diff
--- a/gcc/lto-section-in.c	Thu Oct 25 07:37:49 2018 +0900
+++ b/gcc/lto-section-in.c	Thu Feb 13 11:34:05 2020 +0900
@@ -1,6 +1,6 @@
 /* Input functions for reading LTO sections.
 
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2020 Free Software Foundation, Inc.
    Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
 
 This file is part of GCC.
@@ -52,10 +52,11 @@
   "icf",
   "offload_table",
   "mode_table",
-  "hsa"
+  "hsa",
+  "lto",
+  "ipa_sra"
 };
 
-
 /* Hooks so that the ipa passes can call into the lto front end to get
    sections.  */
 
@@ -130,10 +131,11 @@
 const char *
 lto_get_section_data (struct lto_file_decl_data *file_data,
 		      enum lto_section_type section_type,
-		      const char *name,
+		      const char *name, int order,
 		      size_t *len, bool decompress)
 {
-  const char *data = (get_section_f) (file_data, section_type, name, len);
+  const char *data = (get_section_f) (file_data, section_type, name, order,
+				      len);
   const size_t header_length = sizeof (struct lto_data_header);
   struct lto_data_header *header;
   struct lto_buffer buffer;
@@ -146,7 +148,7 @@
   /* WPA->ltrans streams are not compressed with exception of function bodies
      and variable initializers that has been verbatim copied from earlier
      compilations.  */
-  if (!flag_ltrans || decompress)
+  if ((!flag_ltrans || decompress) && section_type != LTO_section_lto)
     {
       /* Create a mapping header containing the underlying data and length,
 	 and prepend this to the uncompression buffer.  The uncompressed data
@@ -161,27 +163,37 @@
 
       stream = lto_start_uncompression (lto_append_data, &buffer);
       lto_uncompress_block (stream, data, *len);
-      lto_end_uncompression (stream);
+      lto_end_uncompression (stream,
+			     file_data->lto_section_header.get_compression ());
 
       *len = buffer.length - header_length;
       data = buffer.data + header_length;
     }
 
-  lto_check_version (((const lto_header *)data)->major_version,
-		     ((const lto_header *)data)->minor_version,
-		     file_data->file_name);
   return data;
 }
 
+/* Return a char pointer to the start of a data stream for an LTO pass.
+   FILE_DATA indicates where to obtain the data.
+   SECTION_TYPE is the type of information to be obtained.
+   LEN is the size of the data returned.  */
+
+const char *
+lto_get_summary_section_data (struct lto_file_decl_data *file_data,
+			      enum lto_section_type section_type, size_t *len)
+{
+  return lto_get_section_data (file_data, section_type, NULL, 0, len);
+}
+
 /* Get the section data without any header parsing or uncompression.  */
 
 const char *
 lto_get_raw_section_data (struct lto_file_decl_data *file_data,
 			  enum lto_section_type section_type,
-			  const char *name,
+			  const char *name, int order,
 			  size_t *len)
 {
-  return (get_section_f) (file_data, section_type, name, len);
+  return (get_section_f) (file_data, section_type, name, order, len);
 }
 
 /* Free the data found from the above call.  The first three
@@ -231,12 +243,13 @@
    raw pointer to the section is returned in DATAR and LEN.  These are
    used to free the section.  Return NULL if the section is not present.  */
 
-struct lto_input_block *
+class lto_input_block *
 lto_create_simple_input_block (struct lto_file_decl_data *file_data,
 			       enum lto_section_type section_type,
 			       const char **datar, size_t *len)
 {
-  const char *data = lto_get_section_data (file_data, section_type, NULL, len);
+  const char *data = lto_get_section_data (file_data, section_type, NULL, 0,
+					   len);
   const struct lto_simple_header * header
     = (const struct lto_simple_header *) data;
 
@@ -260,7 +273,7 @@
 void
 lto_destroy_simple_input_block (struct lto_file_decl_data *file_data,
 				enum lto_section_type section_type,
-				struct lto_input_block *ib,
+				class lto_input_block *ib,
 				const char *data, size_t len)
 {
   delete ib;
@@ -440,7 +453,7 @@
 /* Report read pass end of the section.  */
 
 void
-lto_section_overrun (struct lto_input_block *ib)
+lto_section_overrun (class lto_input_block *ib)
 {
   fatal_error (input_location, "bytecode stream: trying to read %d bytes "
 	       "after the end of the input buffer", ib->p - ib->len);