This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFC PATCH, LTO] Linked list of stmt uids->stmts fixup hooks
- From: Martin Jambor <mjambor at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Diego Novillo <dnovillo at google dot com>, Richard Guenther <rguenther at suse dot de>
- Date: Tue, 3 Nov 2009 21:28:48 +0100
- Subject: [RFC PATCH, LTO] Linked list of stmt uids->stmts fixup hooks
Hi,
while working on streaming of indirect inlinining information I
need to turn gimple stmt uids into gimple statements in the same way
this is done for call graph edges.
I can either call a function in ipa-prop.c doing this directly from
input_function() in lto-streamer-in.c or add some generic simplisitc
infrastructure like what is in the patch below. I simply added a
linked list of hooks that I envision will consist of static
structures, one per running IPA pass that needs this.
Alternatively, running fixup_call_stmt_edges() after IPA decisions are
made (and inlining decisions in particular). So far I assumed it was
called before in non-wpa mode on purpose.
The patch is untested. What do you think about this approach?
Thanks,
Martin
2009-11-03 Martin Jambor <mjambor@suse.cz>
* lto-streamer.h (struct lto_stmt_fixup_hook_list_element): New type.
(lto_stmt_fixup_hook_list) Declare.
* lto-streamer-in.c (input_function): Call all stmt fixup hooks in
lto_stmt_fixup_hook_list.
(lto_stmt_fixup_hook_list) New variable.
Index: icln/gcc/lto-streamer-in.c
===================================================================
--- icln.orig/gcc/lto-streamer-in.c
+++ icln/gcc/lto-streamer-in.c
@@ -59,6 +59,9 @@ struct string_slot
/* The table to hold the file names. */
static htab_t file_name_hash_table;
+/* Linked list of pointers to stmt uids -> stmts fixup functions. */
+struct lto_stmt_fixup_hook_list_element *lto_stmt_fixup_hook_list;
+
/* Check that tag ACTUAL has one of the given values. NUM_TAGS is the
number of valid tag values to check. */
@@ -1261,6 +1264,9 @@ input_function (tree fn_decl, struct dat
gimple *stmts;
basic_block bb;
struct bitpack_d *bp;
+ struct cgraph_node *node;
+ struct lto_stmt_fixup_hook_list_element *fixup_hook;
+
fn = DECL_STRUCT_FUNCTION (fn_decl);
tag = input_record_start (ib);
@@ -1340,7 +1346,12 @@ input_function (tree fn_decl, struct dat
gimple_set_body (fn_decl, bb_seq (ei_edge (ei)->dest));
}
- fixup_call_stmt_edges (cgraph_node (fn_decl), stmts);
+ node = cgraph_node (fn_decl);
+ fixup_call_stmt_edges (node, stmts);
+ for (fixup_hook = lto_stmt_fixup_hook_list;
+ fixup_hook;
+ fixup_hook = fixup_hook->next)
+ fixup_hook->hook (node, stmts);
update_ssa (TODO_update_ssa_only_virtuals);
free_dominance_info (CDI_DOMINATORS);
Index: icln/gcc/lto-streamer.h
===================================================================
--- icln.orig/gcc/lto-streamer.h
+++ icln/gcc/lto-streamer.h
@@ -689,6 +689,13 @@ struct data_in
struct lto_streamer_cache_d *reader_cache;
};
+/* Add-only linked list of functions that turn gimple statement uids into
+ gimple statements in IPA-pass info. */
+struct lto_stmt_fixup_hook_list_element
+{
+ void (*hook)(struct cgraph_node *, gimple *);
+ struct lto_stmt_fixup_hook_list_element *next;
+};
/* In lto-section-in.c */
extern struct lto_input_block * lto_create_simple_input_block (
@@ -803,6 +810,8 @@ extern void lto_check_version (int, int)
/* In lto-streamer-in.c */
+extern struct lto_stmt_fixup_hook_list_element *lto_stmt_fixup_hook_list;
+
extern void lto_input_cgraph (struct lto_file_decl_data *, const char *);
extern void lto_init_reader (void);
extern tree lto_input_tree (struct lto_input_block *, struct data_in *);