* [lto] Tidy some formatting
@ 2008-10-21 20:58 Diego Novillo
0 siblings, 0 replies; only message in thread
From: Diego Novillo @ 2008-10-21 20:58 UTC (permalink / raw)
To: gcc-patches
No functional changes. Found while working on another patch.
Diego.
* lto-function-in.c (lto_input_function_body): Tidy some formatting.
* lto-header.h: Likewise.
* lto-section-in.c: Likewise.
* lto-stream-debug.c: Likewise.
* lto-section-out.c: Likewise.
lto/ChangeLog
* lto.c: Tidy some formatting.
* lto.h: Likewise.
Index: lto-function-in.c
===================================================================
--- lto-function-in.c (revision 141272)
+++ lto-function-in.c (working copy)
@@ -2603,7 +2603,7 @@ lto_input_function_body (struct lto_file
/* Read in VAR_DECL using DATA. File_data are the global decls and types. */
void
-lto_input_constructors_and_inits (struct lto_file_decl_data* file_data,
+lto_input_constructors_and_inits (struct lto_file_decl_data *file_data,
const char *data)
{
lto_read_body (file_data, NULL, data, LTO_section_static_initializer);
Index: lto-header.h
===================================================================
--- lto-header.h (revision 141272)
+++ lto-header.h (working copy)
@@ -32,9 +32,9 @@
#define LTO_major_version 1
#define LTO_minor_version 0
-/* This is all of the section types that are in the .o file. This
- list will grow as the number of ipa passes grows since each ipa
- pass will need it's own section type to store it's summary
+/* These are all the LTO section types that are in an object file. This
+ list will grow as the number of IPA passes grows since each IPA
+ pass will need its own section type to store its summary
information. */
enum lto_section_type
{
@@ -65,7 +65,7 @@ struct lto_simple_header
int32_t compressed_size;
};
-/* This are indices to the type and decl streams. */
+/* Indices to the various function, type and symbol streams. */
typedef enum {
LTO_DECL_STREAM_TYPE = 0, /* Must be first. */
LTO_DECL_STREAM_FIELD_DECL,
Index: lto-section-in.c
===================================================================
--- lto-section-in.c (revision 141273)
+++ lto-section-in.c (working copy)
@@ -246,14 +246,14 @@ lto_get_file_decl_data (void)
return file_decl_data;
}
-/* Return a char pointer to the start of a data stream for an lto pass
+/* Return a char pointer to the start of a data stream for an LTO pass
or function. FILE_DATA indicates where to obtain the data.
SECTION_TYPE is the type of information to be obtained. NAME is
the name of the function and is only used when finding a function
body; otherwise it is NULL. LEN is the size of the data
returned. */
-const char*
+const char *
lto_get_section_data (struct lto_file_decl_data *file_data,
enum lto_section_type section_type,
const char *name,
Index: lto/lto.c
===================================================================
--- lto/lto.c (revision 141272)
+++ lto/lto.c (working copy)
@@ -61,9 +61,11 @@ lto_materialize_constructors_and_inits (
{
size_t len;
const char *data = lto_get_section_data (file_data,
- LTO_section_static_initializer, NULL, &len);
+ LTO_section_static_initializer,
+ NULL, &len);
lto_input_constructors_and_inits (file_data, data);
- lto_free_section_data (file_data, LTO_section_static_initializer, NULL, data, len);
+ lto_free_section_data (file_data, LTO_section_static_initializer, NULL,
+ data, len);
}
/* Read the function body for the function associated with NODE if possible. */
@@ -211,15 +213,13 @@ static void
lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
VEC(ld_plugin_symbol_resolution_t,heap) *resolutions)
{
- const struct lto_decl_header * header
- = (const struct lto_decl_header *) data;
+ const struct lto_decl_header *header = (const struct lto_decl_header *) data;
const int32_t decl_offset = sizeof (struct lto_decl_header);
const int32_t main_offset = decl_offset + header->decl_state_size;
const int32_t string_offset = main_offset + header->main_size;
#ifdef LTO_STREAM_DEBUGGING
int32_t debug_main_offset;
#endif
-
struct lto_input_block ib_main;
struct lto_input_block debug_main;
struct data_in data_in;
@@ -231,9 +231,11 @@ lto_read_decls (struct lto_file_decl_dat
debug_main_offset = string_offset + header->string_size;
#endif
- LTO_INIT_INPUT_BLOCK (ib_main, (const char*) data + main_offset, 0, header->main_size);
+ LTO_INIT_INPUT_BLOCK (ib_main, (const char *) data + main_offset, 0,
+ header->main_size);
#ifdef LTO_STREAM_DEBUGGING
- LTO_INIT_INPUT_BLOCK (debug_main, (const char*) data + debug_main_offset, 0, header->debug_main_size);
+ LTO_INIT_INPUT_BLOCK (debug_main, (const char *) data + debug_main_offset, 0,
+ header->debug_main_size);
#endif
memset (&data_in, 0, sizeof (struct data_in));
@@ -267,9 +269,9 @@ lto_read_decls (struct lto_file_decl_dat
/* 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 =
- (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++;
gcc_assert (num_decl_states > 0);
@@ -278,9 +280,9 @@ lto_read_decls (struct lto_file_decl_dat
decl_data->global_decl_state);
/* Read in per-function decl states and enter them in hash table. */
-
decl_data->function_decl_states =
htab_create (37, lto_hash_in_decl_state, lto_eq_in_decl_state, free);
+
for (i = 1; i < num_decl_states; i++)
{
struct lto_in_decl_state *state = lto_new_in_decl_state ();
@@ -375,29 +377,22 @@ lto_resolution_read (FILE *resolution, c
and process the .o index into the cgraph nodes so that it can open
the .o file to load the functions and ipa information. */
-static struct lto_file_decl_data*
+static struct lto_file_decl_data *
lto_file_read (lto_file *file, FILE *resolution_file)
{
- struct lto_file_decl_data* file_data;
+ struct lto_file_decl_data *file_data;
const char *data;
size_t len;
- htab_t section_hash_table;
- htab_t renaming_hash_table;
-
- VEC(ld_plugin_symbol_resolution_t,heap) *resolutions =
- lto_resolution_read (resolution_file, file->filename);
-
- file_data = XNEW (struct lto_file_decl_data);
+ VEC(ld_plugin_symbol_resolution_t,heap) *resolutions;
+
+ resolutions = lto_resolution_read (resolution_file, file->filename);
+ file_data = XCNEW (struct lto_file_decl_data);
file_data->file_name = file->filename;
file_data->fd = -1;
+ file_data->section_hash_table = lto_elf_build_section_table (file);
+ file_data->renaming_hash_table = lto_create_renaming_table ();
- section_hash_table = lto_elf_build_section_table (file);
- file_data->section_hash_table = section_hash_table;
-
- renaming_hash_table = lto_create_renaming_table ();
- file_data->renaming_hash_table = renaming_hash_table;
-
data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len);
lto_read_decls (file_data, data, resolutions);
lto_free_section_data (file_data, LTO_section_decls, NULL, data, len);
@@ -458,7 +453,7 @@ lto_read_section_data (struct lto_file_d
/* Get the section data from FILE_DATA of SECTION_TYPE with NAME.
- NAME will be null unless the section type is for a function
+ NAME will be NULL unless the section type is for a function
body. */
static const char *
@@ -474,7 +469,7 @@ get_section_data (struct lto_file_decl_d
char *data = NULL;
s_slot.name = section_name;
- f_slot = (struct lto_section_slot *)htab_find (section_hash_table, &s_slot);
+ f_slot = (struct lto_section_slot *) htab_find (section_hash_table, &s_slot);
if (f_slot)
{
data = lto_read_section_data (file_data, f_slot->start, f_slot->len);
@@ -946,7 +941,7 @@ free_decl (const void *p, void *data ATT
prevailing one. */
static void
-lto_fixup_decls (struct lto_file_decl_data** files)
+lto_fixup_decls (struct lto_file_decl_data **files)
{
unsigned int i;
tree decl;
@@ -1020,7 +1015,7 @@ lto_main (int debug_p ATTRIBUTE_UNUSED)
if (!file_data)
break;
- all_file_decl_data [j++] = file_data;
+ all_file_decl_data[j++] = file_data;
lto_elf_file_close (current_lto_file);
current_lto_file = NULL;
@@ -1029,7 +1024,7 @@ lto_main (int debug_p ATTRIBUTE_UNUSED)
if (resolution_file_name)
fclose (resolution);
- all_file_decl_data [j] = NULL;
+ all_file_decl_data[j] = NULL;
lto_fixup_decls (all_file_decl_data);
Index: lto/lto.h
===================================================================
--- lto/lto.h (revision 141272)
+++ lto/lto.h (working copy)
@@ -76,11 +76,12 @@ extern void lto_elf_end_section (void);
extern lto_file *lto_set_current_out_file (lto_file *file);
extern lto_file *lto_get_current_out_file (void);
-/* Hash table entry to hold the start offset and length of an lto
+/* Hash table entry to hold the start offset and length of an LTO
section in a .o file. */
-struct lto_section_slot {
- const char * name;
+struct lto_section_slot
+{
+ const char *name;
intptr_t start;
size_t len;
};
Index: lto-stream-debug.c
===================================================================
--- lto-stream-debug.c (revision 141272)
+++ lto-stream-debug.c (working copy)
@@ -61,8 +61,7 @@ lto_debug_wide_internal (struct lto_debu
/* Write TAG to CONTEXT and increment indent. */
void
-lto_debug_indent (struct lto_debug_context *context,
- int tag)
+lto_debug_indent (struct lto_debug_context *context, int tag)
{
int i;
const char *tag_name = context->tag_names[tag];
Index: lto-section-out.c
===================================================================
--- lto-section-out.c (revision 141272)
+++ lto-section-out.c (working copy)
@@ -1223,7 +1223,7 @@ produce_symtab (htab_t hash)
bitmap seen;
lto_begin_section (section_name);
- free(section_name);
+ free (section_name);
bitmap_obstack_initialize (NULL);
seen = BITMAP_ALLOC (NULL);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-10-21 18:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-21 20:58 [lto] Tidy some formatting Diego Novillo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).