From b27ac6b5cb2b32599e8da6730f5726f835da10a1 Mon Sep 17 00:00:00 2001 From: echristo Date: Wed, 28 Jul 2004 23:44:56 +0000 Subject: [PATCH] 2004-07-28 Eric Christopher * c-common.c (c_common_unsafe_for_reeval): Delete. * c-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete use. * c-pretty-print.c (pp_c_expression): Delete UNSAVE_EXPR case. * calls.c (fix_unsafe_tree): Delete. (expand_call): Delete code which used above. * dojump.c (do_jump): Delete UNSAVE_EXPR case. * expr.c (expand_expr_real_1): Ditto. * fold-const.c (non_lvalue): Ditto. * langhooks-def.h (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete. (lhd_unsafe_for_reeval): Ditto. * langhooks.c (lhd_unsafe_for_reeval): Ditto. * langhooks.h (unsafe_for_reeval): Ditto. (unsave_expr_now): Adjust comment. * tree-inline.c (copy_body_r): Delete UNSAVE_EXPR bits. (estimate_num_insns_1): Ditto. * tree-pretty-print.c (dump_generic_node): Ditto. * tree.c (expr_align): Ditto. (unsave_expr): Delete. (unsafe_for_reeval): Ditto. * tree.h (unsafe_for_reeval, unsave_expr): Ditto. * tree.def (UNSAVE_EXPR): Delete. * objc/objc-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete. 2004-07-28 Eric Christopher * cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete. 2004-07-28 Eric Christopher * lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete. (java_unsafe_for_reeval): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85276 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 25 ++++++ gcc/c-common.c | 63 +++++--------- gcc/c-lang.c | 2 - gcc/c-pretty-print.c | 35 ++++---- gcc/calls.c | 72 --------------- gcc/cp/ChangeLog | 4 + gcc/cp/cp-lang.c | 6 +- gcc/cp/tree.c | 227 ++++++++++++++++++++++++------------------------ gcc/dojump.c | 6 -- gcc/expr.c | 9 -- gcc/fold-const.c | 1 - gcc/java/ChangeLog | 35 ++++---- gcc/java/lang.c | 58 ++++--------- gcc/langhooks-def.h | 3 - gcc/langhooks.c | 14 +-- gcc/langhooks.h | 9 +- gcc/objc/objc-lang.c | 2 - gcc/tree-inline.c | 22 ++--- gcc/tree-pretty-print.c | 14 +-- gcc/tree.c | 188 ++++++++------------------------------- gcc/tree.def | 26 ++---- gcc/tree.h | 11 --- 22 files changed, 285 insertions(+), 547 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 818f54360b2..4bd3a7d1acc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,28 @@ +2004-07-28 Eric Christopher + + * c-common.c (c_common_unsafe_for_reeval): Delete. + * c-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete use. + * c-pretty-print.c (pp_c_expression): Delete UNSAVE_EXPR case. + * calls.c (fix_unsafe_tree): Delete. + (expand_call): Delete code which used above. + * dojump.c (do_jump): Delete UNSAVE_EXPR case. + * expr.c (expand_expr_real_1): Ditto. + * fold-const.c (non_lvalue): Ditto. + * langhooks-def.h (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete. + (lhd_unsafe_for_reeval): Ditto. + * langhooks.c (lhd_unsafe_for_reeval): Ditto. + * langhooks.h (unsafe_for_reeval): Ditto. + (unsave_expr_now): Adjust comment. + * tree-inline.c (copy_body_r): Delete UNSAVE_EXPR bits. + (estimate_num_insns_1): Ditto. + * tree-pretty-print.c (dump_generic_node): Ditto. + * tree.c (expr_align): Ditto. + (unsave_expr): Delete. + (unsafe_for_reeval): Ditto. + * tree.h (unsafe_for_reeval, unsave_expr): Ditto. + * tree.def (UNSAVE_EXPR): Delete. + * objc/objc-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete. + 2004-07-28 Zack Weinberg * tree.h (enum tls_model): Move ... diff --git a/gcc/c-common.c b/gcc/c-common.c index ef8f72fca45..31b8dd91daf 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -304,7 +304,7 @@ int flag_zero_link = 0; unit. It will inform the ObjC runtime that class definition(s) herein contained are to replace one(s) previously loaded. */ int flag_replace_objc_classes = 0; - + /* C/ObjC language option variables. */ @@ -1474,7 +1474,7 @@ check_case_bounds (tree type, tree orig_type, warning ("case label value is less than minimum value for type"); return false; } - + /* Case value is greater than maximum for type. */ if (tree_int_cst_compare (case_low, max_value) > 0 && tree_int_cst_compare (case_high, max_value) > 0) @@ -1491,7 +1491,7 @@ check_case_bounds (tree type, tree orig_type, " less than minimum value for type"); case_low = min_value; } - + /* Saturate upper case label value to maximum. */ if (tree_int_cst_compare (case_low, max_value) <= 0 && tree_int_cst_compare (case_high, max_value) > 0) @@ -1610,7 +1610,7 @@ c_common_type_for_mode (enum machine_mode mode, int unsignedp) if (mode == TYPE_MODE (void_type_node)) return void_type_node; - + if (mode == TYPE_MODE (build_pointer_type (char_type_node))) return unsignedp ? make_unsigned_type (mode) : make_signed_type (mode); @@ -2475,7 +2475,7 @@ c_build_qualified_type (tree type, int type_quals) { if (type == error_mark_node) return type; - + if (TREE_CODE (type) == ARRAY_TYPE) return build_array_type (c_build_qualified_type (TREE_TYPE (type), type_quals), @@ -2501,7 +2501,7 @@ void c_apply_type_quals_to_decl (int type_quals, tree decl) { tree type = TREE_TYPE (decl); - + if (type == error_mark_node) return; @@ -2681,11 +2681,11 @@ c_common_get_alias_set (tree t) { tree t2; /* Find bottom type under any nested POINTERs. */ - for (t2 = TREE_TYPE (t); + for (t2 = TREE_TYPE (t); TREE_CODE (t2) == POINTER_TYPE; t2 = TREE_TYPE (t2)) ; - if (TREE_CODE (t2) != RECORD_TYPE + if (TREE_CODE (t2) != RECORD_TYPE && TREE_CODE (t2) != ENUMERAL_TYPE && TREE_CODE (t2) != QUAL_UNION_TYPE && TREE_CODE (t2) != UNION_TYPE) @@ -2694,7 +2694,7 @@ c_common_get_alias_set (tree t) return -1; } /* These are the only cases that need special handling. */ - if (TREE_CODE (t) != RECORD_TYPE + if (TREE_CODE (t) != RECORD_TYPE && TREE_CODE (t) != ENUMERAL_TYPE && TREE_CODE (t) != QUAL_UNION_TYPE && TREE_CODE (t) != UNION_TYPE @@ -2704,7 +2704,7 @@ c_common_get_alias_set (tree t) if (TYPE_SIZE (t) == 0) return -1; - /* Look up t in hash table. Only one of the compatible types within each + /* Look up t in hash table. Only one of the compatible types within each alias set is recorded in the table. */ if (!type_hash_table) type_hash_table = htab_create (1021, c_type_hash, @@ -2756,7 +2756,7 @@ c_sizeof_or_alignof_type (tree type, enum tree_code op, int complain) else if (!COMPLETE_TYPE_P (type)) { if (complain) - error ("invalid application of `%s' to incomplete type `%T' ", + error ("invalid application of `%s' to incomplete type `%T' ", op_name, type); value = size_zero_node; } @@ -3701,7 +3701,7 @@ match_case_to_enum (splay_tree_node node, void *data) void c_do_switch_warnings (splay_tree cases, tree switch_stmt) { - splay_tree_node default_node; + splay_tree_node default_node; location_t switch_location; tree type; @@ -3730,7 +3730,7 @@ c_do_switch_warnings (splay_tree cases, tree switch_stmt) tree chain; /* The time complexity here is O(N*lg(N)) worst case, but for the - common case of monotonically increasing enumerators, it is + common case of monotonically increasing enumerators, it is O(N), since the nature of the splay tree will keep the next element adjacent to the root at all times. */ @@ -3742,7 +3742,7 @@ c_do_switch_warnings (splay_tree cases, tree switch_stmt) if (node) { /* Mark the CASE_LOW part of the case entry as seen, so - that we save time later. Choose TREE_ADDRESSABLE + that we save time later. Choose TREE_ADDRESSABLE randomly as a bit that won't have been set to-date. */ tree label = (tree) node->value; TREE_ADDRESSABLE (label) = 1; @@ -3762,7 +3762,7 @@ c_do_switch_warnings (splay_tree cases, tree switch_stmt) The time complexity here is O(N**2) worst case, since we've not sorted the enumeration values. However, in the absence - of case ranges this is O(N), since all single cases that + of case ranges this is O(N), since all single cases that corresponded to enumerations have been marked above. */ splay_tree_foreach (cases, match_case_to_enum, type); @@ -3799,12 +3799,12 @@ finish_label_address_expr (tree label) } /* Hook used by expand_expr to expand language-specific tree codes. */ -/* The only things that should go here are bits needed to expand +/* The only things that should go here are bits needed to expand constant initializers. Everything else should be handled by the gimplification routines. */ rtx -c_expand_expr (tree exp, rtx target, enum machine_mode tmode, +c_expand_expr (tree exp, rtx target, enum machine_mode tmode, int modifier /* Actually enum_modifier. */, rtx *alt_rtl) { @@ -3824,21 +3824,6 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode, } } -/* Hook used by unsafe_for_reeval to handle language-specific tree codes. */ - -int -c_common_unsafe_for_reeval (tree exp) -{ - /* Statement expressions may not be reevaluated, likewise compound - literals. */ - if (TREE_CODE (exp) == STMT_EXPR - || TREE_CODE (exp) == COMPOUND_LITERAL_EXPR) - return 2; - - /* Walk all other expressions. */ - return -1; -} - /* Hook used by staticp to handle language-specific tree codes. */ bool @@ -3939,17 +3924,17 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args), { /* If it is the main variant, then pack the other variants too. This happens in, - + struct Foo { struct Foo const *ptr; // creates a variant w/o packed flag } __ attribute__((packed)); // packs it now. */ tree probe; - + for (probe = *node; probe; probe = TYPE_NEXT_VARIANT (probe)) TYPE_PACKED (probe) = 1; } - + } else if (TREE_CODE (*node) == FIELD_DECL) DECL_PACKED (*node) = 1; @@ -4583,7 +4568,7 @@ handle_visibility_attribute (tree *node, tree name, tree args, error ("visibility arg not a string"); return NULL_TREE; } - + /* If this is a type, set the visibility on the type decl. */ if (TYPE_P (decl)) { @@ -4597,7 +4582,7 @@ handle_visibility_attribute (tree *node, tree name, tree args, else if (strcmp (TREE_STRING_POINTER (id), "internal") == 0) DECL_VISIBILITY (decl) = VISIBILITY_INTERNAL; else if (strcmp (TREE_STRING_POINTER (id), "hidden") == 0) - DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN; + DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN; else if (strcmp (TREE_STRING_POINTER (id), "protected") == 0) DECL_VISIBILITY (decl) = VISIBILITY_PROTECTED; else @@ -5320,8 +5305,8 @@ c_parse_error (const char *msgid, enum cpp_ttype token, tree value) /* Walk a gimplified function and warn for functions whose return value is ignored and attribute((warn_unused_result)) is set. This is done before - inlining, so we don't have to worry about that. */ - + inlining, so we don't have to worry about that. */ + void c_warn_unused_result (tree *top_p) { diff --git a/gcc/c-lang.c b/gcc/c-lang.c index cf516b2b5c9..72d21010c29 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -70,8 +70,6 @@ enum c_language_kind c_language = clk_c; #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL #define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl -#undef LANG_HOOKS_UNSAFE_FOR_REEVAL -#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval #undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true #undef LANG_HOOKS_STATICP diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 10084765a21..3ddef7a2385 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -225,7 +225,7 @@ void pp_c_type_qualifier_list (c_pretty_printer *pp, tree t) { int qualifiers; - + if (!TYPE_P (t)) t = TREE_TYPE (t); @@ -481,7 +481,7 @@ pp_c_direct_abstract_declarator (c_pretty_printer *pp, tree t) case POINTER_TYPE: pp_abstract_declarator (pp, t); break; - + case FUNCTION_TYPE: pp_c_parameter_type_list (pp, t); pp_direct_abstract_declarator (pp, TREE_TYPE (t)); @@ -507,7 +507,7 @@ pp_c_direct_abstract_declarator (c_pretty_printer *pp, tree t) case COMPLEX_TYPE: case TYPE_DECL: break; - + default: pp_unsupported_tree (pp, t); break; @@ -654,7 +654,7 @@ pp_c_declarator (c_pretty_printer *pp, tree t) pp_direct_declarator (pp, t); break; - + default: pp_unsupported_tree (pp, t); break; @@ -810,7 +810,7 @@ pp_c_character_constant (c_pretty_printer *pp, tree c) { tree type = TREE_TYPE (c); if (type == wchar_type_node) - pp_character (pp, 'L'); + pp_character (pp, 'L'); pp_quote (pp); if (host_integerp (c, TYPE_UNSIGNED (type))) pp_c_char (pp, tree_low_cst (c, TYPE_UNSIGNED (type))); @@ -893,12 +893,12 @@ pp_c_floating_constant (c_pretty_printer *pp, tree r) } /* Pretty-print a compound literal expression. GNU extensions include - vector constants. */ + vector constants. */ static void pp_c_compound_literal (c_pretty_printer *pp, tree e) { - tree type = TREE_TYPE (e); + tree type = TREE_TYPE (e); pp_c_type_cast (pp, type); switch (TREE_CODE (type)) @@ -939,8 +939,8 @@ pp_c_constant (c_pretty_printer *pp, tree e) pp_c_character_constant (pp, e); else if (TREE_CODE (type) == ENUMERAL_TYPE && pp_c_enumeration_constant (pp, e)) - ; - else + ; + else pp_c_integer_constant (pp, e); } break; @@ -964,8 +964,8 @@ pp_c_constant (c_pretty_printer *pp, tree e) void pp_c_identifier (c_pretty_printer *pp, const char *id) { - pp_c_maybe_whitespace (pp); - pp_identifier (pp, id); + pp_c_maybe_whitespace (pp); + pp_identifier (pp, id); pp_base (pp)->padding = pp_before; } @@ -1401,7 +1401,7 @@ pp_c_call_argument_list (c_pretty_printer *pp, tree t) unary-operator: one of * & + - ! ~ - + GNU extensions. unary-expression: __alignof__ unary-expression @@ -1538,7 +1538,7 @@ pp_c_additive_expression (c_pretty_printer *pp, tree e) else pp_minus (pp); pp_c_whitespace (pp); - pp_multiplicative_expression (pp, TREE_OPERAND (e, 1)); + pp_multiplicative_expression (pp, TREE_OPERAND (e, 1)); break; default: @@ -1756,7 +1756,7 @@ pp_c_conditional_expression (c_pretty_printer *pp, tree e) /* assignment-expression: conditional-expression - unary-expression assignment-operator assignment-expression + unary-expression assignment-operator assignment-expression assignment-expression: one of = *= /= %= += -= >>= <<= &= ^= |= */ @@ -1903,7 +1903,7 @@ pp_c_expression (c_pretty_printer *pp, tree e) case NE_EXPR: pp_c_equality_expression (pp, e); break; - + case COND_EXPR: pp_conditional_expression (pp, e); break; @@ -1929,14 +1929,13 @@ pp_c_expression (c_pretty_printer *pp, tree e) case NOP_EXPR: case NON_LVALUE_EXPR: case SAVE_EXPR: - case UNSAVE_EXPR: pp_expression (pp, TREE_OPERAND (e, 0)); break; case TARGET_EXPR: pp_postfix_expression (pp, TREE_OPERAND (e, 1)); break; - + default: pp_unsupported_tree (pp, e); break; @@ -1965,7 +1964,7 @@ pp_c_statement (c_pretty_printer *pp, tree stmt) if (pp_needs_newline (pp)) pp_newline_and_indent (pp, 0); - + code = TREE_CODE (stmt); switch (code) { diff --git a/gcc/calls.c b/gcc/calls.c index 38f5e4c5e92..e4c3d9f3037 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -144,7 +144,6 @@ static int check_sibcall_argument_overlap (rtx, struct arg_data *, int); static int combine_pending_stack_adjustment_and_call (int, struct args_size *, unsigned int); -static tree fix_unsafe_tree (tree); static bool shift_returned_value (tree, rtx *); #ifdef REG_PARM_STACK_SPACE @@ -1724,35 +1723,6 @@ check_sibcall_argument_overlap (rtx insn, struct arg_data *arg, int mark_stored_ return insn != NULL_RTX; } -static tree -fix_unsafe_tree (tree t) -{ - switch (unsafe_for_reeval (t)) - { - case 0: /* Safe. */ - break; - - case 1: /* Mildly unsafe. */ - t = unsave_expr (t); - break; - - case 2: /* Wildly unsafe. */ - { - tree var = build_decl (VAR_DECL, NULL_TREE, - TREE_TYPE (t)); - SET_DECL_RTL (var, - expand_expr (t, NULL_RTX, VOIDmode, EXPAND_NORMAL)); - t = var; - } - break; - - default: - abort (); - } - return t; -} - - /* If function value *VALUE was returned at the most significant end of a register, shift it towards the least significant end and convert it to TYPE's mode. Return true and update *VALUE if some action was needed. @@ -2270,48 +2240,6 @@ expand_call (tree exp, rtx target, int ignore) || !lang_hooks.decls.ok_for_sibcall (fndecl)) try_tail_call = 0; - if (try_tail_call) - { - int end, inc; - actparms = NULL_TREE; - /* Ok, we're going to give the tail call the old college try. - This means we're going to evaluate the function arguments - up to three times. There are two degrees of badness we can - encounter, those that can be unsaved and those that can't. - (See unsafe_for_reeval commentary for details.) - - Generate a new argument list. Pass safe arguments through - unchanged. For the easy badness wrap them in UNSAVE_EXPRs. - For hard badness, evaluate them now and put their resulting - rtx in a temporary VAR_DECL. - - initialize_argument_information has ordered the array for the - order to be pushed, and we must remember this when reconstructing - the original argument order. */ - - if (PUSH_ARGS_REVERSED) - { - inc = 1; - i = 0; - end = num_actuals; - } - else - { - inc = -1; - i = num_actuals - 1; - end = -1; - } - - for (; i != end; i += inc) - { - args[i].tree_value = fix_unsafe_tree (args[i].tree_value); - } - /* Do the same for the function address if it is an expression. */ - if (!fndecl) - addr = fix_unsafe_tree (addr); - } - - /* Ensure current function's preferred stack boundary is at least what we need. We don't have to increase alignment for recursive functions. */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f71e01d7652..da4dad7448b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2004-07-28 Eric Christopher + + * cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete. + 2004-07-28 Nathan Sidwell * cp-tree.h (struct tree_pair_s): New. diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index cfdc82f4762..00ba81cf8a5 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -78,8 +78,6 @@ static void cxx_initialize_diagnostics (diagnostic_context *); #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL cxx_dup_lang_specific_decl #undef LANG_HOOKS_TRUTHVALUE_CONVERSION #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion -#undef LANG_HOOKS_UNSAFE_FOR_REEVAL -#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME mangle_decl #undef LANG_HOOKS_MARK_ADDRESSABLE @@ -225,7 +223,7 @@ cxx_get_alias_set (tree t) /* The base variant of a type must be in the same alias set as the complete type. */ return get_alias_set (TYPE_CONTEXT (t)); - + /* Punt on PMFs until we canonicalize functions properly. */ if (TYPE_PTRMEMFUNC_P (t)) return 0; @@ -270,7 +268,7 @@ cp_expr_size (tree exp) /* This would be wrong for a type with virtual bases, but they are caught by the abort above. */ return (is_empty_class (TREE_TYPE (exp)) - ? size_zero_node + ? size_zero_node : CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp))); } else diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 0972ad2680d..79070f0629a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -59,7 +59,7 @@ static tree handle_init_priority_attribute (tree *, tree, tree, int, bool *); nonzero, rvalues of class type are considered lvalues. */ static cp_lvalue_kind -lvalue_p_1 (tree ref, +lvalue_p_1 (tree ref, int treat_class_rvalues_as_lvalues) { cp_lvalue_kind op1_lvalue_kind = clk_none; @@ -78,7 +78,6 @@ lvalue_p_1 (tree ref, case PREINCREMENT_EXPR: case PREDECREMENT_EXPR: case SAVE_EXPR: - case UNSAVE_EXPR: case TRY_CATCH_EXPR: case WITH_CLEANUP_EXPR: case REALPART_EXPR: @@ -93,8 +92,8 @@ lvalue_p_1 (tree ref, expression does not depend on "X". */ op1_lvalue_kind &= ~clk_packed; /* Look at the member designator. */ - if (!op1_lvalue_kind - /* The "field" can be a FUNCTION_DECL or an OVERLOAD in some + if (!op1_lvalue_kind + /* The "field" can be a FUNCTION_DECL or an OVERLOAD in some situations. */ || TREE_CODE (TREE_OPERAND (ref, 1)) != FIELD_DECL) ; @@ -108,7 +107,7 @@ lvalue_p_1 (tree ref, } else if (DECL_PACKED (TREE_OPERAND (ref, 1))) op1_lvalue_kind |= clk_packed; - + return op1_lvalue_kind; case STRING_CST: @@ -163,7 +162,7 @@ lvalue_p_1 (tree ref, case FUNCTION_DECL: /* All functions (except non-static-member functions) are lvalues. */ - return (DECL_NONSTATIC_MEMBER_FUNCTION_P (ref) + return (DECL_NONSTATIC_MEMBER_FUNCTION_P (ref) ? clk_none : clk_ordinary); case NON_DEPENDENT_EXPR: @@ -200,7 +199,7 @@ lvalue_p_1 (tree ref, cp_lvalue_kind real_lvalue_p (tree ref) { - return lvalue_p_1 (ref, + return lvalue_p_1 (ref, /*treat_class_rvalues_as_lvalues=*/0); } @@ -210,7 +209,7 @@ real_lvalue_p (tree ref) int lvalue_p (tree ref) { - return + return (lvalue_p_1 (ref, /*class rvalue ok*/ 1) != clk_none); } @@ -235,7 +234,7 @@ build_target_expr (tree decl, tree value) { tree t; - t = build (TARGET_EXPR, TREE_TYPE (decl), decl, value, + t = build (TARGET_EXPR, TREE_TYPE (decl), decl, value, cxx_maybe_build_cleanup (decl), NULL_TREE); /* We always set TREE_SIDE_EFFECTS so that expand_expr does not ignore the TARGET_EXPR. If there really turn out to be no @@ -386,9 +385,9 @@ build_cplus_array_type_1 (tree elt_type, tree index_type) /* Push these needs up so that initialization takes place more easily. */ - TYPE_NEEDS_CONSTRUCTING (t) + TYPE_NEEDS_CONSTRUCTING (t) = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type)); - TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) + TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type)); return t; } @@ -413,7 +412,7 @@ build_cplus_array_type (tree elt_type, tree index_type) /* Make a variant of TYPE, qualified with the TYPE_QUALS. Handles arrays correctly. In particular, if TYPE is an array of T's, and TYPE_QUALS is non-empty, returns an array of qualified T's. - + FLAGS determines how to deal with illformed qualifications. If tf_ignore_bad_quals is set, then bad qualifications are dropped (this is permitted if TYPE was introduced via a typedef or template @@ -429,10 +428,10 @@ build_cplus_array_type (tree elt_type, tree index_type) DR 295 queries this and the proposed resolution brings it into line with qualifying a reference. We implement the DR. We also behave in a similar manner for restricting non-pointer types. */ - + tree -cp_build_qualified_type_real (tree type, - int type_quals, +cp_build_qualified_type_real (tree type, + int type_quals, tsubst_flags_t complain) { tree result; @@ -449,8 +448,8 @@ cp_build_qualified_type_real (tree type, /* In C++, the qualification really applies to the array element type. Obtain the appropriately qualified element type. */ tree t; - tree element_type - = cp_build_qualified_type_real (TREE_TYPE (type), + tree element_type + = cp_build_qualified_type_real (TREE_TYPE (type), type_quals, complain); @@ -459,11 +458,11 @@ cp_build_qualified_type_real (tree type, /* See if we already have an identically qualified type. */ for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t)) - if (cp_type_quals (t) == type_quals + if (cp_type_quals (t) == type_quals && TYPE_NAME (t) == TYPE_NAME (type) && TYPE_CONTEXT (t) == TYPE_CONTEXT (type)) break; - + if (!t) { /* Make a new array type, just like the old one, but with the @@ -474,14 +473,14 @@ cp_build_qualified_type_real (tree type, /* Even if we already had this variant, we update TYPE_NEEDS_CONSTRUCTING and TYPE_HAS_NONTRIVIAL_DESTRUCTOR in case - they changed since the variant was originally created. - + they changed since the variant was originally created. + This seems hokey; if there is some way to use a previous variant *without* coming through here, TYPE_NEEDS_CONSTRUCTING will never be updated. */ - TYPE_NEEDS_CONSTRUCTING (t) + TYPE_NEEDS_CONSTRUCTING (t) = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (element_type)); - TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) + TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (element_type)); return t; } @@ -497,7 +496,7 @@ cp_build_qualified_type_real (tree type, t = cp_build_qualified_type_real (t, type_quals, complain); return build_ptrmemfunc_type (t); } - + /* A reference, function or method type shall not be cv qualified. [dcl.ref], [dct.fct] */ if (type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE) @@ -508,7 +507,7 @@ cp_build_qualified_type_real (tree type, bad_quals |= type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE); type_quals &= ~(TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE); } - + /* A restrict-qualified type must be a pointer (or reference) to object or incomplete type. */ if ((type_quals & TYPE_QUAL_RESTRICT) @@ -533,13 +532,13 @@ cp_build_qualified_type_real (tree type, if (bad_quals) { tree bad_type = build_qualified_type (ptr_type_node, bad_quals); - + if (!(complain & tf_ignore_bad_quals)) error ("`%V' qualifiers cannot be applied to `%T'", bad_type, type); } } - + /* Retrieve (or create) the appropriately qualified variant. */ result = build_qualified_type (type, type_quals); @@ -547,7 +546,7 @@ cp_build_qualified_type_real (tree type, then we need to unshare the record that holds the cached pointer-to-member-function type, because these will be distinct between the unqualified and qualified types. */ - if (result != type + if (result != type && TREE_CODE (type) == POINTER_TYPE && TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE) TYPE_LANG_SPECIFIC (result) = NULL; @@ -596,38 +595,38 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) if (new_binfo) return new_binfo; } - + new_binfo = make_tree_binfo (binfo ? BINFO_N_BASE_BINFOS (binfo) : 0); BINFO_TYPE (new_binfo) = type; /* Chain it into the inheritance graph. */ TREE_CHAIN (*igo_prev) = new_binfo; *igo_prev = new_binfo; - + if (binfo) { int ix; tree base_binfo; - + my_friendly_assert (!BINFO_DEPENDENT_BASE_P (binfo), 20040712); my_friendly_assert (type == BINFO_TYPE (binfo), 20040714); - + BINFO_OFFSET (new_binfo) = BINFO_OFFSET (binfo); BINFO_VIRTUALS (new_binfo) = BINFO_VIRTUALS (binfo); - + /* We do not need to copy the accesses, as they are read only. */ BINFO_BASE_ACCESSES (new_binfo) = BINFO_BASE_ACCESSES (binfo); - + /* Recursively copy base binfos of BINFO. */ for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++) { tree new_base_binfo; - + my_friendly_assert (!BINFO_DEPENDENT_BASE_P (base_binfo), 20040713); new_base_binfo = copy_binfo (base_binfo, BINFO_TYPE (base_binfo), t, igo_prev, BINFO_VIRTUAL_P (base_binfo)); - + if (!BINFO_INHERITANCE_CHAIN (new_base_binfo)) BINFO_INHERITANCE_CHAIN (new_base_binfo) = new_binfo; BINFO_BASE_APPEND (new_binfo, new_base_binfo); @@ -635,7 +634,7 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) } else BINFO_DEPENDENT_BASE_P (new_binfo) = 1; - + if (virt) { /* Push it onto the list after any virtual bases it contains @@ -644,7 +643,7 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) BINFO_VIRTUAL_P (new_binfo) = 1; BINFO_INHERITANCE_CHAIN (new_binfo) = TYPE_BINFO (t); } - + return new_binfo; } @@ -659,7 +658,7 @@ copy_binfo (tree binfo, tree type, tree t, tree *igo_prev, int virt) static GTY ((param_is (union tree_node))) htab_t list_hash_table; -struct list_proxy +struct list_proxy { tree purpose; tree value; @@ -688,10 +687,10 @@ static hashval_t list_hash_pieces (tree purpose, tree value, tree chain) { hashval_t hashcode = 0; - + if (chain) hashcode += TREE_HASH (chain); - + if (value) hashcode += TREE_HASH (value); else @@ -709,8 +708,8 @@ static hashval_t list_hash (const void* p) { tree t = (tree) p; - return list_hash_pieces (TREE_PURPOSE (t), - TREE_VALUE (t), + return list_hash_pieces (TREE_PURPOSE (t), + TREE_VALUE (t), TREE_CHAIN (t)); } @@ -828,13 +827,13 @@ is_overloaded_fn (tree x) int really_overloaded_fn (tree x) -{ +{ /* A baselink is also considered an overloaded function. */ if (TREE_CODE (x) == OFFSET_REF) x = TREE_OPERAND (x, 1); if (BASELINK_P (x)) x = BASELINK_FUNCTIONS (x); - + return ((TREE_CODE (x) == OVERLOAD && OVL_CHAIN (x)) || DECL_FUNCTION_TEMPLATE_P (OVL_CURRENT (x)) || TREE_CODE (x) == TEMPLATE_ID_EXPR); @@ -869,7 +868,7 @@ ovl_cons (tree decl, tree chain) TREE_TYPE (result) = unknown_type_node; OVL_FUNCTION (result) = decl; TREE_CHAIN (result) = chain; - + return result; } @@ -968,7 +967,7 @@ bind_template_template_parm (tree t, tree newargs) TEMPLATE_TYPE_PARM_INDEX (t2) = copy_node (TEMPLATE_TYPE_PARM_INDEX (t)); TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (t2)) = decl; TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2) - = tree_cons (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t), + = tree_cons (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t), newargs, NULL_TREE); TREE_TYPE (decl) = t2; @@ -1001,13 +1000,13 @@ count_trees (tree t) int n_trees = 0; walk_tree_without_duplicates (&t, count_trees_r, &n_trees); return n_trees; -} +} /* Called from verify_stmt_tree via walk_tree. */ static tree -verify_stmt_tree_r (tree* tp, - int* walk_subtrees ATTRIBUTE_UNUSED , +verify_stmt_tree_r (tree* tp, + int* walk_subtrees ATTRIBUTE_UNUSED , void* data) { tree t = *tp; @@ -1021,7 +1020,7 @@ verify_stmt_tree_r (tree* tp, there is a circularity in the statement tree. */ if (htab_find (*statements, t)) abort (); - + slot = htab_find_slot (*statements, t, INSERT); *slot = t; @@ -1044,8 +1043,8 @@ verify_stmt_tree (tree t) /* Called from find_tree via walk_tree. */ static tree -find_tree_r (tree* tp, - int* walk_subtrees ATTRIBUTE_UNUSED , +find_tree_r (tree* tp, + int* walk_subtrees ATTRIBUTE_UNUSED , void* data) { if (*tp == (tree) data) @@ -1111,8 +1110,8 @@ no_linkage_check (tree t) case FUNCTION_TYPE: { tree parm; - for (parm = TYPE_ARG_TYPES (t); - parm && parm != void_list_node; + for (parm = TYPE_ARG_TYPES (t); + parm && parm != void_list_node; parm = TREE_CHAIN (parm)) { r = no_linkage_check (TREE_VALUE (parm)); @@ -1198,15 +1197,15 @@ bot_manip (tree* tp, int* walk_subtrees, void* data) u = build_cplus_new (TREE_TYPE (t), break_out_target_exprs (TREE_OPERAND (t, 1))); } - else + else { u = build_target_expr_with_type (break_out_target_exprs (TREE_OPERAND (t, 1)), TREE_TYPE (t)); } /* Map the old variable to the new one. */ - splay_tree_insert (target_remap, - (splay_tree_key) TREE_OPERAND (t, 0), + splay_tree_insert (target_remap, + (splay_tree_key) TREE_OPERAND (t, 0), (splay_tree_value) TREE_OPERAND (u, 0)); /* Replace the old expression with the new version. */ @@ -1223,14 +1222,14 @@ bot_manip (tree* tp, int* walk_subtrees, void* data) /* Make a copy of this node. */ return copy_tree_r (tp, walk_subtrees, NULL); } - + /* Replace all remapped VAR_DECLs in T with their new equivalents. DATA is really a splay-tree mapping old variables to new variables. */ static tree -bot_replace (tree* t, - int* walk_subtrees ATTRIBUTE_UNUSED , +bot_replace (tree* t, + int* walk_subtrees ATTRIBUTE_UNUSED , void* data) { splay_tree target_remap = ((splay_tree) data); @@ -1245,7 +1244,7 @@ bot_replace (tree* t, return NULL_TREE; } - + /* When we parse a default argument expression, we may create temporary variables via TARGET_EXPRs. When we actually use the default-argument expression, we make a copy of the expression, but @@ -1258,8 +1257,8 @@ break_out_target_exprs (tree t) static splay_tree target_remap; if (!target_remap_count++) - target_remap = splay_tree_new (splay_tree_compare_pointers, - /*splay_tree_delete_key_fn=*/NULL, + target_remap = splay_tree_new (splay_tree_compare_pointers, + /*splay_tree_delete_key_fn=*/NULL, /*splay_tree_delete_value_fn=*/NULL); walk_tree (&t, bot_manip, target_remap, NULL); walk_tree (&t, bot_replace, target_remap, NULL); @@ -1356,7 +1355,7 @@ build_min_non_dep (enum tree_code code, tree non_dep, ...) /* This should not be considered a COMPOUND_EXPR, because it resolves to an overload. */ COMPOUND_EXPR_OVERLOADED (t) = 1; - + va_end (p); return t; } @@ -1373,10 +1372,10 @@ build_shared_int_cst (int i) { if (i >= 256) return build_int_2 (i, 0); - + if (!shared_int_cache[i]) shared_int_cache[i] = build_int_2 (i, 0); - + return shared_int_cache[i]; } @@ -1389,7 +1388,7 @@ get_type_decl (tree t) return TYPE_STUB_DECL (t); if (t == error_mark_node) return t; - + abort (); /* Stop compiler from complaining control reaches end of non-void function. */ @@ -1440,7 +1439,7 @@ cp_tree_equal (tree t1, tree t2) /* They might have become equal now. */ if (t1 == t2) return true; - + if (code1 != code2) return false; @@ -1487,7 +1486,7 @@ cp_tree_equal (tree t1, tree t2) { tree o1 = TREE_OPERAND (t1, 0); tree o2 = TREE_OPERAND (t2, 0); - + /* Special case: if either target is an unallocated VAR_DECL, it means that it's going to be unified with whatever the TARGET_EXPR is really supposed to initialize, so treat it @@ -1500,10 +1499,10 @@ cp_tree_equal (tree t1, tree t2) /*Nop*/; else if (!cp_tree_equal (o1, o2)) return false; - + return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1)); } - + case WITH_CLEANUP_EXPR: if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0))) return false; @@ -1532,7 +1531,7 @@ cp_tree_equal (tree t1, tree t2) { unsigned ix; tree vec1, vec2; - + if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0))) return false; vec1 = TREE_OPERAND (t1, 1); @@ -1540,7 +1539,7 @@ cp_tree_equal (tree t1, tree t2) if (!vec1 || !vec2) return !vec1 && !vec2; - + if (TREE_VEC_LENGTH (vec1) != TREE_VEC_LENGTH (vec2)) return false; @@ -1548,16 +1547,16 @@ cp_tree_equal (tree t1, tree t2) if (!cp_tree_equal (TREE_VEC_ELT (vec1, ix), TREE_VEC_ELT (vec2, ix))) return false; - + return true; } - + case SIZEOF_EXPR: case ALIGNOF_EXPR: { tree o1 = TREE_OPERAND (t1, 0); tree o2 = TREE_OPERAND (t2, 0); - + if (TREE_CODE (o1) != TREE_CODE (o2)) return false; if (TYPE_P (o1)) @@ -1565,7 +1564,7 @@ cp_tree_equal (tree t1, tree t2) else return cp_tree_equal (o1, o2); } - + case PTRMEM_CST: /* Two pointer-to-members are the same if they point to the same field or function in the same class. */ @@ -1588,14 +1587,14 @@ cp_tree_equal (tree t1, tree t2) case 's': { int i; - + for (i = 0; i < TREE_CODE_LENGTH (code1); ++i) if (!cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i))) return false; - + return true; } - + case 't': return same_type_p (t1, t2); } @@ -1620,7 +1619,7 @@ tree error_type (tree arg) { tree type = TREE_TYPE (arg); - + if (TREE_CODE (type) == ARRAY_TYPE) ; else if (TREE_CODE (type) == ERROR_MARK) @@ -1673,7 +1672,7 @@ maybe_dummy_object (tree type, tree* binfop) { tree decl, context; tree binfo; - + if (current_class_type && (binfo = lookup_base (current_class_type, type, ba_ignore | ba_quiet, NULL))) @@ -1687,7 +1686,7 @@ maybe_dummy_object (tree type, tree* binfop) if (binfop) *binfop = binfo; - + if (current_class_ref && context == current_class_type /* Kludge: Make sure that current_class_type is actually correct. It might not be if we're in the middle of @@ -1776,10 +1775,10 @@ const struct attribute_spec cxx_attribute_table[] = /* Handle a "java_interface" attribute; arguments as in struct attribute_spec.handler. */ static tree -handle_java_interface_attribute (tree* node, - tree name, - tree args ATTRIBUTE_UNUSED , - int flags, +handle_java_interface_attribute (tree* node, + tree name, + tree args ATTRIBUTE_UNUSED , + int flags, bool* no_add_attrs) { if (DECL_P (*node) @@ -1801,10 +1800,10 @@ handle_java_interface_attribute (tree* node, /* Handle a "com_interface" attribute; arguments as in struct attribute_spec.handler. */ static tree -handle_com_interface_attribute (tree* node, - tree name, - tree args ATTRIBUTE_UNUSED , - int flags ATTRIBUTE_UNUSED , +handle_com_interface_attribute (tree* node, + tree name, + tree args ATTRIBUTE_UNUSED , + int flags ATTRIBUTE_UNUSED , bool* no_add_attrs) { static int warned; @@ -1830,10 +1829,10 @@ handle_com_interface_attribute (tree* node, /* Handle an "init_priority" attribute; arguments as in struct attribute_spec.handler. */ static tree -handle_init_priority_attribute (tree* node, - tree name, - tree args, - int flags ATTRIBUTE_UNUSED , +handle_init_priority_attribute (tree* node, + tree name, + tree args, + int flags ATTRIBUTE_UNUSED , bool* no_add_attrs) { tree initp_expr = TREE_VALUE (args); @@ -1842,7 +1841,7 @@ handle_init_priority_attribute (tree* node, int pri; STRIP_NOPS (initp_expr); - + if (!initp_expr || TREE_CODE (initp_expr) != INTEGER_CST) { error ("requested init_priority is not an integer constant"); @@ -1851,7 +1850,7 @@ handle_init_priority_attribute (tree* node, } pri = TREE_INT_CST_LOW (initp_expr); - + type = strip_array_types (type); if (decl == NULL_TREE @@ -1864,7 +1863,7 @@ handle_init_priority_attribute (tree* node, first time control passes through that function. This is not precise enough to pin down an init_priority value, so don't allow it. */ - || current_function_decl) + || current_function_decl) { error ("can only use `%E' attribute on file-scope definitions " "of objects of class type", name); @@ -1883,7 +1882,7 @@ handle_init_priority_attribute (tree* node, language and runtime support implementations.*/ if (pri <= MAX_RESERVED_INIT_PRIORITY) { - warning + warning ("requested init_priority is reserved for internal use"); } @@ -1933,7 +1932,7 @@ cp_build_type_attribute_variant (tree type, tree attributes) new_type = build_type_attribute_variant (type, attributes); if (TREE_CODE (new_type) == FUNCTION_TYPE - && (TYPE_RAISES_EXCEPTIONS (new_type) + && (TYPE_RAISES_EXCEPTIONS (new_type) != TYPE_RAISES_EXCEPTIONS (type))) new_type = build_exception_variant (new_type, TYPE_RAISES_EXCEPTIONS (type)); @@ -1943,14 +1942,14 @@ cp_build_type_attribute_variant (tree type, tree attributes) /* Apply FUNC to all language-specific sub-trees of TP in a pre-order traversal. Called from walk_tree. */ -tree +tree cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func, void *data, void *htab) { enum tree_code code = TREE_CODE (*tp); location_t save_locus; tree result; - + #define WALK_SUBTREE(NODE) \ do \ { \ @@ -2037,7 +2036,7 @@ cp_cannot_inline_tree_fn (tree* fnp) { /* Don't instantiate functions that are not going to be inlined. */ - if (!DECL_INLINE (DECL_TEMPLATE_RESULT + if (!DECL_INLINE (DECL_TEMPLATE_RESULT (template_for_substitution (fn)))) return 1; @@ -2121,7 +2120,7 @@ cp_auto_var_in_fn_p (tree var, tree fn) /* FN body has been duplicated. Update language specific fields. */ void -cp_update_decl_after_saving (tree fn, +cp_update_decl_after_saving (tree fn, void* decl_map_) { splay_tree decl_map = (splay_tree)decl_map_; @@ -2145,15 +2144,15 @@ init_tree (void) pointed to by DATA (which is really a `splay_tree *'). */ static tree -mark_local_for_remap_r (tree* tp, - int* walk_subtrees ATTRIBUTE_UNUSED , +mark_local_for_remap_r (tree* tp, + int* walk_subtrees ATTRIBUTE_UNUSED , void* data) { tree t = *tp; splay_tree st = (splay_tree) data; tree decl; - + if (TREE_CODE (t) == DECL_EXPR && nonstatic_local_decl_p (DECL_EXPR_DECL (t))) decl = DECL_EXPR_DECL (t); @@ -2172,13 +2171,13 @@ mark_local_for_remap_r (tree* tp, tree copy; /* Make a copy. */ - copy = copy_decl_for_inlining (decl, - DECL_CONTEXT (decl), + copy = copy_decl_for_inlining (decl, + DECL_CONTEXT (decl), DECL_CONTEXT (decl)); /* Remember the copy. */ splay_tree_insert (st, - (splay_tree_key) decl, + (splay_tree_key) decl, (splay_tree_value) copy); } @@ -2190,8 +2189,8 @@ mark_local_for_remap_r (tree* tp, remaps all local declarations to appropriate replacements. */ static tree -cp_unsave_r (tree* tp, - int* walk_subtrees, +cp_unsave_r (tree* tp, + int* walk_subtrees, void* data) { splay_tree st = (splay_tree) data; @@ -2202,7 +2201,7 @@ cp_unsave_r (tree* 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; diff --git a/gcc/dojump.c b/gcc/dojump.c index ab81d047947..363d815251e 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -187,12 +187,6 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) break; #endif - case UNSAVE_EXPR: - do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label); - TREE_OPERAND (exp, 0) - = lang_hooks.unsave_expr_now (TREE_OPERAND (exp, 0)); - break; - case NOP_EXPR: if (TREE_CODE (TREE_OPERAND (exp, 0)) == COMPONENT_REF || TREE_CODE (TREE_OPERAND (exp, 0)) == BIT_FIELD_REF diff --git a/gcc/expr.c b/gcc/expr.c index c3a0d8060a9..f2faae301a6 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6537,15 +6537,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, return ret; } - case UNSAVE_EXPR: - { - rtx temp; - temp = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier); - TREE_OPERAND (exp, 0) - = lang_hooks.unsave_expr_now (TREE_OPERAND (exp, 0)); - return temp; - } - case GOTO_EXPR: if (TREE_CODE (TREE_OPERAND (exp, 0)) == LABEL_DECL) expand_goto (TREE_OPERAND (exp, 0)); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index bacf2b61532..23f7576ff4e 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2027,7 +2027,6 @@ non_lvalue (tree x) case PREINCREMENT_EXPR: case PREDECREMENT_EXPR: case SAVE_EXPR: - case UNSAVE_EXPR: case TRY_CATCH_EXPR: case WITH_CLEANUP_EXPR: case COMPOUND_EXPR: diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 8962a64baaf..e96f60f2c29 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2004-07-28 Eric Christopher + + * lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete. + (java_unsafe_for_reeval): Ditto. + 2004-07-26 * parse.y (build_super_invocation): Adjust declaration order to @@ -72,7 +77,7 @@ (start_java_method): Reset uniq. Create base_decl_map. Set function_binding_level. (end_java_method): Null unused fields to save memory. - + 2004-07-20 Nathan Sidwell * class.c (add_interface_do): Remove. @@ -183,8 +188,8 @@ (create_class): Fix comment typo. (resolve_qualified_expression_name): Pass type of qualifier to not_accessible_p, not the type in which target field was found. - (not_accessible_p): Handle inner classes. Expand protected - qualifier-subtype check to enclosing instances, but don't apply this + (not_accessible_p): Handle inner classes. Expand protected + qualifier-subtype check to enclosing instances, but don't apply this check to static members. Allow protected access to inner classes of a subtype. Allow private access within common enclosing context. (build_super_invocation): Get WFL line number info from current @@ -195,7 +200,7 @@ common_enclosing_instance_p. * class.c (common_enclosing_context_p): New. Determine if types share a common enclosing context, even across static contexts. - (common_enclosing_instance_p): Renamed from + (common_enclosing_instance_p): Renamed from common_enclosing_context_p. Determines if types share a common non-static enclosing instance. * java-tree.h (common_enclosing_instance_p): Declare. @@ -356,7 +361,7 @@ * parse.y (create_interface): Set correct access modifiers for interfaces. * jcf-write.c (get_classfile_modifiers): New function. - (generate_classfile): Use get_classfile_modifiers, not + (generate_classfile): Use get_classfile_modifiers, not get_access_flags. 2004-06-26 Bryce McKinlay @@ -369,7 +374,7 @@ 2004-06-26 Bryce McKinlay - * parse.y (qualify_and_find): Pass type decl, not identifier, to + * parse.y (qualify_and_find): Pass type decl, not identifier, to load_class. 2004-06-26 Bryce McKinlay @@ -403,7 +408,7 @@ 2004-06-22 Andrew Haley Ranjit Mathew - + Fixes PR java/16113. * decl.c (force_poplevels): Remove call to expand_end_bindings. @@ -424,7 +429,7 @@ (emit_init_test_initialization): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Likewise. * parse.y (make_qualifed_name, build_array_ref): Likewise. - + 2004-06-21 Andrew Haley * java-gimplify.c (java_gimplify_block): set TREE_USED on the new @@ -455,7 +460,7 @@ do not set current_function_cannot_inline. * resource.c (write_resource_constructor): Do not reset flag_inline_functions around rest_of_compilation. - + 2004-06-08 Andrew Pinski PR java/15769 @@ -490,8 +495,8 @@ 2004-05-28 Bryce McKinlay - * jcf-write.c (generate_bytecode_conditional): Handle binops - UNLT_EXPR, UNLE_EXPR, UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR, + * jcf-write.c (generate_bytecode_conditional): Handle binops + UNLT_EXPR, UNLE_EXPR, UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR, and LTGT_EXPR. (generate_bytecode_insns): Likewise. @@ -599,7 +604,7 @@ Fix comment typo. Use check_pkg_class_access() instead of not_accessible_p() for unqualified types. - (not_accessible_p): Use DECL_CONTEXT (member) instead of + (not_accessible_p): Use DECL_CONTEXT (member) instead of REFERENCE for package-private access checking. (patch_method_invocation): Use accessibility_string() instead of java_accstring_lookup(). @@ -626,12 +631,12 @@ 2004-04-19 Bryce McKinlay * class.c (make_class_data): Add new field aux_info. - * decl.c (java_init_decl_processing): Push type and decl for + * decl.c (java_init_decl_processing): Push type and decl for `aux_info'. 2004-04-15 Bryce McKinlay - * expr.c (expand_java_NEW): Don't use size argument for + * expr.c (expand_java_NEW): Don't use size argument for _Jv_AllocObject calls. * parse.y (patch_invoke): Likewise. @@ -642,7 +647,7 @@ 2004-04-12 Bryce McKinlay - * class.c (get_interface_method_index): New function. Return dispatch + * class.c (get_interface_method_index): New function. Return dispatch index for interface method. (make_method_value): For interface methods, set index field to iface dispatch index, not DECL_VINDEX. diff --git a/gcc/java/lang.c b/gcc/java/lang.c index d3ba37289d9..f81388a4c23 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -17,7 +17,7 @@ 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 02111-1307, USA. +Boston, MA 02111-1307, USA. Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. @@ -59,7 +59,6 @@ static void put_decl_node (tree); static void java_print_error_function (diagnostic_context *, const char *); static tree java_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn, void *, void *); -static int java_unsafe_for_reeval (tree); static int merge_init_test_initialization (void * *, void *); static int inline_init_test_initialization (void * *, void *); static bool java_can_use_bit_fields_p (void); @@ -221,8 +220,6 @@ struct language_function GTY(()) #define LANG_HOOKS_POST_OPTIONS java_post_options #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE java_parse_file -#undef LANG_HOOKS_UNSAFE_FOR_REEVAL -#define LANG_HOOKS_UNSAFE_FOR_REEVAL java_unsafe_for_reeval #undef LANG_HOOKS_MARK_ADDRESSABLE #define LANG_HOOKS_MARK_ADDRESSABLE java_mark_addressable #undef LANG_HOOKS_TRUTHVALUE_CONVERSION @@ -672,7 +669,7 @@ java_print_error_function (diagnostic_context *context ATTRIBUTE_UNUSED, { const char *name = lang_printable_name (current_function_decl, 2); fprintf (stderr, "In %s `%s':\n", - (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor" + (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor" : "method"), name); } @@ -866,38 +863,19 @@ java_tree_inlining_walk_subtrees (tree *tp ATTRIBUTE_UNUSED, #undef WALK_SUBTREE } -/* Called from unsafe_for_reeval. */ -static int -java_unsafe_for_reeval (tree t) -{ - switch (TREE_CODE (t)) - { - case BLOCK: - /* Our expander tries to expand the variables twice. Boom. */ - if (BLOCK_EXPR_DECLS (t) != NULL) - return 2; - return unsafe_for_reeval (BLOCK_EXPR_BODY (t)); - - default: - break; - } - - return -1; -} - /* Every call to a static constructor has an associated boolean variable which is in the outermost scope of the calling method. This variable is used to avoid multiple calls to the static - constructor for each class. + constructor for each class. It looks something like this: foo () { boolean dummy = OtherClass.is_initialized; - + ... - + if (! dummy) OtherClass.initialize(); @@ -920,7 +898,7 @@ merge_init_test_initialization (void **entry, void *x) splay_tree decl_map = (splay_tree)x; splay_tree_node n; tree *init_test_decl; - + /* See if we have remapped this declaration. If we haven't there's a bug in the inliner. */ n = splay_tree_lookup (decl_map, (splay_tree_key) ite->value); @@ -935,18 +913,18 @@ merge_init_test_initialization (void **entry, void *x) if (!*init_test_decl) *init_test_decl = (tree)n->value; - /* This fixes a weird case. + /* This fixes a weird case. The front end assumes that once we have called a method that initializes some class, we can assume the class is initialized. It does this by setting the DECL_INITIAL of the init_test_decl for that class, and no initializations are emitted for that class. - + However, what if the method that is suppoed to do the initialization is itself inlined in the caller? When expanding the called method we'll assume that the class initialization has already been done, because the DECL_INITIAL of the init_test_decl is set. - + To fix this we remove the DECL_INITIAL (in the caller scope) of all the init_test_decls corresponding to classes initialized by the inlined method. This makes the caller no longer assume that the @@ -962,7 +940,7 @@ merge_init_test_initialization (void **entry, void *x) void java_inlining_merge_static_initializers (tree fn, void *decl_map) { - htab_traverse + htab_traverse (DECL_FUNCTION_INIT_TEST_TABLE (fn), merge_init_test_initialization, decl_map); } @@ -978,8 +956,8 @@ inline_init_test_initialization (void **entry, void *x) { struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry; splay_tree decl_map = (splay_tree)x; - - tree h = java_treetreehash_find + + tree h = java_treetreehash_find (DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl), ite->key); if (! h) return true; @@ -997,7 +975,7 @@ inline_init_test_initialization (void **entry, void *x) void java_inlining_map_static_initializers (tree fn, void *decl_map) { - htab_traverse + htab_traverse (DECL_FUNCTION_INIT_TEST_TABLE (fn), inline_init_test_initialization, decl_map); } @@ -1029,7 +1007,7 @@ dump_compound_expr (dump_info_p di, tree t) } } } - + static bool java_dump_tree (void *dump_info, tree t) { @@ -1087,7 +1065,7 @@ java_dump_tree (void *dump_info, tree t) dump_child ("var", local); local = next; } - + { tree block = BLOCK_EXPR_BODY (t); dump_child ("body", block); @@ -1095,7 +1073,7 @@ java_dump_tree (void *dump_info, tree t) } } return true; - + case COMPOUND_EXPR: if (!dump_flag (di, TDF_SLIM, t)) return false; @@ -1139,13 +1117,13 @@ java_get_callee_fndecl (tree call_expr) return NULL; table = TREE_OPERAND (method, 0); if (! DECL_LANG_SPECIFIC(table) - || !DECL_OWNER (table) + || !DECL_OWNER (table) || TYPE_ATABLE_DECL (DECL_OWNER (table)) != table) return NULL; atable_methods = TYPE_ATABLE_METHODS (DECL_OWNER (table)); index = TREE_INT_CST_LOW (TREE_OPERAND (method, 1)); - + /* FIXME: Replace this for loop with a hash table lookup. */ for (element = atable_methods; element; element = TREE_CHAIN (element)) { diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index e31c513401d..7efa097e9cc 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -51,7 +51,6 @@ extern tree lhd_return_null_tree (tree); extern tree lhd_do_nothing_iii_return_null_tree (int, int, int); extern int lhd_safe_from_p (rtx, tree); extern bool lhd_staticp (tree); -extern int lhd_unsafe_for_reeval (tree); extern void lhd_print_tree_nothing (FILE *, tree, int); extern const char *lhd_decl_printable_name (tree, int); extern int lhd_types_compatible_p (tree, tree); @@ -106,7 +105,6 @@ extern int lhd_gimplify_expr (tree *, tree *, tree *); #define LANG_HOOKS_EXPAND_DECL lhd_expand_decl #define LANG_HOOKS_SAFE_FROM_P lhd_safe_from_p #define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t -#define LANG_HOOKS_UNSAFE_FOR_REEVAL lhd_unsafe_for_reeval #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 @@ -271,7 +269,6 @@ extern tree lhd_make_node (enum tree_code); LANG_HOOKS_TRUTHVALUE_CONVERSION, \ LANG_HOOKS_SAFE_FROM_P, \ LANG_HOOKS_FINISH_INCOMPLETE_DECL, \ - LANG_HOOKS_UNSAFE_FOR_REEVAL, \ LANG_HOOKS_MARK_ADDRESSABLE, \ LANG_HOOKS_STATICP, \ LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \ diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 8a2802147f4..e93204240ee 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -60,7 +60,7 @@ lhd_do_nothing_i (int ARG_UNUSED (i)) /* Do nothing (int, int, int). Return NULL_TREE. */ tree -lhd_do_nothing_iii_return_null_tree (int ARG_UNUSED (i), +lhd_do_nothing_iii_return_null_tree (int ARG_UNUSED (i), int ARG_UNUSED (j), int ARG_UNUSED (k)) { @@ -123,14 +123,6 @@ lhd_safe_from_p (rtx ARG_UNUSED (x), tree ARG_UNUSED (exp)) return 1; } -/* Called from unsafe_for_reeval. */ - -int -lhd_unsafe_for_reeval (tree ARG_UNUSED (t)) -{ - return -1; -} - /* Called from staticp. */ bool @@ -175,7 +167,7 @@ lhd_set_decl_assembler_name (tree decl) same as that used in the source language. (That's correct for C, and GCC used to set DECL_ASSEMBLER_NAME to the same value as DECL_NAME in build_decl, so this choice provides - backwards compatibility with existing front-ends. + backwards compatibility with existing front-ends. Can't use just the variable's own name for a variable whose scope is less than the whole compilation. Concatenate a @@ -214,7 +206,7 @@ lhd_type_promotes_to (tree ARG_UNUSED (type)) /* Registration of machine- or os-specific builtin types. */ void -lhd_register_builtin_type (tree ARG_UNUSED (type), +lhd_register_builtin_type (tree ARG_UNUSED (type), const char * ARG_UNUSED (name)) { } diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 86774cf8f6d..04dc114d2b7 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -293,11 +293,6 @@ struct lang_hooks compilation. Default hook is does nothing. */ void (*finish_incomplete_decl) (tree); - /* Function used by unsafe_for_reeval. A non-negative number is - returned directly from unsafe_for_reeval, a negative number falls - through. The default hook returns a negative number. */ - int (*unsafe_for_reeval) (tree); - /* Mark EXP saying that we need to be able to take the address of it; it should not be allocated in a register. Return true if successful. */ @@ -310,8 +305,8 @@ struct lang_hooks DECL_NODE with a newly GC-allocated copy. */ void (*dup_lang_specific_decl) (tree); - /* Called before its argument, an UNSAVE_EXPR, is to be - unsaved. Modify it in-place so that all the evaluate only once + /* 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); diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index 02200739af4..5856ad599d3 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -67,8 +67,6 @@ enum c_language_kind c_language = clk_objc; #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL #define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl -#undef LANG_HOOKS_UNSAFE_FOR_REEVAL -#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval #undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true #undef LANG_HOOKS_STATICP diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 139661e4b50..bb2af8dc2bc 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -154,7 +154,7 @@ insert_decl_map (inline_data *id, tree key, tree value) (splay_tree_value) value); } -/* Remap DECL during the copying of the BLOCK tree for the function. +/* Remap DECL during the copying of the BLOCK tree for the function. We are only called to remap local variables in the current function. */ static tree @@ -243,7 +243,7 @@ remap_type (tree type, inline_data *id) insert_decl_map (id, type, type); return type; } - + /* We do need a copy. build and register it now. If this is a pointer or reference type, remap the designated type and make a new pointer or reference type. */ @@ -303,7 +303,7 @@ remap_type (tree type, inline_data *id) if (t && TREE_CODE (t) != INTEGER_CST) walk_tree (&TYPE_MAX_VALUE (new), copy_body_r, id, NULL); return new; - + case FUNCTION_TYPE: TREE_TYPE (new) = remap_type (TREE_TYPE (new), id); walk_tree (&TYPE_ARG_TYPES (new), copy_body_r, id, NULL); @@ -518,9 +518,6 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) copy_statement_list (tp); else if (TREE_CODE (*tp) == SAVE_EXPR) remap_save_expr (tp, id->decl_map, walk_subtrees); - else if (TREE_CODE (*tp) == UNSAVE_EXPR) - /* UNSAVE_EXPRs should not be generated until expansion time. */ - abort (); else if (TREE_CODE (*tp) == BIND_EXPR) copy_bind_expr (tp, walk_subtrees, id); else if (TREE_CODE (*tp) == LABELED_BLOCK_EXPR) @@ -1206,7 +1203,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data) return NULL; switch (TREE_CODE (x)) - { + { /* Containers have no cost. */ case TREE_LIST: case TREE_VEC: @@ -1226,7 +1223,6 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data) case NOP_EXPR: case VIEW_CONVERT_EXPR: case SAVE_EXPR: - case UNSAVE_EXPR: case ADDR_EXPR: case COMPLEX_EXPR: case EXIT_BLOCK_EXPR: @@ -1580,7 +1576,7 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) Note we need to save and restore the saved tree statement iterator to avoid having it clobbered by expand_calls_inline. */ tree_stmt_iterator save_tsi; - + save_tsi = id->tsi; expand_calls_inline (&arg_inits, id); id->tsi = save_tsi; @@ -1701,7 +1697,7 @@ static void expand_calls_inline (tree *stmt_p, inline_data *id) { tree stmt = *stmt_p; - enum tree_code code = TREE_CODE (stmt); + enum tree_code code = TREE_CODE (stmt); int dummy; switch (code) @@ -2326,7 +2322,7 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) if (TREE_CODE (*tp) == BIND_EXPR) BIND_EXPR_BLOCK (*tp) = NULL_TREE; } - + else if (TREE_CODE_CLASS (code) == 't') *walk_subtrees = 0; else if (TREE_CODE_CLASS (code) == 'd') @@ -2392,7 +2388,7 @@ mark_local_for_remap_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, /* Copy the decl and remember the copy. */ insert_decl_map (id, decl, - copy_decl_for_inlining (decl, DECL_CONTEXT (decl), + copy_decl_for_inlining (decl, DECL_CONTEXT (decl), DECL_CONTEXT (decl))); } @@ -2416,7 +2412,7 @@ unsave_r (tree *tp, int *walk_subtrees, void *data) { /* Lookup the declaration. */ n = splay_tree_lookup (st, (splay_tree_key) *tp); - + /* If it's there, remap it. */ if (n) *tp = (tree) n->value; diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 3c755b72502..d1479e4869d 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -754,7 +754,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, { tree_stmt_iterator si; bool first = true; - + if ((flags & TDF_SLIM) || !dumping_stmts) { pp_string (buffer, ""); @@ -1099,12 +1099,6 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, pp_character (buffer, '>'); break; - case UNSAVE_EXPR: - pp_string (buffer, "UNSAVE_EXPR <"); - dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false); - pp_character (buffer, '>'); - break; - case ENTRY_VALUE_EXPR: NIY; break; @@ -2051,10 +2045,10 @@ dump_vops (pretty_printer *buffer, tree stmt, int spc, int flags) for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++) { pp_string (buffer, "# "); - dump_generic_node (buffer, V_MAY_DEF_RESULT (v_may_defs, i), + dump_generic_node (buffer, V_MAY_DEF_RESULT (v_may_defs, i), spc + 2, flags, false); pp_string (buffer, " = V_MAY_DEF <"); - dump_generic_node (buffer, V_MAY_DEF_OP (v_may_defs, i), + dump_generic_node (buffer, V_MAY_DEF_OP (v_may_defs, i), spc + 2, flags, false); pp_string (buffer, ">;"); newline_and_indent (buffer, spc); @@ -2283,7 +2277,7 @@ dump_generic_bb_buff (pretty_printer *buffer, basic_block bb, if (bb_ann (bb)) dump_phi_nodes (buffer, bb, indent, flags); - + for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) { int curr_indent; diff --git a/gcc/tree.c b/gcc/tree.c index 46479be7d39..30fcb556ab3 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -582,7 +582,7 @@ make_tree_binfo_stat (unsigned base_binfos MEM_STAT_DECL) tree t; size_t length = (offsetof (struct tree_binfo, base_binfos) + VEC_embedded_size (tree, base_binfos)); - + #ifdef GATHER_STATISTICS tree_node_counts[(int) binfo_kind]++; tree_node_sizes[(int) binfo_kind] += length; @@ -593,7 +593,7 @@ make_tree_binfo_stat (unsigned base_binfos MEM_STAT_DECL) memset (t, 0, offsetof (struct tree_binfo, base_binfos)); TREE_SET_CODE (t, TREE_BINFO); - + VEC_embedded_init (tree, BINFO_BASE_BINFOS (t), base_binfos); return t; @@ -1217,7 +1217,7 @@ expr_align (tree t) case SAVE_EXPR: case COMPOUND_EXPR: case MODIFY_EXPR: case INIT_EXPR: case TARGET_EXPR: case WITH_CLEANUP_EXPR: - case CLEANUP_POINT_EXPR: case UNSAVE_EXPR: + case CLEANUP_POINT_EXPR: /* These don't change the alignment of an object. */ return expr_align (TREE_OPERAND (t, 0)); @@ -1294,7 +1294,7 @@ staticp (tree arg) return true; case COMPONENT_REF: - /* If the thing being referenced is not a field, then it is + /* If the thing being referenced is not a field, then it is something language specific. */ if (TREE_CODE (TREE_OPERAND (arg, 1)) != FIELD_DECL) return (*lang_hooks.staticp) (arg); @@ -1436,24 +1436,6 @@ skip_simple_arithmetic (tree expr) return inner; } -/* Arrange for an expression to be expanded multiple independent - times. This is useful for cleanup actions, as the backend can - expand them multiple times in different places. */ - -tree -unsave_expr (tree expr) -{ - tree t; - - /* If this is already protected, no sense in protecting it again. */ - if (TREE_CODE (expr) == UNSAVE_EXPR) - return expr; - - t = build1 (UNSAVE_EXPR, TREE_TYPE (expr), expr); - TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (expr); - return t; -} - /* Returns the index of the first non-tree operand for CODE, or the number of operands if all are trees. */ @@ -1533,106 +1515,6 @@ unsave_expr_1 (tree expr) break; } } - -/* Return 0 if it is safe to evaluate EXPR multiple times, - return 1 if it is safe if EXPR is unsaved afterward, or - return 2 if it is completely unsafe. - - This assumes that CALL_EXPRs and TARGET_EXPRs are never replicated in - an expression tree, so that it safe to unsave them and the surrounding - context will be correct. - - SAVE_EXPRs basically *only* appear replicated in an expression tree, - occasionally across the whole of a function. It is therefore only - safe to unsave a SAVE_EXPR if you know that all occurrences appear - below the UNSAVE_EXPR. */ - -int -unsafe_for_reeval (tree expr) -{ - int unsafeness = 0; - enum tree_code code; - int i, tmp, tmp2; - tree exp; - int first_rtl; - - if (expr == NULL_TREE) - return 1; - - code = TREE_CODE (expr); - first_rtl = first_rtl_op (code); - - switch (code) - { - case SAVE_EXPR: - return 2; - - /* A label can only be emitted once. */ - case LABEL_EXPR: - return 1; - - case BIND_EXPR: - unsafeness = 1; - break; - - case TREE_LIST: - for (exp = expr; exp != 0; exp = TREE_CHAIN (exp)) - { - tmp = unsafe_for_reeval (TREE_VALUE (exp)); - unsafeness = MAX (tmp, unsafeness); - } - - return unsafeness; - - case CALL_EXPR: - tmp2 = unsafe_for_reeval (TREE_OPERAND (expr, 0)); - tmp = unsafe_for_reeval (TREE_OPERAND (expr, 1)); - return MAX (MAX (tmp, 1), tmp2); - - case TARGET_EXPR: - unsafeness = 1; - break; - - case EXIT_BLOCK_EXPR: - /* EXIT_BLOCK_LABELED_BLOCK, a.k.a. TREE_OPERAND (expr, 0), holds - a reference to an ancestor LABELED_BLOCK, so we need to avoid - unbounded recursion in the 'e' traversal code below. */ - exp = EXIT_BLOCK_RETURN (expr); - return exp ? unsafe_for_reeval (exp) : 0; - - default: - tmp = lang_hooks.unsafe_for_reeval (expr); - if (tmp >= 0) - return tmp; - break; - } - - switch (TREE_CODE_CLASS (code)) - { - case 'c': /* a constant */ - case 't': /* a type node */ - case 'x': /* something random, like an identifier or an ERROR_MARK. */ - case 'd': /* A decl node */ - return 0; - - case 'e': /* an expression */ - case 'r': /* a reference */ - case 's': /* an expression with side effects */ - case '<': /* a comparison expression */ - case '2': /* a binary arithmetic expression */ - case '1': /* a unary arithmetic expression */ - for (i = first_rtl - 1; i >= 0; i--) - { - tmp = unsafe_for_reeval (TREE_OPERAND (expr, i)); - unsafeness = MAX (tmp, unsafeness); - } - - return unsafeness; - - default: - return 2; - } -} /* 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. */ @@ -2313,7 +2195,7 @@ do { tree _node = (NODE); \ else if (TREE_CODE (node) == BIT_FIELD_REF) UPDATE_TITCSE (TREE_OPERAND (node, 2)); } - + /* Now see what's inside. If it's an INDIRECT_REF, copy our properties from it. If it's a decl, it's invariant and constant if the decl is static. It's also invariant if it's a decl in the current function. (Taking the @@ -2349,7 +2231,7 @@ do { tree _node = (NODE); \ Constants, decls, types and misc nodes cannot be. We define 5 non-variadic functions, from 0 to 4 arguments. This is - enough for all extant tree codes. These functions can be called + enough for all extant tree codes. These functions can be called directly (preferably!), but can also be obtained via GCC preprocessor magic within the build macro. */ @@ -2515,7 +2397,7 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL) TREE_READONLY (t) = read_only; TREE_CONSTANT (t) = constant; TREE_INVARIANT (t) = invariant; - TREE_SIDE_EFFECTS (t) = side_effects; + TREE_SIDE_EFFECTS (t) = side_effects; TREE_THIS_VOLATILE (t) = TREE_CODE_CLASS (code) == 'r' && arg0 && TREE_THIS_VOLATILE (arg0); @@ -2566,7 +2448,7 @@ build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1, } } - TREE_SIDE_EFFECTS (t) = side_effects; + TREE_SIDE_EFFECTS (t) = side_effects; TREE_THIS_VOLATILE (t) = TREE_CODE_CLASS (code) == 'r' && arg0 && TREE_THIS_VOLATILE (arg0); @@ -2598,7 +2480,7 @@ build4_stat (enum tree_code code, tree tt, tree arg0, tree arg1, PROCESS_ARG(2); PROCESS_ARG(3); - TREE_SIDE_EFFECTS (t) = side_effects; + TREE_SIDE_EFFECTS (t) = side_effects; TREE_THIS_VOLATILE (t) = TREE_CODE_CLASS (code) == 'r' && arg0 && TREE_THIS_VOLATILE (arg0); @@ -2700,7 +2582,7 @@ build_decl_stat (enum tree_code code, tree name, tree type MEM_STAT_DECL) layout_decl (t, 0); else if (code == FUNCTION_DECL) DECL_MODE (t) = FUNCTION_MODE; - + /* Set default visibility to whatever the user supplied with visibility_specified depending on #pragma GCC visibility. */ DECL_VISIBILITY (t) = default_visibility; @@ -3230,7 +3112,7 @@ type_hash_eq (const void *va, const void *vb) && TREE_CODE (TYPE_ARG_TYPES (b->type)) == TREE_LIST && type_list_equal (TYPE_ARG_TYPES (a->type), TYPE_ARG_TYPES (b->type))))); - + case ARRAY_TYPE: case SET_TYPE: return TYPE_DOMAIN (a->type) == TYPE_DOMAIN (b->type); @@ -3683,7 +3565,7 @@ simple_cst_equal (tree t1, tree t2) TREE_STRING_LENGTH (t1))); case CONSTRUCTOR: - return simple_cst_list_equal (CONSTRUCTOR_ELTS (t1), + return simple_cst_list_equal (CONSTRUCTOR_ELTS (t1), CONSTRUCTOR_ELTS (t2)); case SAVE_EXPR: @@ -4325,7 +4207,7 @@ build_method_type (tree basetype, tree type) if (TREE_CODE (type) != FUNCTION_TYPE) abort (); - return build_method_type_directly (basetype, + return build_method_type_directly (basetype, TREE_TYPE (type), TYPE_ARG_TYPES (type)); } @@ -4870,16 +4752,16 @@ decl_type_context (tree decl) case UNION_TYPE: case QUAL_UNION_TYPE: return context; - + case TYPE_DECL: case FUNCTION_DECL: context = DECL_CONTEXT (context); break; - + case BLOCK: context = BLOCK_SUPERCONTEXT (context); break; - + default: abort (); } @@ -4918,7 +4800,7 @@ get_callee_fndecl (tree call) if (TREE_CODE (addr) == ADDR_EXPR && TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL) return TREE_OPERAND (addr, 0); - + /* We couldn't figure out what was being called. Maybe the front end has some idea. */ return lang_hooks.lang_get_callee_fndecl (call); @@ -4970,11 +4852,11 @@ crc32_string (unsigned chksum, const char *string) { unsigned value = *string << 24; unsigned ix; - + for (ix = 8; ix--; value <<= 1) { unsigned feedback; - + feedback = (value ^ chksum) & 0x80000000 ? 0x04c11db7 : 0; chksum <<= 1; chksum ^= feedback; @@ -5189,7 +5071,7 @@ tree_check_failed (const tree node, const char *file, length += strlen (tree_code_name[code]); } va_end (args); - + internal_error ("tree check: expected %s, have %s in %s, at %s:%d", buffer, tree_code_name[TREE_CODE (node)], function, trim_filename (file), line); @@ -5226,7 +5108,7 @@ tree_not_check_failed (const tree node, const char *file, length += strlen (tree_code_name[code]); } va_end (args); - + internal_error ("tree check: expected none of %s, have %s in %s, at %s:%d", buffer, tree_code_name[TREE_CODE (node)], function, trim_filename (file), line); @@ -5392,7 +5274,7 @@ build_common_tree_nodes (int signed_char) unsigned_intSI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (SImode), 1); unsigned_intDI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (DImode), 1); unsigned_intTI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (TImode), 1); - + access_public_node = get_identifier ("public"); access_protected_node = get_identifier ("protected"); access_private_node = get_identifier ("private"); @@ -5520,7 +5402,7 @@ reconstruct_complex_type (tree type, tree bottom) { inner = reconstruct_complex_type (TREE_TYPE (type), bottom); outer = build_method_type_directly (TYPE_METHOD_BASETYPE (type), - inner, + inner, TYPE_ARG_TYPES (type)); } else @@ -5650,7 +5532,7 @@ in_array_bounds_p (tree ref) if (TREE_CODE (idx) != INTEGER_CST) return false; - + min = array_ref_low_bound (ref); max = array_ref_up_bound (ref); if (!min @@ -5695,7 +5577,7 @@ fields_compatible_p (tree f1, tree f2) return false; if (!lang_hooks.types_compatible_p (TREE_TYPE (f1), TREE_TYPE (f2))) - return false; + return false; return true; } @@ -5746,36 +5628,36 @@ int_cst_value (tree x) /* Returns the greatest common divisor of A and B, which must be INTEGER_CSTs. */ -tree +tree tree_fold_gcd (tree a, tree b) { tree a_mod_b; tree type = TREE_TYPE (a); - + #if defined ENABLE_CHECKING if (TREE_CODE (a) != INTEGER_CST || TREE_CODE (b) != INTEGER_CST) abort (); #endif - - if (integer_zerop (a)) + + if (integer_zerop (a)) return b; - - if (integer_zerop (b)) + + if (integer_zerop (b)) return a; - + if (tree_int_cst_sgn (a) == -1) a = fold (build2 (MULT_EXPR, type, a, convert (type, integer_minus_one_node))); - + if (tree_int_cst_sgn (b) == -1) b = fold (build2 (MULT_EXPR, type, b, convert (type, integer_minus_one_node))); - + while (1) { a_mod_b = fold (build2 (CEIL_MOD_EXPR, type, a, b)); - + if (!TREE_INT_CST_LOW (a_mod_b) && !TREE_INT_CST_HIGH (a_mod_b)) return b; diff --git a/gcc/tree.def b/gcc/tree.def index 5602c704bd6..49cb8fb4e2e 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -20,7 +20,7 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + /* The third argument can be: 'x' for an exceptional code (fits no category). 't' for a type object code. @@ -82,7 +82,7 @@ DEFTREECODE (TREE_VEC, "tree_vec", 'x', 0) outermost scope of a particular inlining of a function). BLOCK_ABSTRACT is nonzero if the block represents an abstract instance of a block (i.e. one which is nested within an abstract - instance of an inline function). + instance of an inline function). TREE_ASM_WRITTEN is nonzero if the block was actually referenced in the generated assembly. */ DEFTREECODE (BLOCK, "block", 'x', 0) @@ -272,7 +272,7 @@ DEFTREECODE (REAL_CST, "real_cst", 'c', 0) DEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 0) /* Contents are in TREE_VECTOR_CST_ELTS field. */ -DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 0) +DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 0) /* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields. */ DEFTREECODE (STRING_CST, "string_cst", 'c', 0) @@ -369,7 +369,7 @@ DEFTREECODE (COMPONENT_REF, "component_ref", 'r', 3) The field can be either a signed or unsigned field; BIT_FIELD_REF_UNSIGNED says which. */ DEFTREECODE (BIT_FIELD_REF, "bit_field_ref", 'r', 3) - + /* C unary `*' or Pascal `^'. One operand, an expression for a pointer. */ DEFTREECODE (INDIRECT_REF, "indirect_ref", 'r', 1) @@ -462,7 +462,7 @@ DEFTREECODE (COND_EXPR, "cond_expr", 'e', 3) /* Declare local variables, including making RTL and allocating space. BIND_EXPR_VARS is a chain of VAR_DECL nodes for the variables. - BIND_EXPR_BODY is the body, the expression to be computed using + BIND_EXPR_BODY is the body, the expression to be computed using the variables. The value of operand 1 becomes that of the BIND_EXPR. BIND_EXPR_BLOCK is the BLOCK that corresponds to these bindings for debugging purposes. If this BIND_EXPR is actually expanded, @@ -470,12 +470,12 @@ DEFTREECODE (COND_EXPR, "cond_expr", 'e', 3) The BIND_EXPR is not responsible for informing parsers about these variables. If the body is coming from the input file, - then the code that creates the BIND_EXPR is also responsible for + then the code that creates the BIND_EXPR is also responsible for informing the parser of the variables. If the BIND_EXPR is ever expanded, its TREE_USED flag is set. This tells the code for debugging symbol tables not to ignore the BIND_EXPR. - If the BIND_EXPR should be output for debugging but will not be expanded, + If the BIND_EXPR should be output for debugging but will not be expanded, set the TREE_USED flag by hand. In order for the BIND_EXPR to be known at all, the code that creates it @@ -716,14 +716,6 @@ DEFTREECODE (VIEW_CONVERT_EXPR, "view_convert_expr", 'r', 1) will be replaced by the temporary variable that holds the value. */ DEFTREECODE (SAVE_EXPR, "save_expr", 'e', 1) -/* For a UNSAVE_EXPR, operand 0 is the value to unsave. By unsave, we - mean that all _EXPRs such as TARGET_EXPRs, SAVE_EXPRs, CALL_EXPRs, - that are protected from being evaluated more than once should be - reset so that a new expand_expr call of this expr will cause those - to be re-evaluated. This is useful when we want to reuse a tree in - different places, but where we must re-expand. */ -DEFTREECODE (UNSAVE_EXPR, "unsave_expr", 'e', 1) - /* & in C. Value is the address at which the operand's value resides. Operand may have any mode. Result mode is Pmode. */ DEFTREECODE (ADDR_EXPR, "addr_expr", 'e', 1) @@ -732,7 +724,7 @@ DEFTREECODE (ADDR_EXPR, "addr_expr", 'e', 1) of type EPmode. Used only for languages that need static chains. */ DEFTREECODE (ENTRY_VALUE_EXPR, "entry_value_expr", 'e', 1) -/* Operand0 is a function constant; result is part N of a function +/* Operand0 is a function constant; result is part N of a function descriptor of type ptr_mode. */ DEFTREECODE (FDESC_EXPR, "fdesc_expr", 'e', 2) @@ -827,7 +819,7 @@ DEFTREECODE (SWITCH_EXPR, "switch_expr", 's', 3) label. CASE_LABEL is the corresponding LABEL_DECL. */ DEFTREECODE (CASE_LABEL_EXPR, "case_label_expr", 's', 3) -/* RESX. Resume execution after an exception. Operand 0 is a +/* RESX. Resume execution after an exception. Operand 0 is a number indicating the exception region that is being left. */ DEFTREECODE (RESX_EXPR, "resx_expr", 's', 1) diff --git a/gcc/tree.h b/gcc/tree.h index 10673b913a7..3e672e38878 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3169,22 +3169,11 @@ extern int first_rtl_op (enum tree_code); enum tree_node_structure_enum tree_node_structure (tree); -/* unsave_expr (EXP) returns an expression equivalent to EXP but it - can be used multiple times and will evaluate EXP in its entirety - each time. */ - -extern tree unsave_expr (tree); - /* Reset EXP in place so that it can be expanded again. Does not recurse into subtrees. */ extern void unsave_expr_1 (tree); -/* Return 0 if it is safe to evaluate EXPR multiple times, - return 1 if it is safe if EXPR is unsaved afterward, or - return 2 if it is completely unsafe. */ -extern int unsafe_for_reeval (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. -- 2.11.4.GIT