Commit ee7a003f by Martin Liska Committed by Martin Liska

Fix GNU coding style in lto-common.c.

2019-05-06  Martin Liska  <mliska@suse.cz>

	* lto-common.c: Update coding style.
	* lto.c (materialize_cgraph): Likewise.

From-SVN: r270898
parent 66d62d9f
2019-05-06 Martin Liska <mliska@suse.cz>
* lto-common.c: Update coding style.
* lto.c (materialize_cgraph): Likewise.
2019-05-06 Hrishikesh Kulkarni <hrishikeshparag@gmail.com>
Martin Liska <mliska@suse.cz>
......
......@@ -76,15 +76,15 @@ hash_name (const void *p)
static int
eq_name (const void *p1, const void *p2)
{
const struct lto_section_slot *s1 =
(const struct lto_section_slot *) p1;
const struct lto_section_slot *s2 =
(const struct lto_section_slot *) p2;
const struct lto_section_slot *s1
= (const struct lto_section_slot *) p1;
const struct lto_section_slot *s2
= (const struct lto_section_slot *) p2;
return strcmp (s1->name, s2->name) == 0;
}
/* Free lto_section_slot */
/* Free lto_section_slot. */
static void
free_with_string (void *arg)
......@@ -95,7 +95,7 @@ free_with_string (void *arg)
free (arg);
}
/* Create section hash table */
/* Create section hash table. */
htab_t
lto_obj_create_section_hash_table (void)
......@@ -437,8 +437,8 @@ gimple_register_canonical_type (tree t)
TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t));
else
{
gimple_register_canonical_type_1 (TYPE_MAIN_VARIANT (t),
hash_canonical_type (TYPE_MAIN_VARIANT (t)));
hashval_t h = hash_canonical_type (TYPE_MAIN_VARIANT (t));
gimple_register_canonical_type_1 (TYPE_MAIN_VARIANT (t), h);
TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t));
}
}
......@@ -1808,8 +1808,8 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
/* Read in lto_in_decl_state objects. */
data_ptr = (const uint32_t *) ((const char*) data + decl_offset);
data_end =
(const uint32_t *) ((const char*) data_ptr + header->decl_state_size);
data_end
= (const uint32_t *) ((const char*) data_ptr + header->decl_state_size);
num_decl_states = *data_ptr++;
gcc_assert (num_decl_states > 0);
......@@ -1818,8 +1818,8 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
decl_data->global_decl_state);
/* Read in per-function decl states and enter them in hash table. */
decl_data->function_decl_states =
hash_table<decl_state_hasher>::create_ggc (37);
decl_data->function_decl_states
= hash_table<decl_state_hasher>::create_ggc (37);
for (i = 1; i < num_decl_states; i++)
{
......@@ -1919,12 +1919,12 @@ lto_resolution_read (splay_tree file_ids, FILE *resolution, lto_file *file)
char r_str[27];
enum ld_plugin_symbol_resolution r = (enum ld_plugin_symbol_resolution) 0;
unsigned int j;
unsigned int lto_resolution_str_len =
sizeof (lto_resolution_str) / sizeof (char *);
unsigned int lto_resolution_str_len
= sizeof (lto_resolution_str) / sizeof (char *);
res_pair rp;
t = fscanf (resolution, "%u " HOST_WIDE_INT_PRINT_HEX_PURE " %26s %*[^\n]\n",
&index, &id, r_str);
t = fscanf (resolution, "%u " HOST_WIDE_INT_PRINT_HEX_PURE
" %26s %*[^\n]\n", &index, &id, r_str);
if (t != 3)
internal_error ("invalid line in the resolution file");
......@@ -1957,11 +1957,11 @@ lto_resolution_read (splay_tree file_ids, FILE *resolution, lto_file *file)
}
}
/* List of file_decl_datas */
/* List of file_decl_datas. */
struct file_data_list
{
{
struct lto_file_decl_data *first, *last;
};
};
/* Is the name for a id'ed LTO section? */
......@@ -1981,7 +1981,7 @@ lto_section_with_id (const char *name, unsigned HOST_WIDE_INT *id)
return sscanf (s, "." HOST_WIDE_INT_PRINT_HEX_PURE, id) == 1;
}
/* Create file_data of each sub file id */
/* Create file_data of each sub file id. */
static int
create_subid_section_table (struct lto_section_slot *ls, splay_tree file_ids,
......@@ -1997,7 +1997,7 @@ create_subid_section_table (struct lto_section_slot *ls, splay_tree file_ids,
if (!lto_section_with_id (ls->name, &id))
return 1;
/* Find hash table of sub module id */
/* Find hash table of sub module id. */
nd = lto_splay_tree_lookup (file_ids, id);
if (nd != NULL)
{
......@@ -2011,15 +2011,16 @@ create_subid_section_table (struct lto_section_slot *ls, splay_tree file_ids,
file_data->section_hash_table = lto_obj_create_section_hash_table ();
lto_splay_tree_insert (file_ids, id, file_data);
/* Maintain list in linker order */
/* Maintain list in linker order. */
if (!list->first)
list->first = file_data;
if (list->last)
list->last->next = file_data;
list->last = file_data;
}
/* Copy section into sub module hash table */
/* Copy section into sub module hash table. */
new_name = XDUPVEC (char, ls->name, strlen (ls->name) + 1);
s_slot.name = new_name;
hash_slot = htab_find_slot (file_data->section_hash_table, &s_slot, INSERT);
......@@ -2063,7 +2064,7 @@ lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file)
internal_error ("cannot read LTO decls from %s", file_data->file_name);
return;
}
/* Frees resolutions */
/* Frees resolutions. */
lto_read_decls (file_data, data, resolutions);
lto_free_section_data (file_data, LTO_section_decls, NULL, data, len);
}
......@@ -2121,11 +2122,12 @@ lto_file_read (lto_file *file, FILE *resolution_file, int *count)
for (section = section_list.first; section != NULL; section = section->next)
create_subid_section_table (section, file_ids, &file_list);
/* Add resolutions to file ids */
/* Add resolutions to file ids. */
lto_resolution_read (file_ids, resolution_file, file);
/* Finalize each lto file for each submodule in the merged object */
for (file_data = file_list.first; file_data != NULL; file_data = file_data->next)
/* Finalize each lto file for each submodule in the merged object. */
for (file_data = file_list.first; file_data != NULL;
file_data = file_data->next)
lto_create_files_from_ids (file, file_data, count);
splay_tree_delete (file_ids);
......@@ -2239,7 +2241,8 @@ get_section_data (struct lto_file_decl_data *file_data,
htab_t section_hash_table = file_data->section_hash_table;
struct lto_section_slot *f_slot;
struct lto_section_slot s_slot;
const char *section_name = lto_get_section_name (section_type, name, file_data);
const char *section_name = lto_get_section_name (section_type, name,
file_data);
char *data = NULL;
*len = 0;
......@@ -2460,7 +2463,8 @@ static GTY((length ("lto_stats.num_input_files + 1"))) struct lto_file_decl_data
like separate files for further passes. */
static void
lto_flatten_files (struct lto_file_decl_data **orig, int count, int last_file_ix)
lto_flatten_files (struct lto_file_decl_data **orig, int count,
int last_file_ix)
{
struct lto_file_decl_data *n, *next;
int i, k;
......@@ -2706,7 +2710,9 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
gcc_assert (all_file_decl_data[i]->symtab_node_encoder);
lto_symtab_encoder_delete (all_file_decl_data[i]->symtab_node_encoder);
all_file_decl_data[i]->symtab_node_encoder = NULL;
lto_free_function_in_decl_state (all_file_decl_data[i]->global_decl_state);
lto_in_decl_state *global_decl_state
= all_file_decl_data[i]->global_decl_state;
lto_free_function_in_decl_state (global_decl_state);
all_file_decl_data[i]->global_decl_state = NULL;
all_file_decl_data[i]->current_decl_state = NULL;
}
......
......@@ -291,7 +291,8 @@ lto_wpa_write_files (void)
timevar_push (TV_WHOPR_WPA);
FOR_EACH_VEC_ELT (ltrans_partitions, i, part)
lto_stats.num_output_symtab_nodes += lto_symtab_encoder_size (part->encoder);
lto_stats.num_output_symtab_nodes
+= lto_symtab_encoder_size (part->encoder);
timevar_pop (TV_WHOPR_WPA);
......@@ -324,15 +325,18 @@ lto_wpa_write_files (void)
sprintf (temp_filename + blen, "%u.o", i);
if (!quiet_flag)
fprintf (stderr, " %s (%s %i insns)", temp_filename, part->name, part->insns);
fprintf (stderr, " %s (%s %i insns)", temp_filename, part->name,
part->insns);
if (symtab->dump_file)
{
lto_symtab_encoder_iterator lsei;
fprintf (symtab->dump_file, "Writing partition %s to file %s, %i insns\n",
fprintf (symtab->dump_file,
"Writing partition %s to file %s, %i insns\n",
part->name, temp_filename, part->insns);
fprintf (symtab->dump_file, " Symbols in partition: ");
for (lsei = lsei_start_in_partition (part->encoder); !lsei_end_p (lsei);
for (lsei = lsei_start_in_partition (part->encoder);
!lsei_end_p (lsei);
lsei_next_in_partition (&lsei))
{
symtab_node *node = lsei_node (lsei);
......@@ -348,13 +352,15 @@ lto_wpa_write_files (void)
fprintf (symtab->dump_file, "%s ", node->asm_name ());
cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
if (cnode
&& lto_symtab_encoder_encode_body_p (part->encoder, cnode))
&& lto_symtab_encoder_encode_body_p (part->encoder,
cnode))
fprintf (symtab->dump_file, "(body included)");
else
{
varpool_node *vnode = dyn_cast <varpool_node *> (node);
if (vnode
&& lto_symtab_encoder_encode_initializer_p (part->encoder, vnode))
&& lto_symtab_encoder_encode_initializer_p (part->encoder,
vnode))
fprintf (symtab->dump_file, "(initializer included)");
}
}
......@@ -396,7 +402,7 @@ lto_wpa_write_files (void)
fatal_error (input_location,
"closing LTRANS output list %s: %m", ltrans_output_list);
free_ltrans_partitions();
free_ltrans_partitions ();
free (temp_filename);
timevar_pop (TV_WHOPR_WPA_IO);
......
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