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