summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-09 21:38:00 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-09 21:38:00 +0000
commitba000093030681d638994482d8eafc8b41c4822b (patch)
tree0fa5fbb2a370d97a2ae01365d2990eccfaad9616
parent6a261eec319e0fc445f198da58976343b300613b (diff)
downloadgcc-ba000093030681d638994482d8eafc8b41c4822b.tar.gz
PR middle-end/64412
* lto-streamer.h (lto_stream_offload_p): New declaration. * lto-streamer.c (lto_stream_offload_p): New variable. * cgraphunit.c (ipa_passes): Set lto_stream_offload_p at the same time as section_name_prefix. * lto-streamer-out.c (hash_tree): Don't hash TREE_TARGET_OPTION if lto_stream_offload_p. * tree-streamer-out.c (streamer_pack_tree_bitfields): Don't stream TREE_TARGET_OPTION if lto_stream_offload_p. (write_ts_function_decl_tree_pointers): Don't stream DECL_FUNCTION_SPECIFIC_TARGET if lto_stream_offload_p. * tree-streamer-in.c (unpack_value_fields): Don't stream TREE_TARGET_OPTION in if ACCEL_COMPILER. (lto_input_ts_function_decl_tree_pointers): Don't stream DECL_FUNCTION_SPECIFIC_TARGET in if ACCEL_COMPILER. * lto-opts.c (lto_write_options): Use lto_stream_offload_p instead of section_name_prefix string comparisons. lto/ * lto.c (read_cgraph_and_symbols): Set lto_stream_offload_p if ACCEL_COMPILER. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219410 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog21
-rw-r--r--gcc/cgraphunit.c3
-rw-r--r--gcc/lto-opts.c7
-rw-r--r--gcc/lto-streamer-out.c4
-rw-r--r--gcc/lto-streamer.c2
-rw-r--r--gcc/lto-streamer.h4
-rw-r--r--gcc/lto/ChangeLog7
-rw-r--r--gcc/lto/lto.c3
-rw-r--r--gcc/tree-streamer-in.c4
-rw-r--r--gcc/tree-streamer-out.c8
10 files changed, 55 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 01f1335fcde..8ad86033fdc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,24 @@
+2015-01-09 Bernd Schmidt <bernds@codesourcery.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/64412
+ * lto-streamer.h (lto_stream_offload_p): New declaration.
+ * lto-streamer.c (lto_stream_offload_p): New variable.
+ * cgraphunit.c (ipa_passes): Set lto_stream_offload_p
+ at the same time as section_name_prefix.
+ * lto-streamer-out.c (hash_tree): Don't hash TREE_TARGET_OPTION
+ if lto_stream_offload_p.
+ * tree-streamer-out.c (streamer_pack_tree_bitfields): Don't
+ stream TREE_TARGET_OPTION if lto_stream_offload_p.
+ (write_ts_function_decl_tree_pointers): Don't
+ stream DECL_FUNCTION_SPECIFIC_TARGET if lto_stream_offload_p.
+ * tree-streamer-in.c (unpack_value_fields): Don't stream
+ TREE_TARGET_OPTION in if ACCEL_COMPILER.
+ (lto_input_ts_function_decl_tree_pointers): Don't stream
+ DECL_FUNCTION_SPECIFIC_TARGET in if ACCEL_COMPILER.
+ * lto-opts.c (lto_write_options): Use lto_stream_offload_p
+ instead of section_name_prefix string comparisons.
+
2015-01-09 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/64536
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index e3be36090f7..149f4474e3d 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2114,11 +2114,14 @@ ipa_passes (void)
if (g->have_offload)
{
section_name_prefix = OFFLOAD_SECTION_NAME_PREFIX;
+ lto_stream_offload_p = true;
ipa_write_summaries (true);
+ lto_stream_offload_p = false;
}
if (flag_lto)
{
section_name_prefix = LTO_SECTION_NAME_PREFIX;
+ lto_stream_offload_p = false;
ipa_write_summaries (false);
}
}
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index 9a635b157a0..026b323b46f 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -167,7 +167,7 @@ lto_write_options (void)
"-fno-strict-overflow");
/* Append options from target hook and store them to offload_lto section. */
- if (strcmp (section_name_prefix, OFFLOAD_SECTION_NAME_PREFIX) == 0)
+ if (lto_stream_offload_p)
{
char *offload_opts = targetm.offload_options ();
char *offload_ptr = offload_opts;
@@ -208,7 +208,7 @@ lto_write_options (void)
/* Do not store target-specific options in offload_lto section. */
if ((cl_options[option->opt_index].flags & CL_TARGET)
- && strcmp (section_name_prefix, OFFLOAD_SECTION_NAME_PREFIX) == 0)
+ && lto_stream_offload_p)
continue;
/* Drop options created from the gcc driver that will be rejected
@@ -221,8 +221,7 @@ lto_write_options (void)
We do not need those. The only exception is -foffload option, if we
write it in offload_lto section. Also drop all diagnostic options. */
if ((cl_options[option->opt_index].flags & (CL_DRIVER|CL_WARNING))
- && (strcmp (section_name_prefix, OFFLOAD_SECTION_NAME_PREFIX) != 0
- || option->opt_index != OPT_foffload_))
+ && (!lto_stream_offload_p || option->opt_index != OPT_foffload_))
continue;
for (j = 0; j < option->canonical_option_num_elements; ++j)
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 6be260fd515..21a78bb77aa 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -949,7 +949,9 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map<tree, hashval_t> *map,
hstate.add (TRANSLATION_UNIT_LANGUAGE (t),
strlen (TRANSLATION_UNIT_LANGUAGE (t)));
- if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
+ if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)
+ /* We don't stream these when passing things to a different target. */
+ && !lto_stream_offload_p)
hstate.add_wide_int (cl_target_option_hash (TREE_TARGET_OPTION (t)));
if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index 26b26c295fc..6b4e0f279ae 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -67,6 +67,8 @@ static bitmap_obstack lto_obstack;
static bool lto_obstack_initialized;
const char *section_name_prefix = LTO_SECTION_NAME_PREFIX;
+/* Set when streaming LTO for offloading compiler. */
+bool lto_stream_offload_p;
/* Return a string representing LTO tag TAG. */
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index b661a27f5ee..853630f1931 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -744,6 +744,10 @@ extern void lto_append_block (struct lto_output_stream *);
/* In lto-streamer.c. */
+
+/* Set when streaming LTO for offloading compiler. */
+extern bool lto_stream_offload_p;
+
extern const char *lto_tag_name (enum LTO_tags);
extern bitmap lto_bitmap_alloc (void);
extern void lto_bitmap_free (bitmap);
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index dc3354b7ee9..7bcb7dd1c5d 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-09 Bernd Schmidt <bernds@codesourcery.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/64412
+ * lto.c (read_cgraph_and_symbols): Set lto_stream_offload_p
+ if ACCEL_COMPILER.
+
2015-01-09 Michael Collison <michael.collison@linaro.org>
* lto.c: Include hash-set.h, machmode.h, vec.h, double-int.h,
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index ed69c74a712..96e5fd18ac1 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -2909,7 +2909,8 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
timevar_push (TV_IPA_LTO_DECL_IN);
#ifdef ACCEL_COMPILER
- section_name_prefix = OFFLOAD_SECTION_NAME_PREFIX;
+ section_name_prefix = OFFLOAD_SECTION_NAME_PREFIX;
+ lto_stream_offload_p = true;
#endif
real_file_decl_data
diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c
index a717fe278fe..c43685259de 100644
--- a/gcc/tree-streamer-in.c
+++ b/gcc/tree-streamer-in.c
@@ -529,8 +529,10 @@ unpack_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr)
vec_safe_grow (CONSTRUCTOR_ELTS (expr), length);
}
+#ifndef ACCEL_COMPILER
if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
cl_target_option_stream_in (data_in, bp, TREE_TARGET_OPTION (expr));
+#endif
if (code == OMP_CLAUSE)
unpack_ts_omp_clause_value_fields (data_in, bp, expr);
@@ -794,7 +796,9 @@ lto_input_ts_function_decl_tree_pointers (struct lto_input_block *ib,
DECL_VINDEX (expr) = stream_read_tree (ib, data_in);
/* DECL_STRUCT_FUNCTION is loaded on demand by cgraph_get_body. */
DECL_FUNCTION_PERSONALITY (expr) = stream_read_tree (ib, data_in);
+#ifndef ACCEL_COMPILER
DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in);
+#endif
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = stream_read_tree (ib, data_in);
/* If the file contains a function with an EH personality set,
diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c
index 84ea21ef25d..480fb1e272c 100644
--- a/gcc/tree-streamer-out.c
+++ b/gcc/tree-streamer-out.c
@@ -480,7 +480,9 @@ streamer_pack_tree_bitfields (struct output_block *ob,
if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
bp_pack_var_len_unsigned (bp, CONSTRUCTOR_NELTS (expr));
- if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
+ if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)
+ /* Don't stream these when passing things to a different target. */
+ && !lto_stream_offload_p)
cl_target_option_stream_out (ob, bp, TREE_TARGET_OPTION (expr));
if (code == OMP_CLAUSE)
@@ -695,7 +697,9 @@ write_ts_function_decl_tree_pointers (struct output_block *ob, tree expr,
stream_write_tree (ob, DECL_VINDEX (expr), ref_p);
/* DECL_STRUCT_FUNCTION is handled by lto_output_function. */
stream_write_tree (ob, DECL_FUNCTION_PERSONALITY (expr), ref_p);
- stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p);
+ /* Don't stream these when passing things to a different target. */
+ if (!lto_stream_offload_p)
+ stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p);
stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr), ref_p);
}