From: Eric Christopher Date: Thu, 19 Aug 2004 21:34:37 +0000 (+0000) Subject: langhooks-def.h (LANG_HOOKS_UNSAVE_EXPR_NOW): Remove. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=19114537c55ae227cf8b295be3e2c924965cdb18;p=gcc.git langhooks-def.h (LANG_HOOKS_UNSAVE_EXPR_NOW): Remove. 2004-08-19 Eric Christopher * langhooks-def.h (LANG_HOOKS_UNSAVE_EXPR_NOW): Remove. * langhooks.h (unsave_expr_now): Ditto. * tree.h (unsave_expr_1): Remove prototype. (lhd_unsave_expr_now): Rename to unsave_expr_now. * tree-inline.c (unsave_expr_1): Move here from tree.c. Make static. (unsave_expr_now): Rename from lhd_unsave_expr_now. * tree-sra.c: Fix up for rename. * tree-ssa-copy.c: Ditto. * tree-eh.c: Ditto. * tree.c (unsave_expr_1): Move to tree-inline.c. 2004-08-19 Eric Christopher * cp-tree.h (cxx_unsave_expr_now): Delete prototype. * tree.c (cxx_unsave_expr_now): Delete. (cp_unsave_r): Ditto. From-SVN: r86277 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f17675d03c5..934128274d7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,12 +1,26 @@ +2004-08-19 Eric Christopher + + * langhooks-def.h (LANG_HOOKS_UNSAVE_EXPR_NOW): Remove. + * langhooks.h (unsave_expr_now): Ditto. + * tree.h (unsave_expr_1): Remove prototype. + (lhd_unsave_expr_now): Rename to unsave_expr_now. + * tree-inline.c (unsave_expr_1): Move here + from tree.c. Make static. + (unsave_expr_now): Rename from lhd_unsave_expr_now. + * tree-sra.c: Fix up for rename. + * tree-ssa-copy.c: Ditto. + * tree-eh.c: Ditto. + * tree.c (unsave_expr_1): Move to tree-inline.c. + 2004-08-19 Caroline Tice * config/i386/cygming.h (switch_to_section): Fix typo (change in_unlikely_text_section to in_unlikely_executed_text). - + 2004-08-19 Daniel Berlin * vec.h (VEC_lower_bound): New macro. - + 2004-08-19 Richard Sandiford PR target/16446 @@ -55,7 +69,7 @@ * params.def (PARAM_INTEGER_SHARE_LIMIT): New. * params.h (INTEGER_SHARE_LIMIT): New. * Makefile.in (tree.o, stor-layout.o): Depend on PARAMS_H. - + 2004-08-19 Paolo Bonzini * gimplify.c (gimplify_minimax_expr): Remove. @@ -63,7 +77,7 @@ 2004-08-19 Dorit Naishlos - * tree-vectorizer.c (vect_can_force_dr_alignment_p): Replace + * tree-vectorizer.c (vect_can_force_dr_alignment_p): Replace STACK_BOUDARY with PREFERRED_STACK_BOUNDARY. 2004-08-19 Mark Mitchell @@ -153,7 +167,7 @@ (divsf3+1, divsf3+2): Change type to frdiv. * config/mips/sb1.md (ir_sb1_recipsf_2pipes, ir_sb1_recipsf_1pipe, ir_sb1_recipdf_2pipes, ir_sb1_recipdf_1pipe): New. - + * config/mips/3000.md (r3k_fdiv_single, r3k_fdiv_double): Add frdiv. * config/mips/4300.md (r4300_fdiv_single, r4300_fdiv_double): Likewise. * config/mips/4600.md (r4600_fdiv_single, f4600_fdiv_double): Likewise. @@ -2604,7 +2618,7 @@ * config/i386/xmmintrin.h: Include . 2004-08-03 H.J. Lu - Tanguy Fautrà + Tanguy Fautr� * config/i386/pmm_malloc.h: New file. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5f63d12b0eb..79fcaeb42db 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-08-19 Eric Christopher + + * cp-tree.h (cxx_unsave_expr_now): Delete prototype. + * tree.c (cxx_unsave_expr_now): Delete. + (cp_unsave_r): Ditto. + 2004-08-19 Mark Mitchell PR c++/15890 @@ -16,7 +22,7 @@ * decl.c (finish_enum): Do not copy value node early, copy later. * lex.c (cxx_init): Force null_node to be unique. - + 2004-08-19 Joseph S. Myers PR c++/17041 @@ -191,7 +197,7 @@ PR c++/16929 * pt.c (tsubst_default_argument): Clear out current_class_ptr and current_class_ref while tsubsting. - + 2004-08-10 Mark Mitchell PR c++/16971 @@ -415,7 +421,7 @@ static_dtors to ... (expand_or_defer_fn): ... here. * tree.c (no_linkage_check): Add relaxed_p parameter. - + 2004-07-28 Eric Christopher * cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index b0f2697d781..382075d87d4 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -126,7 +126,7 @@ struct diagnostic_context; of the base class. The BV_VCALL_INDEX of each node, if non-NULL, gives the vtable - index of the vcall offset for this entry. + index of the vcall offset for this entry. The BV_FN is the declaration for the virtual function itself. @@ -290,8 +290,8 @@ struct tree_overload GTY(()) a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR. */ #define BASELINK_FUNCTIONS(NODE) \ (((struct tree_baselink*) BASELINK_CHECK (NODE))->functions) -/* The BINFO in which the search for the functions indicated by this baselink - began. This base is used to determine the accessibility of functions +/* The BINFO in which the search for the functions indicated by this baselink + began. This base is used to determine the accessibility of functions selected by overload resolution. */ #define BASELINK_ACCESS_BINFO(NODE) \ (((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo) @@ -987,7 +987,7 @@ struct lang_type_header GTY(()) struct lang_type_class GTY(()) { struct lang_type_header h; - + unsigned char align; unsigned has_mutable : 1; @@ -1061,7 +1061,7 @@ struct lang_type_ptrmem GTY(()) struct lang_type GTY(()) { - union lang_type_u + union lang_type_u { struct lang_type_header GTY((skip (""))) h; struct lang_type_class GTY((tag ("1"))) c; @@ -1306,7 +1306,7 @@ struct lang_type GTY(()) #define CLASSTYPE_ALIGN_UNIT(NODE) \ (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT) -/* True if this a Java interface type, declared with +/* True if this a Java interface type, declared with '__attribute__ ((java_interface))'. */ #define TYPE_JAVA_INTERFACE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->java_interface) @@ -1586,13 +1586,13 @@ struct lang_decl GTY(()) union lang_decl_u4 { - struct full_lang_decl + struct full_lang_decl { /* For a non-thunk function decl, this is a tree list of friendly classes. For a thunk function decl, it is the thunked to function decl. */ tree befriending_classes; - + /* For a non-virtual FUNCTION_DECL, this is DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both @@ -1603,7 +1603,7 @@ struct lang_decl GTY(()) /* In a FUNCTION_DECL, this is DECL_CLONED_FUNCTION. */ tree cloned_function; - + /* In a FUNCTION_DECL for which THUNK_P holds, this is THUNK_FIXED_OFFSET. */ HOST_WIDE_INT fixed_offset; @@ -1614,13 +1614,13 @@ struct lang_decl GTY(()) unsigned u3sel : 1; unsigned pending_inline_p : 1; - + union lang_decl_u3 { - struct sorted_fields_type * GTY ((tag ("0"), reorder ("resort_sorted_fields"))) + struct sorted_fields_type * GTY ((tag ("0"), reorder ("resort_sorted_fields"))) sorted_fields; struct cp_token_cache * GTY ((tag ("2"))) pending_inline_info; - struct language_function * GTY ((tag ("1"))) + struct language_function * GTY ((tag ("1"))) saved_language_function; } GTY ((desc ("%1.u3sel + %1.pending_inline_p"))) u; } GTY ((tag ("1"))) f; @@ -1646,7 +1646,7 @@ struct lang_decl GTY(()) declaration. Some entities (like a member function in a local class, or a local variable) do not have linkage at all, and this macro should not be used in those cases. - + Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was created by language-independent code, and has C linkage. Most VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but @@ -1730,7 +1730,7 @@ struct lang_decl GTY(()) /* Perform an action for each clone of FN, if FN is a function with clones. This macro should be used like: - + FOR_EACH_CLONE (clone, fn) { ... } @@ -1824,14 +1824,14 @@ struct lang_decl GTY(()) (TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE))) /* Nonzero for a VAR_DECL that can be used in an integral constant - expression. + expression. [expr.const] An integral constant-expression can only involve ... const variables of static or enumeration types initialized with constant expressions ... - + The standard does not require that the expression be non-volatile. G++ implements the proposed correction in DR 457. */ #define DECL_INTEGRAL_CONSTANT_VAR_P(NODE) \ @@ -2819,7 +2819,7 @@ struct lang_decl GTY(()) function, (or be implemented via passing some invisible parameter to the thunked function, which is modified to perform the adjustment just before returning). - + A thunk may perform either, or both, of the following operations: o Adjust the this or result pointer by a constant offset. @@ -2902,7 +2902,7 @@ struct lang_decl GTY(()) #define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2) /* An enumeration of the kind of tags that C++ accepts. */ -enum tag_types { +enum tag_types { none_type = 0, /* Not a tag type. */ record_type, /* "struct" types. */ class_type, /* "class" types. */ @@ -2967,8 +2967,8 @@ typedef enum special_function_kind { sfk_conversion /* A conversion operator. */ } special_function_kind; -/* The various kinds of linkage. From [basic.link], - +/* The various kinds of linkage. From [basic.link], + A name is said to have linkage when it might denote the same object, reference, function, type, template, namespace or value as a name introduced in another scope: @@ -3705,7 +3705,7 @@ extern tree poplevel (int, int, int); extern void insert_block (tree); extern tree pushdecl (tree); extern void cxx_init_decl_processing (void); -enum cp_tree_node_structure_enum cp_tree_node_structure +enum cp_tree_node_structure_enum cp_tree_node_structure (union lang_tree_node *); extern bool cxx_mark_addressable (tree); extern void cxx_push_function_context (struct function *); @@ -4169,7 +4169,7 @@ extern void check_multiple_declarators (void); extern void qualified_name_lookup_error (tree, tree, tree); extern tree finish_id_expression (tree, tree, tree, cp_id_kind *, tree *, - bool, bool, bool *, + bool, bool, bool *, const char **); extern tree finish_typeof (tree); extern void finish_decl_cleanup (tree, tree); @@ -4192,7 +4192,6 @@ extern void lang_check_failed (const char *, int, extern tree stabilize_expr (tree, tree *); extern void stabilize_call (tree, tree *); extern bool stabilize_init (tree, tree *); -extern tree cxx_unsave_expr_now (tree); extern tree cxx_maybe_build_cleanup (tree); extern void init_tree (void); extern int pod_type_p (tree); @@ -4291,7 +4290,7 @@ extern tree build_indirect_ref (tree, const char *); extern tree build_array_ref (tree, tree); extern tree get_member_function_from_ptrfunc (tree *, tree); extern tree convert_arguments (tree, tree, tree, int); -extern tree build_x_binary_op (enum tree_code, tree, tree, +extern tree build_x_binary_op (enum tree_code, tree, tree, bool *); extern tree build_x_unary_op (enum tree_code, tree); extern tree unary_complex_lvalue (enum tree_code, tree); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index a7309dd0b80..cb1f4e33fe8 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -43,7 +43,6 @@ static hashval_t list_hash_pieces (tree, tree, tree); static hashval_t list_hash (const void *); static cp_lvalue_kind lvalue_p_1 (tree, int); static tree mark_local_for_remap_r (tree *, int *, void *); -static tree cp_unsave_r (tree *, int *, void *); static tree build_target_expr (tree, tree); static tree count_trees_r (tree *, int *, void *); static tree verify_stmt_tree_r (tree *, int *, void *); @@ -2171,65 +2170,6 @@ mark_local_for_remap_r (tree* tp, return NULL_TREE; } -/* Called via walk_tree when an expression is unsaved. Using the - splay_tree pointed to by ST (which is really a `splay_tree'), - remaps all local declarations to appropriate replacements. */ - -static tree -cp_unsave_r (tree* tp, - int* walk_subtrees, - void* data) -{ - splay_tree st = (splay_tree) data; - splay_tree_node n; - - /* Only a local declaration (variable or label). */ - if (nonstatic_local_decl_p (*tp)) - { - /* Lookup the declaration. */ - n = splay_tree_lookup (st, (splay_tree_key) *tp); - - /* If it's there, remap it. */ - if (n) - *tp = (tree) n->value; - } - else if (TREE_CODE (*tp) == SAVE_EXPR) - remap_save_expr (tp, st, walk_subtrees); - else - { - copy_tree_r (tp, walk_subtrees, NULL); - - /* Do whatever unsaving is required. */ - unsave_expr_1 (*tp); - } - - /* Keep iterating. */ - return NULL_TREE; -} - -/* Called whenever an expression needs to be unsaved. */ - -tree -cxx_unsave_expr_now (tree tp) -{ - splay_tree st; - - /* Create a splay-tree to map old local variable declarations to new - ones. */ - st = splay_tree_new (splay_tree_compare_pointers, NULL, NULL); - - /* Walk the tree once figuring out what needs to be remapped. */ - walk_tree (&tp, mark_local_for_remap_r, st, NULL); - - /* Walk the tree again, copying, remapping, and unsaving. */ - walk_tree (&tp, cp_unsave_r, st, NULL); - - /* Clean up. */ - splay_tree_delete (st); - - return tp; -} - /* Returns the kind of special function that DECL (a FUNCTION_DECL) is. Note that sfk_none is zero, so this function can be used as a predicate to test whether or not DECL is a special function. */ diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index d5f3a79f5e6..06e3c021fd6 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -107,7 +107,6 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *); #define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t #define LANG_HOOKS_STATICP lhd_staticp #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t -#define LANG_HOOKS_UNSAVE_EXPR_NOW lhd_unsave_expr_now #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lhd_set_decl_assembler_name #define LANG_HOOKS_CAN_USE_BIT_FIELDS_P lhd_can_use_bit_fields_p #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS false @@ -271,7 +270,6 @@ extern tree lhd_make_node (enum tree_code); LANG_HOOKS_MARK_ADDRESSABLE, \ LANG_HOOKS_STATICP, \ LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \ - LANG_HOOKS_UNSAVE_EXPR_NOW, \ LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, \ LANG_HOOKS_CAN_USE_BIT_FIELDS_P, \ LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS, \ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 6623ff6ffe7..586db387866 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -305,11 +305,6 @@ struct lang_hooks DECL_NODE with a newly GC-allocated copy. */ void (*dup_lang_specific_decl) (tree); - /* Reset argument so that it can be expanded again. - Modify it in-place so that all the evaluate only once - things are cleared out. */ - tree (*unsave_expr_now) (tree); - /* Set the DECL_ASSEMBLER_NAME for a node. If it is the sort of thing that the assembler should talk about, set DECL_ASSEMBLER_NAME to an appropriate IDENTIFIER_NODE. diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index a231f29b0a2..0ddf849c9cc 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -77,7 +77,7 @@ struct_ptr_hash (const void *a) we get to rtl. Once we're done with lowering here, if we lose the information there's no way to recover it! - (2) There are many more statements that *cannot* throw as + (2) There are many more statements that *cannot* throw as compared to those that can. We should be saving some amount of space by only allocating memory for those that can throw. */ @@ -265,7 +265,7 @@ outside_finally_tree (tree start, tree target) struct leh_state { - /* What's "current" while constructing the eh region tree. These + /* What's "current" while constructing the eh region tree. These correspond to variables of the same name in cfun->eh, which we don't have easy access to. */ struct eh_region *cur_region; @@ -280,7 +280,7 @@ struct leh_state struct leh_tf_state { /* Pointer to the TRY_FINALLY node under discussion. The try_finally_expr - is the original TRY_FINALLY_EXPR. We need to retain this so that + is the original TRY_FINALLY_EXPR. We need to retain this so that outside_finally_tree can reliably reference the tree used in the collect_finally_tree data structures. */ tree try_finally_expr; @@ -311,7 +311,7 @@ struct leh_tf_state though subsequent transformations may have cleared that flag. */ tree fallthru_label; - /* A label that has been registered with except.c to be the + /* A label that has been registered with except.c to be the landing pad for this try block. */ tree eh_label; @@ -330,7 +330,7 @@ struct leh_tf_state static void lower_eh_filter (struct leh_state *, tree *); static void lower_eh_constructs_1 (struct leh_state *, tree *); -/* Comparison function for qsort/bsearch. We're interested in +/* Comparison function for qsort/bsearch. We're interested in searching goto queue elements for source statements. */ static int @@ -383,7 +383,7 @@ replace_goto_queue_cond_clause (tree *tp, struct leh_tf_state *tf, tsi_link_after (tsi, new, TSI_CONTINUE_LINKING); } -/* The real work of replace_goto_queue. Returns with TSI updated to +/* The real work of replace_goto_queue. Returns with TSI updated to point to the next statement. */ static void replace_goto_queue_stmt_list (tree, struct leh_tf_state *); @@ -471,7 +471,7 @@ maybe_record_in_goto_queue (struct leh_state *state, tree stmt) { tree lab = GOTO_DESTINATION (stmt); - /* Computed and non-local gotos do not get processed. Given + /* Computed and non-local gotos do not get processed. Given their nature we can neither tell whether we've escaped the finally block nor redirect them if we knew. */ if (TREE_CODE (lab) != LABEL_DECL) @@ -480,7 +480,7 @@ maybe_record_in_goto_queue (struct leh_state *state, tree stmt) /* No need to record gotos that don't leave the try block. */ if (! outside_finally_tree (lab, tf->try_finally_expr)) return; - + if (! tf->dest_array) { VARRAY_TREE_INIT (tf->dest_array, 10, "dest_array"); @@ -520,7 +520,7 @@ maybe_record_in_goto_queue (struct leh_state *state, tree stmt) q = &tf->goto_queue[active]; tf->goto_queue_active = active + 1; - + memset (q, 0, sizeof (*q)); q->stmt = stmt; q->index = index; @@ -709,7 +709,7 @@ lower_try_finally_dup_block (tree t, struct leh_state *outer_state) { tree region = NULL; - t = lhd_unsave_expr_now (t); + t = unsave_expr_now (t); if (outer_state->tf) region = outer_state->tf->try_finally_expr; @@ -731,7 +731,7 @@ lower_try_finally_fallthru_label (struct leh_tf_state *tf) label = create_artificial_label (); tf->fallthru_label = label; if (tf->outer->tf) - record_in_finally_tree (label, tf->outer->tf->try_finally_expr); + record_in_finally_tree (label, tf->outer->tf->try_finally_expr); } return label; } @@ -752,7 +752,7 @@ lower_try_finally_fallthru_label (struct leh_tf_state *tf) where "fintmp" is the temporary used in the switch statement generation alternative considered below. For the nonce, we always choose the first - option. + option. THIS_STATE may be null if if this is a try-cleanup, not a try-finally. */ @@ -937,7 +937,7 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf) append_to_statement_list (x, tf->top_p); append_to_statement_list (finally, tf->top_p); - + x = build1 (RESX_EXPR, void_type_node, build_int_cst (NULL_TREE, get_eh_region_number (tf->region), 0)); @@ -977,7 +977,7 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf) for (; q < qe; ++q) do_goto_redirection (q, finally_label, NULL); replace_goto_queue (tf); - + if (VARRAY_TREE (tf->dest_array, 0) == tf->fallthru_label) { /* Reachable by goto to fallthru label only. Redirect it @@ -1284,7 +1284,7 @@ decide_copy_try_finally (int ndests, tree finally) /* A subroutine of lower_eh_constructs_1. Lower a TRY_FINALLY_EXPR nodes to a sequence of labels and blocks, plus the exception region trees - that record all the magic. This is complicated by the need to + that record all the magic. This is complicated by the need to arrange for the FINALLY block to be executed on all exits. */ static void @@ -1374,7 +1374,7 @@ lower_try_finally (struct leh_state *state, tree *tp) } /* A subroutine of lower_eh_constructs_1. Lower a TRY_CATCH_EXPR with a - list of CATCH_EXPR nodes to a sequence of labels and blocks, plus the + list of CATCH_EXPR nodes to a sequence of labels and blocks, plus the exception region trees that record all the magic. */ static void @@ -1444,7 +1444,7 @@ lower_eh_filter (struct leh_state *state, tree *tp) struct eh_region *this_region; tree inner = expr_first (TREE_OPERAND (*tp, 1)); tree eh_label; - + if (EH_FILTER_MUST_NOT_THROW (inner)) this_region = gen_eh_region_must_not_throw (state->cur_region); else @@ -1452,7 +1452,7 @@ lower_eh_filter (struct leh_state *state, tree *tp) EH_FILTER_TYPES (inner)); this_state = *state; this_state.cur_region = this_region; - + lower_eh_constructs_1 (&this_state, &TREE_OPERAND (*tp, 0)); if (!get_eh_region_may_contain_throw (this_region)) @@ -1568,7 +1568,7 @@ lower_eh_constructs_1 (struct leh_state *state, tree *tp) record_stmt_eh_region (state->cur_region, t); note_eh_region_may_contain_throw (state->cur_region); - /* ??? For the benefit of calls.c, converting all this to rtl, + /* ??? For the benefit of calls.c, converting all this to rtl, we need to record the call expression, not just the outer modify statement. */ op = get_call_expr_in (t); @@ -1647,7 +1647,7 @@ lower_eh_constructs (void) collect_eh_region_array (); } -struct tree_opt_pass pass_lower_eh = +struct tree_opt_pass pass_lower_eh = { "eh", /* name */ NULL, /* gate */ @@ -1680,7 +1680,7 @@ make_eh_edge (struct eh_region *region, void *data) make_edge (src, dst, EDGE_ABNORMAL | EDGE_EH); } - + void make_eh_edges (tree stmt) { diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index b34844d82f3..6f65f0900a8 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -135,6 +135,7 @@ static void remap_block (tree *, inline_data *); static tree remap_decls (tree, inline_data *); static void copy_bind_expr (tree *, int *, inline_data *); static tree mark_local_for_remap_r (tree *, int *, void *); +static void unsave_expr_1 (tree); static tree unsave_r (tree *, int *, void *); static void declare_inline_vars (tree bind_expr, tree vars); @@ -2370,6 +2371,31 @@ mark_local_for_remap_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, return NULL_TREE; } +/* Perform any modifications to EXPR required when it is unsaved. Does + not recurse into EXPR's subtrees. */ + +static void +unsave_expr_1 (tree expr) +{ + switch (TREE_CODE (expr)) + { + case TARGET_EXPR: + /* Don't mess with a TARGET_EXPR that hasn't been expanded. + It's OK for this to happen if it was part of a subtree that + isn't immediately expanded, such as operand 2 of another + TARGET_EXPR. */ + if (TREE_OPERAND (expr, 1)) + break; + + TREE_OPERAND (expr, 1) = TREE_OPERAND (expr, 3); + TREE_OPERAND (expr, 3) = NULL_TREE; + break; + + default: + break; + } +} + /* Called via walk_tree when an expression is unsaved. Using the splay_tree pointed to by ST (which is really a `splay_tree'), remaps all local declarations to appropriate replacements. */ @@ -2411,11 +2437,11 @@ unsave_r (tree *tp, int *walk_subtrees, void *data) return NULL_TREE; } -/* Default lang hook for "unsave_expr_now". Copies everything in EXPR and - replaces variables, labels and SAVE_EXPRs local to EXPR. */ +/* Copies everything in EXPR and replaces variables, labels + and SAVE_EXPRs local to EXPR. */ tree -lhd_unsave_expr_now (tree expr) +unsave_expr_now (tree expr) { inline_data id; diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index e6b254c6145..e644c35591c 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -5,17 +5,17 @@ Contributed by Diego Novillo This file is part of GCC. - + GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - + GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA @@ -52,7 +52,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* This object of this pass is to replace a non-addressable aggregate with a set of independent variables. Most of the time, all of these variables - will be scalars. But a secondary objective is to break up larger + will be scalars. But a secondary objective is to break up larger aggregates into smaller aggregates. In the process we may find that some bits of the larger aggregate can be deleted as unreferenced. @@ -405,7 +405,7 @@ sra_elt_hash (const void *x) return h; } - + /* Equality function for type SRA_PAIR. */ static int @@ -533,7 +533,7 @@ is_valid_const_index (tree expr) return true; } -/* Create or return the SRA_ELT structure for EXPR if the expression +/* Create or return the SRA_ELT structure for EXPR if the expression refers to a scalarizable variable. */ static struct sra_elt * @@ -682,7 +682,7 @@ sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output, index reference inside a loop being overridden by several constant index references during loop setup. It's possible that this could be avoided by using dynamic usage counts based on BB trip counts - (based on loop analysis or profiling), but that hardly seems worth + (based on loop analysis or profiling), but that hardly seems worth the effort. */ /* ??? Hack. Figure out how to push this into the scan routines without duplicating too much code. */ @@ -716,7 +716,7 @@ sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output, case BIT_FIELD_REF: /* A bit field reference (access to *multiple* fields simultaneously) - is not currently scalarized. Consider this an access to the + is not currently scalarized. Consider this an access to the complete outer element, to which walk_tree will bring us next. */ goto use_all; @@ -828,7 +828,7 @@ sra_walk_modify_expr (tree expr, block_stmt_iterator *bsi, the function multiple times, and other evil things. */ else if (!lhs_elt->is_scalar && is_gimple_addressable (rhs)) fns->ldst (lhs_elt, rhs, bsi, true); - + /* Otherwise we're being used in some context that requires the aggregate to be seen as a whole. Invoke USE. */ else @@ -946,7 +946,7 @@ find_candidates_for_sra (void) any_set = true; } } - + return any_set; } @@ -1294,7 +1294,7 @@ decide_block_copy (struct sra_elt *elt) full_size = tree_low_cst (size_tree, 1); - /* ??? What to do here. If there are two fields, and we've only + /* ??? What to do here. If there are two fields, and we've only instantiated one, then instantiating the other is clearly a win. If there are a large number of fields then the size of the copy is much more of a factor. */ @@ -1377,9 +1377,9 @@ decide_instantiations (void) if (cleared_any) { - bitmap_operation (sra_candidates, sra_candidates, &done_head, + bitmap_operation (sra_candidates, sra_candidates, &done_head, BITMAP_AND_COMPL); - bitmap_operation (needs_copy_in, needs_copy_in, &done_head, + bitmap_operation (needs_copy_in, needs_copy_in, &done_head, BITMAP_AND_COMPL); } bitmap_clear (&done_head); @@ -1697,7 +1697,7 @@ insert_edge_copies (tree stmt, basic_block bb) first_copy = false; } else - bsi_insert_on_edge (e, lhd_unsave_expr_now (stmt)); + bsi_insert_on_edge (e, unsave_expr_now (stmt)); } } } @@ -1816,7 +1816,7 @@ scalarize_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt, else if (lhs_elt->use_block_copy || rhs_elt->use_block_copy) { /* If either side requires a block copy, then sync the RHS back - to the original structure, leave the original assignment + to the original structure, leave the original assignment statement (which will perform the block copy), then load the LHS values out of its now-updated original structure. */ /* ??? Could perform a modified pair-wise element copy. That @@ -1978,7 +1978,7 @@ scalarize_ldst (struct sra_elt *elt, tree other, /* Replace the old statement with this new representative. */ bsi_replace (bsi, first, true); - + if (!tsi_end_p (tsi)) { /* If any reference would trap, then they all would. And more @@ -2010,7 +2010,7 @@ scalarize_parms (void) size_t i; EXECUTE_IF_SET_IN_BITMAP (needs_copy_in, 0, i, - { + { tree var = referenced_var (i); struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT); generate_copy_inout (elt, true, var, &list); @@ -2107,7 +2107,7 @@ gate_sra (void) return flag_tree_sra != 0; } -struct tree_opt_pass pass_sra = +struct tree_opt_pass pass_sra = { "sra", /* name */ gate_sra, /* gate */ diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 4dca3a5e288..1a760ecf2ee 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -70,7 +70,7 @@ may_propagate_copy (tree dest, tree orig) /* FIXME. GIMPLE is allowing pointer assignments and comparisons of pointers that have different alias sets. This means that these pointers will have different memory tags associated to them. - + If we allow copy propagation in these cases, statements de-referencing the new pointer will now have a reference to a different memory tag with potentially incorrect SSA information. @@ -161,7 +161,7 @@ may_propagate_copy (tree dest, tree orig) /* Given two SSA_NAMEs pointers ORIG and NEW such that we are copy propagating NEW into ORIG, consolidate aliasing information so that they both share the same memory tags. */ - + static void merge_alias_info (tree orig, tree new) { @@ -191,12 +191,12 @@ merge_alias_info (tree orig, tree new) orig_ann->type_mem_tag = new_ann->type_mem_tag; else if (new_ann->type_mem_tag != orig_ann->type_mem_tag) abort (); -} +} /* Common code for propagate_value and replace_exp. - Replace use operand OP_P with VAL. FOR_PROPAGATION indicates if the + Replace use operand OP_P with VAL. FOR_PROPAGATION indicates if the replacement is done to propagate a value or not. */ static void @@ -220,7 +220,7 @@ replace_exp_1 (use_operand_p op_p, tree val, SET_USE (op_p, val); } else - SET_USE (op_p, lhd_unsave_expr_now (val)); + SET_USE (op_p, unsave_expr_now (val)); } @@ -240,8 +240,8 @@ propagate_value (use_operand_p op_p, tree val) /* Propagate the value VAL (assumed to be a constant or another SSA_NAME) into the tree pointed by OP_P. - Use this version for const/copy propagation when SSA operands are not - available. It will perform the additional checks to ensure validity of + Use this version for const/copy propagation when SSA operands are not + available. It will perform the additional checks to ensure validity of the const/copy propagation, but will not update any operand information. Be sure to mark the stmt as modified. */ @@ -262,7 +262,7 @@ propagate_tree_value (tree *op_p, tree val) *op_p = val; } else - *op_p = lhd_unsave_expr_now (val); + *op_p = unsave_expr_now (val); } diff --git a/gcc/tree.c b/gcc/tree.c index d0a182b2052..cd298e86013 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -433,7 +433,7 @@ build_int_cst (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) if (!type) type = integer_type_node; - + switch (TREE_CODE (type)) { case POINTER_TYPE: @@ -445,14 +445,14 @@ build_int_cst (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) ix = 0; } break; - + case BOOLEAN_TYPE: /* Cache false or true. */ limit = 2; if (!hi && low < 2) ix = low; break; - + case INTEGER_TYPE: case CHAR_TYPE: case OFFSET_TYPE: @@ -476,7 +476,7 @@ build_int_cst (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) default: break; } - + if (ix >= 0) { if (!TYPE_CACHED_VALUES_P (type)) @@ -484,7 +484,7 @@ build_int_cst (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) TYPE_CACHED_VALUES_P (type) = 1; TYPE_CACHED_VALUES (type) = make_tree_vec (limit); } - + t = TREE_VEC_ELT (TYPE_CACHED_VALUES (type), ix); if (t) { @@ -496,7 +496,7 @@ build_int_cst (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) return t; } } - + t = make_node (INTEGER_CST); TREE_INT_CST_LOW (t) = low; @@ -505,7 +505,7 @@ build_int_cst (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) if (ix >= 0) TREE_VEC_ELT (TYPE_CACHED_VALUES (type), ix) = t; - + return t; } @@ -1564,31 +1564,6 @@ tree_node_structure (tree t) abort (); } } - -/* Perform any modifications to EXPR required when it is unsaved. Does - not recurse into EXPR's subtrees. */ - -void -unsave_expr_1 (tree expr) -{ - switch (TREE_CODE (expr)) - { - case TARGET_EXPR: - /* Don't mess with a TARGET_EXPR that hasn't been expanded. - It's OK for this to happen if it was part of a subtree that - isn't immediately expanded, such as operand 2 of another - TARGET_EXPR. */ - if (TREE_OPERAND (expr, 1)) - break; - - TREE_OPERAND (expr, 1) = TREE_OPERAND (expr, 3); - TREE_OPERAND (expr, 3) = NULL_TREE; - break; - - default: - break; - } -} /* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size or offset that depends on a field within a record. */ diff --git a/gcc/tree.h b/gcc/tree.h index f498db1aaf8..6c01ab190f6 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3203,11 +3203,6 @@ extern int first_rtl_op (enum tree_code); enum tree_node_structure_enum tree_node_structure (tree); -/* Reset EXP in place so that it can be expanded again. Does not - recurse into subtrees. */ - -extern void unsave_expr_1 (tree); - /* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size or offset that depends on a field within a record. @@ -3362,7 +3357,6 @@ extern tree get_set_constructor_bytes (tree, unsigned char *, int); extern tree get_callee_fndecl (tree); extern void change_decl_assembler_name (tree, tree); extern int type_num_arguments (tree); -extern tree lhd_unsave_expr_now (tree); extern bool associative_tree_code (enum tree_code); extern bool commutative_tree_code (enum tree_code); @@ -3551,6 +3545,9 @@ extern void indent_to (FILE *, int); /* In tree-inline.c: */ extern bool debug_find_tree (tree, tree); +/* This is in tree-inline.c since the routine uses + data structures from the inliner. */ +extern tree unsave_expr_now (tree); /* In expr.c */ extern rtx expand_builtin_return_addr (enum built_in_function, int, rtx);