summaryrefslogtreecommitdiff
path: root/gcc/streamer-hooks.h
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-11 12:02:34 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-11 12:02:34 +0000
commit515cf651fab16237fd7e4432dd090af8dee7c4cd (patch)
treec67c6c54079ea71a807b5373467385939adc98f6 /gcc/streamer-hooks.h
parente664a33430e3762854e0a2d6db1e5155aa86233f (diff)
downloadgcc-515cf651fab16237fd7e4432dd090af8dee7c4cd.tar.gz
* tree-streamer-out.c (lto_output_ts_decl_with_vis_tree_pointers):
Call stream_write_tree instead of output_record_start. (lto_output_ts_binfo_tree_pointers): Likewise. * streamer-hooks.h (stream_write_tree): Move from tree-streamer.h. Convert it to a macro. (stream_read_tree): Likewise. * lto-streamer.h (lto_stream_as_builtin_p): Move ... * tree-streamer.h (lto_stream_as_builtin_p): ... here. * lto-streamer-in.c (lto_read_tree): Call lto_streamer_cache_append and tree_read_bitfields. * lto-streamer-out.c (lto_is_streamable): Move from lto-streamer.c (lto_write_tree): Call it. * lto-streamer.c (lto_is_streamable): Move to lto-streamer-out.c * streamer-hooks.h (struct streamer_hooks): Remove fields name, is_streamable and alloc_tree. Update all users. * tree-streamer-in.c (tree_read_bitfields): Factor out of ... (lto_materialize_tree): ... here. Handle CALL_EXPR codes. Remove call to lto_streamer_cache_append. * tree-streamer-out.c (lto_output_tree_header): Handle CALL_EXPR nodes. * tree-streamer.h (tree_read_bitfields): Declare. * Makefile.in (TREE_STREAMER_H): Add STREAMER_HOOKS_H. (gimple-streamer-in.o): Add dependency on TREE_STREAMER_H. * tree-streamer.h (stream_read_tree): New. Replace all calls to lto_input_tree with it. (stream_write_tree): New. Replace all calls to lto_output_tree, lto_output_tree_ref and lto_output_tree_or_ref with it. * lto-streamer-in.c (lto_read_tree): Inline code from lto_streamer_read_tree. (lto_input_tree): Move from tree-streamer-in.c. * lto-streamer-out.c (lto_output_tree_ref): Make static. Remove handling of NULL values for EXPR. Do not handle EXPRs that are not indexable. (lto_write_tree): Move from tree-streamer-out.c. Inline lto_streamer_write_tree. (lto_output_tree): Move from tree-streamer-out.c. If REF_P is true and EXPR is indexable, call lto_output_tree_ref. * lto-streamer.c (lto_record_common_node): Move to tree-streamer.c. (lto_preload_common_nodes): Likewise. Remove assertions and adjustments for nodes main_identifier_node, ptrdiff_type_node and fileptr_type_node. (lto_streamer_hooks_init): Set streamer_hooks.write_tree to lto_output_tree and streamer_hooks.read_tree to lto_input_tree. * lto-streamer.h (lto_input_tree): Declare. (lto_output_tree_ref): Remove. * streamer-hooks.h (struct streamer_hooks): Remove fields preload_common_nodes, indexable_with_decls_p, pack_value_fields, unpack_value_fields, output_tree_header and has_unique_integer_csts_p. Update all users. * tree-streamer-in.c (lto_materialize_tree): Make extern. (lto_input_tree_pointers): Likewise. (lto_read_tree): Move to lto-streamer-in.c. (lto_input_integer_cst): Make extern. (lto_get_pickled_tree): Likewise. (lto_get_builtin_tree): Likewise. (lto_input_tree): Move to lto-streamer-in.c. * tree-streamer-out.c (pack_value_fields): Make extern. (lto_output_tree_or_ref): Remove. Replace all callers with calls to stream_write_tree. (lto_output_builtin_tree): Make extern. (lto_streamer_write_tree): Inline into lto_write_tree. (lto_output_tree_pointers): Make extern. (lto_output_tree_header): Likewise. (lto_output_integer_cst): Likewise. (lto_write_tree): Move to lto-streamer-out.c. (lto_output_tree): Likewise. * tree-streamer.c (lto_record_common_node): Move from lto-streamer.c (preload_common_nodes): Likewise. (lto_streamer_cache_create): Call it. * tree-streamer.h: Include streamer-hooks.h. (stream_write_tree): New. (stream_read_tree): New. (lto_input_tree): Remove. (lto_materialize_tree): Declare. (lto_input_tree_pointers): Declare. (lto_get_pickled_tree): Declare. (lto_get_builtin_tree): Declare. (lto_input_integer_cst): Declare. (lto_output_tree_header): Declare. (pack_value_fields): Declare. (lto_output_tree_pointers): Declare. (lto_output_integer_cst): Declare. (lto_output_builtin_tree): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177661 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/streamer-hooks.h')
-rw-r--r--gcc/streamer-hooks.h84
1 files changed, 18 insertions, 66 deletions
diff --git a/gcc/streamer-hooks.h b/gcc/streamer-hooks.h
index 29a6591ccc0..6c45102376a 100644
--- a/gcc/streamer-hooks.h
+++ b/gcc/streamer-hooks.h
@@ -39,76 +39,28 @@ struct lto_streamer_cache_d;
Hooks marked [REQ] are required to be set. Those marked [OPT] may
be NULL, if the streamer does not need to implement them. */
struct streamer_hooks {
- /* [REQ] A string identifying this streamer. */
- const char *name;
-
- /* [REQ] Called by lto_streamer_cache_create to instantiate a cache of
- well-known nodes. These are tree nodes that are always
- instantiated by the compiler on startup. Additionally, these
- nodes need to be shared. This function should call
- lto_streamer_cache_append on every tree node that it wishes to
- preload in the streamer cache. This way, the writer will only
- write out a reference to the tree and the reader will instantiate
- the tree out of this pre-populated cache. */
- void (*preload_common_nodes) (struct lto_streamer_cache_d *);
-
- /* [REQ] Return true if the given tree is supported by this streamer. */
- bool (*is_streamable) (tree);
-
- /* [OPT] Called by lto_write_tree after writing all the common parts of
- a tree. If defined, the callback is in charge of writing all
- the fields that lto_write_tree did not write out. Arguments
- are as in lto_write_tree.
-
- The following tree fields are not handled by common code:
-
- DECL_ABSTRACT_ORIGIN
- DECL_INITIAL
- DECL_SAVED_TREE
-
- Callbacks may choose to ignore or handle them. If handled,
- the reader should read them in the exact same sequence written
- by the writer. */
+ /* [REQ] Called by every tree streaming routine that needs to write
+ a tree node. The arguments are: output_block where to write the
+ node, the tree node to write and a boolean flag that should be true
+ if the caller wants to write a reference to the tree, instead of the
+ tree itself. The referencing mechanism is up to each streamer to
+ implement. */
void (*write_tree) (struct output_block *, tree, bool);
- /* [OPT] Called by lto_read_tree after reading all the common parts of
- a tree. If defined, the callback is in charge of reading all
- the fields that lto_read_tree did not read in. Arguments
- are as in lto_read_tree. */
- void (*read_tree) (struct lto_input_block *, struct data_in *, tree);
-
- /* [OPT] Called by lto_output_tree_ref to determine if the given tree node
- should be emitted as a reference to the table of declarations
- (the same table that holds global declarations). */
- bool (*indexable_with_decls_p) (tree);
-
- /* [OPT] Called by pack_value_fields to store any non-pointer fields
- in the tree structure. The arguments are as in pack_value_fields. */
- void (*pack_value_fields) (struct bitpack_d *, tree);
-
- /* [OPT] Called by unpack_value_fields to retrieve any non-pointer fields
- in the tree structure. The arguments are as in unpack_value_fields. */
- void (*unpack_value_fields) (struct bitpack_d *, tree);
-
- /* [OPT] Called by lto_materialize_tree for tree nodes that it does not
- know how to allocate memory for. If defined, this hook should
- return a new tree node of the given code. The data_in and
- input_block arguments are passed in case the hook needs to
- read more data from the stream to allocate the node.
- If this hook returns NULL, then lto_materialize_tree will attempt
- to allocate the tree by calling make_node directly. */
- tree (*alloc_tree) (enum tree_code, struct lto_input_block *,
- struct data_in *);
-
- /* [OPT] Called by lto_output_tree_header to write any streamer-specific
- information needed to allocate the tree. This hook may assume
- that the basic header data (tree code, etc) has already been
- written. It should only write any extra data needed to allocate
- the node (e.g., in the case of CALL_EXPR, this hook would write
- the number of arguments to the CALL_EXPR). */
- void (*output_tree_header) (struct output_block *, tree);
+ /* [REQ] Called by every tree streaming routine that needs to read
+ a tree node. It takes two arguments: an lto_input_block pointing
+ to the buffer where to read from and a data_in instance with tables
+ and descriptors needed by the unpickling routines. It returns the
+ tree instantiated from the stream. */
+ tree (*read_tree) (struct lto_input_block *, struct data_in *);
};
+#define stream_write_tree(OB, EXPR, REF_P) \
+ streamer_hooks.write_tree(OB, EXPR, REF_P)
+
+#define stream_read_tree(IB, DATA_IN) \
+ streamer_hooks.read_tree(IB, DATA_IN)
+
/* Streamer hooks. */
extern struct streamer_hooks streamer_hooks;