Commit ace72c88 by Jan Hubicka Committed by Jan Hubicka

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
parent bf65e4b1
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.
......
......@@ -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. */
......
......@@ -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
......
......@@ -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,
......
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>
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment