This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto][patch] Add support for streaming types and decls (other than vardecls) in the local_decls stream


This patch provides for streaming of types and local declarations other than
VAR_DECL and PARM_DECL in the local_decls stream associated with a
function body.  While this may in some cases result in a smaller
per-file stream,
the main motivation is to deal with VLAs, and avoid having references from
the per-file stream into the internals of functions, e.g.,  to
variables on which
the size of a VLA or other variably-modified type depend.

Presently, the logic for determining what should go in the local stream has
problems, and references to local variables have been leaking into the
global decls stream, resulting in failures.  Thus, the effect of the new code
is largely disabled by default, but may be enabled by those wishing to
contribute to the further development of this code.  See the use of the
preprocessor variable STREAM_LOCAL_TYPES in lto-function-out.c.

Committed to the lto-streamer branch as revision 136611.

--Bill

	* lto-tags.h: Add new tags LTO_local_type_ref
	and LTO_global_type_ref.  Split LTO_type_decl
	and LTO_field_decl into LTO_type_decl0, LTO_type_decl1,
	LTO_field_decl0, and LTO_field_decl1.
	* lto-tree-tags.h: Set names and tree code mappings for
	the new tags.
	* lto-function-out.c: Tidy comments and formatting.
	(output_record_start): Add forward declaration.
	(type_function_context): New function.
	(field_decl_is_local, type_decl_is_local): New functions.
	(output_type_ref_1): Write "local" (e.g., variably-modified)
	types to local_decls stream.
	(output_type_ref): Use "type_ref" as debug token to avoid
	confusing clash with use of "type" elsewhere.
	(output_local_decl_ref):  Update comment.
	(output_expr_operand): Cases for FIELD_DECL and TYPE_DECL
	now write "local" declarations to local_decls stream.
	(output_local_var):  Rename to output_local_var_decl.
	(output_local_var_decl): Remove code to set slot in
	local_decls_index, now handled by output_local_decl.
	(output_local_tree): New function.
	(output_local_field_decl, output_local_type_decl,
	output_local_type): New functions.
	(output_local_decl): New function.
	(output_field_decl): Use new tag LTO_field_decl1, to
	distinguish from "local" fields.
	(output_type_decl): Use new tag LTO_type_decl1, to
	distinguish from "local" fields.
	* lto-function-in.c: Tidy comments and formatting.
	(input_local_tree, input_local_var_decl, input_local_field_decl,
	input_local_type_decl, input_local_type):  Add forward declarations.
	(input_type_ref_1): Distinguish references to global or local
	declaration streams.
	(input_type_ref):  Use "type_ref" as debug token to avoid
	confusing clash with use of "type" elsewhere.
	(input_expr_operand):  Cases for FIELD_DECL and TYPE_DECL
	now read "local" declarations from local_decls stream.
	(input_local_tree): New function.
	(input_local_var): Rename to input_local_var_decl.
	(input_local_var_decl): Input record tag is now an argument.
	(input_local_field_decl, input_local_type_decl,
	input_local_type): New functions.
	(input_local_decl): New function.
	(input_local_vars): Call input_local_decl instead of input_local_var.
	(lto_static_init_local): Don't call add_referenced_var on non-vars.
	* lto-section-out.c (lto_hash_decl_slot_node, lto_eq_decl_slot_node):
	Use object pointer, not UID, as hash key.

Attachment: lto-streamer-patch-06-09.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]