From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2569 invoked by alias); 15 Jul 2014 14:19:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 2555 invoked by uid 89); 15 Jul 2014 14:19:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 15 Jul 2014 14:19:46 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 78EA7543069; Tue, 15 Jul 2014 16:19:42 +0200 (CEST) Date: Tue, 15 Jul 2014 14:59:00 -0000 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, rguenther@suse.de, jason@redhat.com Subject: Move DECL_RESULT into function_decl Message-ID: <20140715141942.GD22085@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-07/txt/msg01068.txt.bz2 Hi, this patch continues by moving DECL_RESULT into FUNCTION_DECL. tree_decl_non_common becomes empty, but I decided to get rid of it in an followup patch - it needs more changes and doing it all at once would be bit convoluted. Bootstrappred/regtested x86_64-linux, OK? Honza * tree-core.h (tree_decl_non_common): Remove result. (tree_function_decl): Add it here. * tree.h (DECL_RESULT_FLD): Remove. (DECL_RESULT): Update. (DECL_ORIGINAL_TYPE): Update * print-tree.c (print_node): Update. * tree-browser.c (browse_tree): Likewise. * fold-const.c (fold_checksum_tree): Update. * tree-streamer-in.c (lto_input_ts_decl_non_common_tree_pointers): Remove. (streamer_read_tree_body): Update. * tree-streamer-out.c (write_ts_decl_non_common_tree_pointers): Remove. (streamer_write_tree_body): Remove. * lto.c (mentions_vars_p_decl_non_common): Update for DECL_RESULT being moved to FUNCTION_DECL. (mentions_vars_p_function): Likewise. (lto_fixup_prevailing_decls): Likewise. * objc-act.h (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): Use attributes pointer. PROPERTY_DECL_CHECK): Use size_unit. * c-ada-spec.c (dump_ada_template): Use DECL_RESULT (tree_function_decl): Add it here. * tree.h (DECL_RESULT_FLD): Remove. (DECL_RESULT): Update. (DECL_ORIGINAL_TYPE): Use DECL_INITIAL instead of DECL_RESULT. * print-tree.c (print_node): Update. * tree-browser.c (browse_tree): Likewise. * fold-const.c (fold_checksum_tree): Update. * tree-streamer-in.c (lto_input_ts_decl_non_common_tree_pointers): Remove. (streamer_read_tree_body): Update. * tree-streamer-out.c (write_ts_decl_non_common_tree_pointers): Remove. (streamer_write_tree_body): Remove. * lto.c (mentions_vars_p_decl_non_common): Update for DECL_RESULT being moved to FUNCTION_DECL. (mentions_vars_p_function): Likewise. (lto_fixup_prevailing_decls): Likewise. * objc-act.h (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK): Use attributes pointer. PROPERTY_DECL_CHECK): Use size_unit. * c-ada-spec.c (dump_ada_template): Use DECL_RESULT Index: tree.h =================================================================== --- tree.h (revision 212549) +++ tree.h (working copy) @@ -2464,11 +2464,6 @@ extern void decl_fini_priority_insert (t #define DECL_NONALIASED(NODE) \ (VAR_DECL_CHECK (NODE)->base.nothrow_flag) -/* This field is used to reference anything in decl.result and is meant only - for use by the garbage collector. */ -#define DECL_RESULT_FLD(NODE) \ - (DECL_NON_COMMON_CHECK (NODE)->decl_non_common.result) - /* The DECL_VINDEX is used for FUNCTION_DECLS in two different ways. Before the struct containing the FUNCTION_DECL is laid out, DECL_VINDEX may point to a FUNCTION_DECL in a base class which @@ -2480,7 +2475,7 @@ extern void decl_fini_priority_insert (t (FUNCTION_DECL_CHECK (NODE)->function_decl.vindex) /* In FUNCTION_DECL, holds the decl for the return value. */ -#define DECL_RESULT(NODE) (FUNCTION_DECL_CHECK (NODE)->decl_non_common.result) +#define DECL_RESULT(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.result) /* In a FUNCTION_DECL, nonzero if the function cannot be inlined. */ #define DECL_UNINLINABLE(NODE) \ @@ -2666,7 +2661,7 @@ extern vec **decl_debug_arg /* For a TYPE_DECL, holds the "original" type. (TREE_TYPE has the copy.) */ #define DECL_ORIGINAL_TYPE(NODE) \ - (TYPE_DECL_CHECK (NODE)->decl_non_common.result) + (TYPE_DECL_CHECK (NODE)->type_decl.original) /* In a TYPE_DECL nonzero means the detail info about this type is not dumped into stabs. Instead it will generate cross reference ('x') of names. Index: tree-streamer-in.c =================================================================== --- tree-streamer-in.c (revision 212549) +++ tree-streamer-in.c (working copy) @@ -713,17 +713,6 @@ lto_input_ts_decl_common_tree_pointers ( if (dexpr) SET_DECL_DEBUG_EXPR (expr, dexpr); } -} - - -/* Read all pointer fields in the TS_DECL_NON_COMMON structure of - EXPR from input block IB. DATA_IN contains tables and descriptors for the - file being read. */ - -static void -lto_input_ts_decl_non_common_tree_pointers (struct lto_input_block *ib, - struct data_in *data_in, tree expr) -{ if (TREE_CODE (expr) == TYPE_DECL) DECL_ORIGINAL_TYPE (expr) = stream_read_tree (ib, data_in); } @@ -1032,9 +1021,6 @@ streamer_read_tree_body (struct lto_inpu if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) lto_input_ts_decl_common_tree_pointers (ib, data_in, expr); - if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) - lto_input_ts_decl_non_common_tree_pointers (ib, data_in, expr); - if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) lto_input_ts_decl_with_vis_tree_pointers (ib, data_in, expr); Index: c-family/c-ada-spec.c =================================================================== --- c-family/c-ada-spec.c (revision 212549) +++ c-family/c-ada-spec.c (working copy) @@ -1722,7 +1722,7 @@ dump_ada_template (pretty_printer *buffe /* DECL_VINDEX is DECL_TEMPLATE_INSTANTIATIONS in this context. */ tree inst = DECL_VINDEX (t); /* DECL_RESULT_FLD is DECL_TEMPLATE_RESULT in this context. */ - tree result = DECL_RESULT_FLD (t); + tree result = DECL_RESULT (t); int num_inst = 0; /* Don't look at template declarations declaring something coming from Index: tree-browser.c =================================================================== --- tree-browser.c (revision 212549) +++ tree-browser.c (working copy) @@ -351,14 +351,14 @@ browse_tree (tree begin) break; case TB_RESULT: - if (head && DECL_P (head)) - TB_SET_HEAD (DECL_RESULT_FLD (head)); + if (head && TREE_CODE (head) == FUNCTION_DECL) + TB_SET_HEAD (DECL_RESULT (head)); else TB_WF; break; case TB_ARGUMENTS: - if (head && DECL_P (head)) + if (head && TREE_CODE (head) == FUNCTION_DECL) TB_SET_HEAD (DECL_ARGUMENTS (head)); else TB_WF; Index: print-tree.c =================================================================== --- print-tree.c (revision 212549) +++ print-tree.c (working copy) @@ -512,10 +512,6 @@ print_node (FILE *file, const char *pref print_node_brief (file, "abstract_origin", DECL_ABSTRACT_ORIGIN (node), indent + 4); } - if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) - { - print_node (file, "result", DECL_RESULT_FLD (node), indent + 4); - } lang_hooks.print_decl (file, node, indent); @@ -542,6 +538,7 @@ print_node (FILE *file, const char *pref print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4); indent_to (file, indent + 4); dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node)); + print_node (file, "result", DECL_RESULT (node), indent + 4); } if ((code == VAR_DECL || code == PARM_DECL) Index: lto/lto.c =================================================================== --- lto/lto.c (revision 212549) +++ lto/lto.c (working copy) @@ -775,11 +775,10 @@ mentions_vars_p_decl_non_common (tree t) { if (mentions_vars_p_decl_with_vis (t)) return true; - CHECK_NO_VAR (DECL_RESULT_FLD (t)); return false; } -/* Check presence of pointers to decls in fields of a decl_non_common T. */ +/* Check presence of pointers to decls in fields of a decl_function T. */ static bool mentions_vars_p_function (tree t) @@ -787,6 +786,7 @@ mentions_vars_p_function (tree t) if (mentions_vars_p_decl_non_common (t)) return true; CHECK_NO_VAR (DECL_ARGUMENTS (t)); + CHECK_NO_VAR (DECL_RESULT (t)); CHECK_NO_VAR (DECL_VINDEX (t)); CHECK_VAR (DECL_FUNCTION_PERSONALITY (t)); return false; @@ -934,6 +934,7 @@ mentions_vars_p (tree t) return mentions_vars_p_decl_with_vis (t); case TYPE_DECL: + CHECK_NO_VAR (DECL_ORIGINAL_TYPE (t)); return mentions_vars_p_decl_non_common (t); case FUNCTION_DECL: @@ -2709,13 +2710,10 @@ lto_fixup_prevailing_decls (tree t) { LTO_NO_PREVAIL (t->decl_with_vis.assembler_name); } - if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) - { - LTO_NO_PREVAIL (DECL_RESULT_FLD (t)); - } if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL)) { LTO_NO_PREVAIL (DECL_ARGUMENTS (t)); + LTO_NO_PREVAIL (DECL_RESULT (t)); LTO_SET_PREVAIL (DECL_FUNCTION_PERSONALITY (t)); LTO_NO_PREVAIL (DECL_VINDEX (t)); } Index: tree-streamer-out.c =================================================================== --- tree-streamer-out.c (revision 212549) +++ tree-streamer-out.c (working copy) @@ -625,17 +625,6 @@ write_ts_decl_common_tree_pointers (stru if (TREE_CODE (expr) == VAR_DECL) stream_write_tree (ob, DECL_DEBUG_EXPR (expr), ref_p); -} - - -/* Write all pointer fields in the TS_DECL_NON_COMMON structure of - EXPR to output block OB. If REF_P is true, write a reference to EXPR's - pointer fields. */ - -static void -write_ts_decl_non_common_tree_pointers (struct output_block *ob, tree expr, - bool ref_p) -{ if (TREE_CODE (expr) == TYPE_DECL) stream_write_tree (ob, DECL_ORIGINAL_TYPE (expr), ref_p); } @@ -915,9 +904,6 @@ streamer_write_tree_body (struct output_ if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) write_ts_decl_common_tree_pointers (ob, expr, ref_p); - if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) - write_ts_decl_non_common_tree_pointers (ob, expr, ref_p); - if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) write_ts_decl_with_vis_tree_pointers (ob, expr, ref_p); Index: lto-streamer-out.c =================================================================== --- lto-streamer-out.c (revision 212549) +++ lto-streamer-out.c (working copy) @@ -139,6 +139,9 @@ tree_is_indexable (tree t) definition. */ if (TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL) return variably_modified_type_p (TREE_TYPE (DECL_CONTEXT (t)), NULL_TREE); + /* IMPORTED_DECL is put into BLOCK and thus it never can be shared. */ + else if (TREE_CODE (t) == IMPORTED_DECL) + return false; else if (((TREE_CODE (t) == VAR_DECL && !TREE_STATIC (t)) || TREE_CODE (t) == TYPE_DECL || TREE_CODE (t) == CONST_DECL Index: fold-const.c =================================================================== --- fold-const.c (revision 212549) +++ fold-const.c (working copy) @@ -14857,12 +14857,11 @@ fold_checksum_tree (const_tree expr, str fold_checksum_tree (DECL_ATTRIBUTES (expr), ctx, ht); } - if (CODE_CONTAINS_STRUCT (TREE_CODE (expr), TS_DECL_NON_COMMON)) + if (TREE_CODE (expr) == FUNCTION_DECL) { - if (TREE_CODE (expr) == FUNCTION_DECL) - fold_checksum_tree (DECL_VINDEX (expr), ctx, ht); - fold_checksum_tree (DECL_RESULT_FLD (expr), ctx, ht); - fold_checksum_tree (DECL_ARGUMENT_FLD (expr), ctx, ht); + fold_checksum_tree (DECL_VINDEX (expr), ctx, ht); + fold_checksum_tree (DECL_RESULT (expr), ctx, ht); + fold_checksum_tree (DECL_ARGUMENT (expr), ctx, ht); } break; case tcc_type: Index: objc/objc-act.h =================================================================== --- objc/objc-act.h (revision 212549) +++ objc/objc-act.h (working copy) @@ -50,7 +50,7 @@ void objc_common_init_ts (void); #define METHOD_SEL_ARGS(DECL) \ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_common.size) #define METHOD_ADD_ARGS(DECL) \ - (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_non_common.result) + (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_common.attributes) #define METHOD_ADD_ARGS_ELLIPSIS_P(DECL) \ (INSTANCE_METHOD_OR_CLASS_METHOD_DECL_CHECK (DECL)->decl_common.lang_flag_0) #define METHOD_DEFINITION(DECL) \ @@ -85,7 +85,7 @@ void objc_common_init_ts (void); /* PROPERTY_SETTER_NAME is the identifier of the setter method. */ #define PROPERTY_SETTER_NAME(DECL) \ - (PROPERTY_DECL_CHECK (DECL)->decl_non_common.result) + (PROPERTY_DECL_CHECK (DECL)->decl_common.size_unit) /* PROPERTY_READONLY can be 0 or 1. */ #define PROPERTY_READONLY(DECL) \ Index: tree-core.h =================================================================== --- tree-core.h (revision 212549) +++ tree-core.h (working copy) @@ -1494,8 +1494,6 @@ struct GTY(()) tree_var_decl { struct GTY(()) tree_decl_non_common { struct tree_decl_with_vis common; - /* Almost all FE's use this. */ - tree result; }; /* FUNCTION_DECL inherits from DECL_NON_COMMON because of the use of the @@ -1510,6 +1508,8 @@ struct GTY(()) tree_function_decl { /* Arguments of the function. */ tree arguments; + /* Return value. */ + tree result; /* The personality function. Used for stack unwinding. */ tree personality; @@ -1563,7 +1563,7 @@ struct GTY(()) tree_translation_unit_dec struct GTY(()) tree_type_decl { struct tree_decl_non_common common; - + tree original; }; struct GTY ((chain_next ("%h.next"), chain_prev ("%h.prev"))) tree_statement_list_node