aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-04-30 20:44:41 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-04-30 18:44:41 +0000
commitace72c88c59513b361ce1cfffed07e14990b6bba (patch)
treecb91ee477b569e52145f60b6fcf1d8acc58becd3
parentbf65e4b1840a177da33775556f9b7f7eecf66fc4 (diff)
downloadgcc-ace72c88c59513b361ce1cfffed07e14990b6bba.zip
gcc-ace72c88c59513b361ce1cfffed07e14990b6bba.tar.gz
gcc-ace72c88c59513b361ce1cfffed07e14990b6bba.tar.bz2
lto.c (get_filename_for_set): Look for cgraph node and if none found, use default name.
* lto.c (get_filename_for_set): Look for cgraph node and if none found, use default name. (lto_wpa_write_files): Write any non-empty partition. * cgraph.h (cgraph_node_set_nonempty_p, varpool_node_set_nonempty_p): New. * lto-cgraph.c (input_cgraph): Remove call to lto_mark_file_for_ltrans. * lto-streamer.h (lto_file_decl_data): Remove needs_ltrans_p. (lto_file_needs_ltrans_p, lto_mark_file_for_ltrans, cgraph_node_set_needs_ltrans_p): Remove. From-SVN: r158943
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cgraph.h14
-rw-r--r--gcc/lto-cgraph.c4
-rw-r--r--gcc/lto-streamer.h35
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/lto.c88
6 files changed, 72 insertions, 83 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index adf9734..5a7de8f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2010-04-30 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.h (cgraph_node_set_nonempty_p, varpool_node_set_nonempty_p): New.
+ * lto-cgraph.c (input_cgraph): Remove call to lto_mark_file_for_ltrans.
+ * lto-streamer.h (lto_file_decl_data): Remove needs_ltrans_p.
+ (lto_file_needs_ltrans_p, lto_mark_file_for_ltrans,
+ cgraph_node_set_needs_ltrans_p): Remove.
+
2010-04-30 Steven Bosscher <steven@gcc.gnu.org>
* sdbout.c: Include vec.h, do not include varray.h.
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index ed6ce6e..80594b1 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -827,6 +827,20 @@ struct GTY(()) constant_descriptor_tree {
hashval_t hash;
};
+/* Return true if set is nonempty. */
+static inline bool
+cgraph_node_set_nonempty_p (cgraph_node_set set)
+{
+ return VEC_length (cgraph_node_ptr, set->nodes);
+}
+
+/* Return true if set is nonempty. */
+static inline bool
+varpool_node_set_nonempty_p (varpool_node_set set)
+{
+ return VEC_length (varpool_node_ptr, set->nodes);
+}
+
/* Return true when function NODE is only called directly.
i.e. it is not externally visible, address was not taken and
it is not used in any other non-standard way. */
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 8a8855a..3f7a22b 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -962,10 +962,6 @@ input_cgraph (void)
input_varpool_1 (file_data, ib);
lto_destroy_simple_input_block (file_data, LTO_section_varpool,
ib, data, len);
-
- /* Assume that every file read needs to be processed by LTRANS. */
- if (flag_wpa)
- lto_mark_file_for_ltrans (file_data);
}
/* Clear out the aux field that was used to store enough state to
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 173f921..cc1922a 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -552,9 +552,6 @@ struct GTY(()) lto_file_decl_data
/* The .o file that these offsets relate to. */
const char *GTY((skip)) file_name;
- /* Nonzero if this file should be recompiled with LTRANS. */
- unsigned needs_ltrans_p : 1;
-
/* Hash table maps lto-related section names to location in file. */
htab_t GTY((skip)) section_hash_table;
@@ -922,38 +919,6 @@ lto_tag_to_tree_code (enum LTO_tags tag)
return (enum tree_code) ((unsigned) tag - 1);
}
-
-/* Return true if FILE needs to be compiled with LTRANS. */
-static inline bool
-lto_file_needs_ltrans_p (struct lto_file_decl_data *file)
-{
- return file->needs_ltrans_p != 0;
-}
-
-
-/* Mark FILE to be compiled with LTRANS. */
-static inline void
-lto_mark_file_for_ltrans (struct lto_file_decl_data *file)
-{
- file->needs_ltrans_p = 1;
-}
-
-
-/* Return true if any files in node set SET need to be compiled
- with LTRANS. */
-static inline bool
-cgraph_node_set_needs_ltrans_p (cgraph_node_set set)
-{
- cgraph_node_set_iterator csi;
-
- for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
- if (lto_file_needs_ltrans_p (csi_node (csi)->local.lto_file_data))
- return true;
-
- return false;
-}
-
-
/* Initialize an lto_out_decl_buffer ENCODER. */
static inline void
lto_init_tree_ref_encoder (struct lto_tree_ref_encoder *encoder,
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 78452a7..c17da3b 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,5 +1,11 @@
2010-04-30 Jan Hubicka <jh@suse.cz>
+ * lto.c (get_filename_for_set): Look for cgraph node and if none found, use
+ default name.
+ (lto_wpa_write_files): Write any non-empty partition.
+
+2010-04-30 Jan Hubicka <jh@suse.cz>
+
* lto.c: Do not attempt to make constant pool references global.
2010-04-28 Jan Hubicka <jh@suse.cz>
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 18fef05..d306580 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -817,57 +817,50 @@ get_filename_for_set (cgraph_node_set set)
char *fname = NULL;
static const size_t max_fname_len = 100;
- if (cgraph_node_set_needs_ltrans_p (set))
+ /* Create a new temporary file to store SET. To facilitate
+ debugging, use file names from SET as part of the new
+ temporary file name. */
+ cgraph_node_set_iterator si;
+ struct pointer_set_t *pset = pointer_set_create ();
+ for (si = csi_start (set); !csi_end_p (si); csi_next (&si))
{
- /* Create a new temporary file to store SET. To facilitate
- debugging, use file names from SET as part of the new
- temporary file name. */
- cgraph_node_set_iterator si;
- struct pointer_set_t *pset = pointer_set_create ();
- for (si = csi_start (set); !csi_end_p (si); csi_next (&si))
- {
- struct cgraph_node *n = csi_node (si);
- const char *node_fname;
- char *f;
+ struct cgraph_node *n = csi_node (si);
+ const char *node_fname;
+ char *f;
- /* Don't use the same file name more than once. */
- if (pointer_set_insert (pset, n->local.lto_file_data))
- continue;
+ /* Don't use the same file name more than once. */
+ if (pointer_set_insert (pset, n->local.lto_file_data))
+ continue;
- /* The first file name found in SET determines the output
- directory. For the remaining files, we use their
- base names. */
- node_fname = n->local.lto_file_data->file_name;
- if (fname == NULL)
- {
- fname = strip_extension (node_fname);
- continue;
- }
+ /* The first file name found in SET determines the output
+ directory. For the remaining files, we use their
+ base names. */
+ node_fname = n->local.lto_file_data->file_name;
+ if (fname == NULL)
+ {
+ fname = strip_extension (node_fname);
+ continue;
+ }
- f = strip_extension (lbasename (node_fname));
+ f = strip_extension (lbasename (node_fname));
- /* If the new name causes an excessively long file name,
- make the last component "___" to indicate overflow. */
- if (strlen (fname) + strlen (f) > max_fname_len - 3)
- {
- fname = reconcat (fname, fname, "___", NULL);
- break;
- }
- else
- {
- fname = reconcat (fname, fname, "_", f, NULL);
- free (f);
- }
+ /* If the new name causes an excessively long file name,
+ make the last component "___" to indicate overflow. */
+ if (strlen (fname) + strlen (f) > max_fname_len - 3)
+ {
+ fname = reconcat (fname, fname, "___", NULL);
+ break;
+ }
+ else
+ {
+ fname = reconcat (fname, fname, "_", f, NULL);
+ free (f);
}
+ }
- pointer_set_destroy (pset);
+ pointer_set_destroy (pset);
- /* Add the extension .wpa.o to indicate that this file has been
- produced by WPA. */
- fname = reconcat (fname, fname, ".wpa.o", NULL);
- gcc_assert (fname);
- }
- else
+ if (!fname)
{
/* Since SET does not need to be processed by LTRANS, use
the original file name and mark it with a '*' prefix so that
@@ -876,6 +869,13 @@ get_filename_for_set (cgraph_node_set set)
struct cgraph_node *first = csi_node (si);
fname = prefix_name_with_star (first->local.lto_file_data->file_name);
}
+ else
+ {
+ /* Add the extension .wpa.o to indicate that this file has been
+ produced by WPA. */
+ fname = reconcat (fname, fname, ".wpa.o", NULL);
+ gcc_assert (fname);
+ }
return fname;
}
@@ -933,7 +933,7 @@ lto_wpa_write_files (void)
temp_filename = get_filename_for_set (set);
output_files[i] = temp_filename;
- if (cgraph_node_set_needs_ltrans_p (set))
+ if (cgraph_node_set_nonempty_p (set) || varpool_node_set_nonempty_p (vset))
{
/* Write all the nodes in SET to TEMP_FILENAME. */
file = lto_obj_file_open (temp_filename, true);