diff options
-rw-r--r-- | gcc/ChangeLog | 62 | ||||
-rw-r--r-- | gcc/attribs.c | 14 | ||||
-rw-r--r-- | gcc/builtins.c | 32 | ||||
-rw-r--r-- | gcc/calls.c | 2 | ||||
-rw-r--r-- | gcc/combine.c | 20 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/parser.c | 12 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 2 | ||||
-rw-r--r-- | gcc/expr.c | 14 | ||||
-rw-r--r-- | gcc/fold-const.c | 42 | ||||
-rw-r--r-- | gcc/function.c | 2 | ||||
-rw-r--r-- | gcc/gimplify.c | 4 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/java/lang.c | 4 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 3 | ||||
-rw-r--r-- | gcc/langhooks.c | 8 | ||||
-rw-r--r-- | gcc/langhooks.h | 2 | ||||
-rw-r--r-- | gcc/objc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 2 | ||||
-rw-r--r-- | gcc/objc/objc-act.h | 2 | ||||
-rw-r--r-- | gcc/output.h | 2 | ||||
-rw-r--r-- | gcc/rtl-factoring.c | 2 | ||||
-rw-r--r-- | gcc/rtl.h | 16 | ||||
-rw-r--r-- | gcc/rtlanal.c | 28 | ||||
-rw-r--r-- | gcc/rtlhooks-def.h | 6 | ||||
-rw-r--r-- | gcc/rtlhooks.c | 10 | ||||
-rw-r--r-- | gcc/stmt.c | 4 | ||||
-rw-r--r-- | gcc/stor-layout.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-im.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 2 | ||||
-rw-r--r-- | gcc/tree.c | 32 | ||||
-rw-r--r-- | gcc/tree.h | 92 | ||||
-rw-r--r-- | gcc/varasm.c | 2 |
33 files changed, 286 insertions, 157 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 009b3332..08ee924 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,65 @@ +2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * attribs.c (hash_attr, eq_attr, init_attributes): Constify. + * builtins.c (validate_arg, builtin_mathfn_code, + validate_arglist): Likewise. + * calls.c (call_expr_flags): Likewise. + * combine.c (reg_nonzero_bits_for_combine, + reg_num_sign_bit_copies_for_combine, get_last_value, + reg_truncated_to_mode): Likewise. + * emit-rtl.c (subreg_lowpart_p): Likewise. + * expr.c (highest_pow2_factor_for_target, + categorize_ctor_elements_1, categorize_ctor_elements, + count_type_elements, contains_packed_reference, + highest_pow2_factor, highest_pow2_factor_for_target): Likewise. + * fold-const.c (may_negate_without_overflow_p, int_const_binop, + fold_convertible_p, operand_equal_p, tree_swap_operands_p, + native_encode_int, native_encode_real, native_encode_complex, + native_encode_vector, native_encode_expr, native_interpret_int, + native_interpret_real, native_interpret_complex, + native_interpret_vector, native_interpret_expr): Likewise. + * function.c (use_register_for_decl): Likewise. + * gimplify.c (get_name): Likewise. + * langhooks-def.h (lhd_return_null_const_tree): New. + (LANG_HOOKS_GET_CALLEE_FNDECL): Use it. + * langhooks.c (lhd_return_null_const_tree): New. + * langhooks.h (lang_get_callee_fndecl): Constify. + * output.h (constructor_static_from_elts_p): Likewise. + * rtl-factoring.c (gen_symbol_ref_rtx_for_label): Likewise. + * rtl.h (nonzero_bits, num_sign_bit_copies, truncated_to_mode, + subreg_lowpart_p, noop_move_p, struct rtl_hooks): Likewise. + * rtlanal.c (cached_nonzero_bits, nonzero_bits1, + cached_num_sign_bit_copies, num_sign_bit_copies1, noop_move_p, + nonzero_bits, num_sign_bit_copies, truncated_to_mode): Likewise. + * rtlhooks-def.h (reg_nonzero_bits_general, + reg_num_sign_bit_copies_general, reg_truncated_to_mode_general): + Likewise. + * rtlhooks.c (reg_num_sign_bit_copies_general, + reg_nonzero_bits_general, reg_truncated_to_mode_general): + Likewise. + * stmt.c (warn_if_unused_value, is_body_block): Likewise. + * stor-layout.c (mode_for_size_tree): Likewise. + * tree-ssa-loop-im.c (memref_eq): Likewise. + * tree-ssa-loop-ivopts.c (tree_int_cst_sign_bit): Likewise. + * tree.c (contains_placeholder_p, type_list_equal, + simple_cst_equal, get_callee_fndecl, operand_equal_for_phi_arg_p): + Likewise. + * tree.h (tree_int_cst_sign_bit, may_negate_without_overflow_p, + mode_for_size_tree, categorize_ctor_elements, count_type_elements, + contains_placeholder_p, contains_packed_reference, + get_callee_fndecl, operand_equal_for_phi_arg_p, + warn_if_unused_value, is_body_block, native_encode_expr, + native_interpret_expr, fold_convertible_p, operand_equal_p, + int_const_binop, tree_swap_operands_p, builtin_mathfn_code, + validate_arglist, simple_cst_equal, type_list_equal, + use_register_for_decl, call_expr_flags, get_name, + highest_pow2_factor): Likewise. + (const_call_expr_arg_iterator_d, + init_const_call_expr_arg_iterator, next_const_call_expr_arg, + first_const_call_expr_arg, more_const_call_expr_args_p, + FOR_EACH_CONST_CALL_EXPR_ARG): New. + * varasm.c (constructor_static_from_elts_p): Constify. + 2007-07-28 Kazu Hirata <kazu@codesourcery.com> * cfglayout.c, config/arm/arm.c, config/arm/cortex-a8.md, diff --git a/gcc/attribs.c b/gcc/attribs.c index 5ac72f7..feb1c30 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -87,8 +87,8 @@ substring_hash (const char *str, int l) static hashval_t hash_attr (const void *p) { - struct attribute_spec *spec = (struct attribute_spec *) p; - int l = strlen (spec->name); + const struct attribute_spec *const spec = (const struct attribute_spec *) p; + const int l = strlen (spec->name); return substring_hash (spec->name, l); } @@ -98,8 +98,8 @@ hash_attr (const void *p) static int eq_attr (const void *p, const void *q) { - const struct attribute_spec *spec = (struct attribute_spec *) p; - const struct substring *str = (struct substring *) q; + const struct attribute_spec *const spec = (const struct attribute_spec *) p; + const struct substring *const str = (const struct substring *) q; return (!strncmp (spec->name, str->str, str->length) && !spec->name[str->length]); } @@ -183,15 +183,15 @@ init_attributes (void) for (k = 0; attribute_tables[i][k].name != NULL; k++) { struct substring str; - void **slot; + const void **slot; str.str = attribute_tables[i][k].name; str.length = strlen (attribute_tables[i][k].name); - slot = htab_find_slot_with_hash (attribute_hash, &str, + slot = (const void **)htab_find_slot_with_hash (attribute_hash, &str, substring_hash (str.str, str.length), INSERT); gcc_assert (!*slot); - *slot = (void *)&attribute_tables[i][k]; + *slot = &attribute_tables[i][k]; } attributes_initialized = true; } diff --git a/gcc/builtins.c b/gcc/builtins.c index 871267b..39b4fcc 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -152,7 +152,7 @@ static tree fold_builtin_strlen (tree); static tree fold_builtin_inf (tree, int); static tree fold_builtin_nan (tree, tree, int); static tree rewrite_call_expr (tree, int, tree, int, ...); -static bool validate_arg (tree, enum tree_code code); +static bool validate_arg (const_tree, enum tree_code code); static bool integer_valued_real_p (tree); static tree fold_trunc_transparent_mathfn (tree, tree); static bool readonly_data_expr (tree); @@ -6984,11 +6984,11 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, Otherwise the return value is END_BUILTINS. */ enum built_in_function -builtin_mathfn_code (tree t) +builtin_mathfn_code (const_tree t) { - tree fndecl, arg, parmlist; - tree argtype, parmtype; - call_expr_arg_iterator iter; + const_tree fndecl, arg, parmlist; + const_tree argtype, parmtype; + const_call_expr_arg_iterator iter; if (TREE_CODE (t) != CALL_EXPR || TREE_CODE (CALL_EXPR_FN (t)) != ADDR_EXPR) @@ -7002,7 +7002,7 @@ builtin_mathfn_code (tree t) return END_BUILTINS; parmlist = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); - init_call_expr_arg_iterator (t, &iter); + init_const_call_expr_arg_iterator (t, &iter); for (; parmlist; parmlist = TREE_CHAIN (parmlist)) { /* If a function doesn't take a variable number of arguments, @@ -7010,15 +7010,15 @@ builtin_mathfn_code (tree t) parmtype = TREE_VALUE (parmlist); if (VOID_TYPE_P (parmtype)) { - if (more_call_expr_args_p (&iter)) + if (more_const_call_expr_args_p (&iter)) return END_BUILTINS; return DECL_FUNCTION_CODE (fndecl); } - if (! more_call_expr_args_p (&iter)) + if (! more_const_call_expr_args_p (&iter)) return END_BUILTINS; - arg = next_call_expr_arg (&iter); + arg = next_const_call_expr_arg (&iter); argtype = TREE_TYPE (arg); if (SCALAR_FLOAT_TYPE_P (parmtype)) @@ -10609,7 +10609,7 @@ rewrite_call_expr (tree exp, int skip, tree fndecl, int n, ...) a type. */ static bool -validate_arg (tree arg, enum tree_code code) +validate_arg (const_tree arg, enum tree_code code) { if (!arg) return false; @@ -10624,16 +10624,16 @@ validate_arg (tree arg, enum tree_code code) VOID_TYPE. */ bool -validate_arglist (tree callexpr, ...) +validate_arglist (const_tree callexpr, ...) { enum tree_code code; bool res = 0; va_list ap; - call_expr_arg_iterator iter; - tree arg; + const_call_expr_arg_iterator iter; + const_tree arg; va_start (ap, callexpr); - init_call_expr_arg_iterator (callexpr, &iter); + init_const_call_expr_arg_iterator (callexpr, &iter); do { @@ -10647,13 +10647,13 @@ validate_arglist (tree callexpr, ...) case VOID_TYPE: /* This signifies an endlink, if no arguments remain, return true, otherwise return false. */ - res = !more_call_expr_args_p (&iter); + res = !more_const_call_expr_args_p (&iter); goto end; default: /* If no parameters remain or the parameter's code does not match the specified code, return false. Otherwise continue checking any remaining arguments. */ - arg = next_call_expr_arg (&iter); + arg = next_const_call_expr_arg (&iter); if (!validate_arg (arg, code)) goto end; break; diff --git a/gcc/calls.c b/gcc/calls.c index 8863faa..98fc8f5 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -616,7 +616,7 @@ flags_from_decl_or_type (const_tree exp) /* Detect flags from a CALL_EXPR. */ int -call_expr_flags (tree t) +call_expr_flags (const_tree t) { int flags; tree decl = get_callee_fndecl (t); diff --git a/gcc/combine.c b/gcc/combine.c index 2e40d6f..dda1a5b 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -368,11 +368,11 @@ static struct undobuf undobuf; static int n_occurrences; -static rtx reg_nonzero_bits_for_combine (rtx, enum machine_mode, rtx, +static rtx reg_nonzero_bits_for_combine (const_rtx, enum machine_mode, const_rtx, enum machine_mode, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *); -static rtx reg_num_sign_bit_copies_for_combine (rtx, enum machine_mode, rtx, +static rtx reg_num_sign_bit_copies_for_combine (const_rtx, enum machine_mode, const_rtx, enum machine_mode, unsigned int, unsigned int *); static void do_SUBST (rtx *, rtx); @@ -428,7 +428,7 @@ static void check_conversions (rtx, rtx); static void record_dead_and_set_regs_1 (rtx, rtx, void *); static void record_dead_and_set_regs (rtx); static int get_last_value_validate (rtx *, rtx, int, int); -static rtx get_last_value (rtx); +static rtx get_last_value (const_rtx); static int use_crosses_set_p (rtx, int); static void reg_dead_at_p_1 (rtx, rtx, void *); static int reg_dead_at_p (rtx, rtx); @@ -441,7 +441,7 @@ static void record_promoted_value (rtx, rtx); static int unmentioned_reg_p_1 (rtx *, void *); static bool unmentioned_reg_p (rtx, rtx); static void record_truncated_value (rtx); -static bool reg_truncated_to_mode (enum machine_mode, rtx); +static bool reg_truncated_to_mode (enum machine_mode, const_rtx); static rtx gen_lowpart_or_truncate (enum machine_mode, rtx); @@ -8622,8 +8622,8 @@ simplify_and_const_int (rtx x, enum machine_mode mode, rtx varop, a shift, AND, or zero_extract, we can do better. */ static rtx -reg_nonzero_bits_for_combine (rtx x, enum machine_mode mode, - rtx known_x ATTRIBUTE_UNUSED, +reg_nonzero_bits_for_combine (const_rtx x, enum machine_mode mode, + const_rtx known_x ATTRIBUTE_UNUSED, enum machine_mode known_mode ATTRIBUTE_UNUSED, unsigned HOST_WIDE_INT known_ret ATTRIBUTE_UNUSED, unsigned HOST_WIDE_INT *nonzero) @@ -8699,8 +8699,8 @@ reg_nonzero_bits_for_combine (rtx x, enum machine_mode mode, be between 1 and the number of bits in MODE. */ static rtx -reg_num_sign_bit_copies_for_combine (rtx x, enum machine_mode mode, - rtx known_x ATTRIBUTE_UNUSED, +reg_num_sign_bit_copies_for_combine (const_rtx x, enum machine_mode mode, + const_rtx known_x ATTRIBUTE_UNUSED, enum machine_mode known_mode ATTRIBUTE_UNUSED, unsigned int known_ret ATTRIBUTE_UNUSED, @@ -11518,7 +11518,7 @@ record_promoted_value (rtx insn, rtx subreg) an explicit truncation. */ static bool -reg_truncated_to_mode (enum machine_mode mode, rtx x) +reg_truncated_to_mode (enum machine_mode mode, const_rtx x) { reg_stat_type *rsp = VEC_index (reg_stat_type, reg_stat, REGNO (x)); enum machine_mode truncated = rsp->truncated_to_mode; @@ -11720,7 +11720,7 @@ get_last_value_validate (rtx *loc, rtx insn, int tick, int replace) is known longer known reliably. */ static rtx -get_last_value (rtx x) +get_last_value (const_rtx x) { unsigned int regno; rtx value; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 860a80a..24006fe 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * parser.c (eof_token): Un-constify. + (cp_lexer_new_main, cp_lexer_new_from_tokens, VEC_alloc, + cp_lexer_consume_token, cp_lexer_purge_token): Remove spurious + casts. + 2007-07-28 Kazu Hirata <kazu@codesourcery.com> * pt.c, tree.c, typeck2.c: Fix comment typos. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a7190cb..1b12d79 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -98,7 +98,7 @@ typedef struct cp_token *cp_token_position; DEF_VEC_P (cp_token_position); DEF_VEC_ALLOC_P (cp_token_position,heap); -static const cp_token eof_token = +static cp_token eof_token = { CPP_EOF, RID_MAX, 0, PRAGMA_NONE, 0, 0, false, 0, { NULL }, #if USE_MAPPED_LOCATION @@ -318,7 +318,7 @@ cp_lexer_new_main (void) lexer->buffer = buffer; lexer->buffer_length = alloc - space; lexer->last_token = pos; - lexer->next_token = lexer->buffer_length ? buffer : (cp_token *)&eof_token; + lexer->next_token = lexer->buffer_length ? buffer : &eof_token; /* Subsequent preprocessor diagnostics should use compiler diagnostic functions to get the compiler source location. */ @@ -342,7 +342,7 @@ cp_lexer_new_from_tokens (cp_token_cache *cache) /* We do not own the buffer. */ lexer->buffer = NULL; lexer->buffer_length = 0; - lexer->next_token = first == last ? (cp_token *)&eof_token : first; + lexer->next_token = first == last ? &eof_token : first; lexer->last_token = last; lexer->saved_tokens = VEC_alloc (cp_token_position, heap, @@ -612,7 +612,7 @@ cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n) ++token; if (token == lexer->last_token) { - token = (cp_token *)&eof_token; + token = &eof_token; break; } @@ -645,7 +645,7 @@ cp_lexer_consume_token (cp_lexer* lexer) lexer->next_token++; if (lexer->next_token == lexer->last_token) { - lexer->next_token = (cp_token *)&eof_token; + lexer->next_token = &eof_token; break; } @@ -685,7 +685,7 @@ cp_lexer_purge_token (cp_lexer *lexer) tok++; if (tok == lexer->last_token) { - tok = (cp_token *)&eof_token; + tok = &eof_token; break; } } diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index fb52818..fbc74eb 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -1283,7 +1283,7 @@ subreg_highpart_offset (enum machine_mode outermode, enum machine_mode innermode If X is not a SUBREG, always return 1 (it is its own low part!). */ int -subreg_lowpart_p (rtx x) +subreg_lowpart_p (const_rtx x) { if (GET_CODE (x) != SUBREG) return 1; @@ -144,7 +144,7 @@ static void store_constructor (tree, rtx, int, HOST_WIDE_INT); static rtx store_field (rtx, HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode, tree, tree, int, bool); -static unsigned HOST_WIDE_INT highest_pow2_factor_for_target (tree, tree); +static unsigned HOST_WIDE_INT highest_pow2_factor_for_target (const_tree, const_tree); static int is_aligning_offset (tree, tree); static void expand_operands (tree, tree, rtx, rtx*, rtx*, @@ -4656,7 +4656,7 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal) /* Helper for categorize_ctor_elements. Identical interface. */ static bool -categorize_ctor_elements_1 (tree ctor, HOST_WIDE_INT *p_nz_elts, +categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts, HOST_WIDE_INT *p_elt_count, bool *p_must_clear) { @@ -4802,7 +4802,7 @@ categorize_ctor_elements_1 (tree ctor, HOST_WIDE_INT *p_nz_elts, as "initializer_constant_valid_p (CTOR, TREE_TYPE (CTOR)) != 0". */ bool -categorize_ctor_elements (tree ctor, HOST_WIDE_INT *p_nz_elts, +categorize_ctor_elements (const_tree ctor, HOST_WIDE_INT *p_nz_elts, HOST_WIDE_INT *p_elt_count, bool *p_must_clear) { @@ -4819,7 +4819,7 @@ categorize_ctor_elements (tree ctor, HOST_WIDE_INT *p_nz_elts, array member at the end of the structure. */ HOST_WIDE_INT -count_type_elements (tree type, bool allow_flexarr) +count_type_elements (const_tree type, bool allow_flexarr) { const HOST_WIDE_INT max = ~((HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT-1)); switch (TREE_CODE (type)) @@ -5928,7 +5928,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, as PACKED. */ bool -contains_packed_reference (tree exp) +contains_packed_reference (const_tree exp) { bool packed_p = false; @@ -6446,7 +6446,7 @@ safe_from_p (rtx x, tree exp, int top_p) This is used in updating alignment of MEMs in array references. */ unsigned HOST_WIDE_INT -highest_pow2_factor (tree exp) +highest_pow2_factor (const_tree exp) { unsigned HOST_WIDE_INT c0, c1; @@ -6517,7 +6517,7 @@ highest_pow2_factor (tree exp) the structure gives the alignment. */ static unsigned HOST_WIDE_INT -highest_pow2_factor_for_target (tree target, tree exp) +highest_pow2_factor_for_target (const_tree target, const_tree exp) { unsigned HOST_WIDE_INT target_align, factor; diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c7447b9..614e55a 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1074,7 +1074,7 @@ negate_mathfn_p (enum built_in_function code) overflow. */ bool -may_negate_without_overflow_p (tree t) +may_negate_without_overflow_p (const_tree t) { unsigned HOST_WIDE_INT val; unsigned int prec; @@ -1620,7 +1620,7 @@ int_binop_types_match_p (enum tree_code code, tree type1, tree type2) If NOTRUNC is nonzero, do not truncate the result to fit the data type. */ tree -int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) +int_const_binop (enum tree_code code, const_tree arg1, const_tree arg2, int notrunc) { unsigned HOST_WIDE_INT int1l, int2l; HOST_WIDE_INT int1h, int2h; @@ -2213,7 +2213,7 @@ build_zero_vector (tree type) /* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. */ bool -fold_convertible_p (tree type, tree arg) +fold_convertible_p (const_tree type, const_tree arg) { tree orig = TREE_TYPE (arg); @@ -2744,7 +2744,7 @@ truth_value_p (enum tree_code code) to ensure that global memory is unchanged in between. */ int -operand_equal_p (tree arg0, tree arg1, unsigned int flags) +operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) { /* If either is ERROR_MARK, they aren't equal. */ if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK) @@ -2997,13 +2997,13 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags) /* Now see if all the arguments are the same. */ { - call_expr_arg_iterator iter0, iter1; - tree a0, a1; - for (a0 = first_call_expr_arg (arg0, &iter0), - a1 = first_call_expr_arg (arg1, &iter1); + const_call_expr_arg_iterator iter0, iter1; + const_tree a0, a1; + for (a0 = first_const_call_expr_arg (arg0, &iter0), + a1 = first_const_call_expr_arg (arg1, &iter1); a0 && a1; - a0 = next_call_expr_arg (&iter0), - a1 = next_call_expr_arg (&iter1)) + a0 = next_const_call_expr_arg (&iter0), + a1 = next_const_call_expr_arg (&iter1)) if (! operand_equal_p (a0, a1, flags)) return 0; @@ -6722,7 +6722,7 @@ reorder_operands_p (tree arg0, tree arg1) evaluate the operands in reverse order. */ bool -tree_swap_operands_p (tree arg0, tree arg1, bool reorder) +tree_swap_operands_p (const_tree arg0, const_tree arg1, bool reorder) { STRIP_SIGN_NOPS (arg0); STRIP_SIGN_NOPS (arg1); @@ -7217,7 +7217,7 @@ fold_plusminus_mult_expr (enum tree_code code, tree type, tree arg0, tree arg1) upon failure. */ static int -native_encode_int (tree expr, unsigned char *ptr, int len) +native_encode_int (const_tree expr, unsigned char *ptr, int len) { tree type = TREE_TYPE (expr); int total_bytes = GET_MODE_SIZE (TYPE_MODE (type)); @@ -7262,7 +7262,7 @@ native_encode_int (tree expr, unsigned char *ptr, int len) upon failure. */ static int -native_encode_real (tree expr, unsigned char *ptr, int len) +native_encode_real (const_tree expr, unsigned char *ptr, int len) { tree type = TREE_TYPE (expr); int total_bytes = GET_MODE_SIZE (TYPE_MODE (type)); @@ -7310,7 +7310,7 @@ native_encode_real (tree expr, unsigned char *ptr, int len) upon failure. */ static int -native_encode_complex (tree expr, unsigned char *ptr, int len) +native_encode_complex (const_tree expr, unsigned char *ptr, int len) { int rsize, isize; tree part; @@ -7333,7 +7333,7 @@ native_encode_complex (tree expr, unsigned char *ptr, int len) upon failure. */ static int -native_encode_vector (tree expr, unsigned char *ptr, int len) +native_encode_vector (const_tree expr, unsigned char *ptr, int len) { int i, size, offset, count; tree itype, elem, elements; @@ -7376,7 +7376,7 @@ native_encode_vector (tree expr, unsigned char *ptr, int len) placed in the buffer, or zero upon failure. */ int -native_encode_expr (tree expr, unsigned char *ptr, int len) +native_encode_expr (const_tree expr, unsigned char *ptr, int len) { switch (TREE_CODE (expr)) { @@ -7403,7 +7403,7 @@ native_encode_expr (tree expr, unsigned char *ptr, int len) If the buffer cannot be interpreted, return NULL_TREE. */ static tree -native_interpret_int (tree type, unsigned char *ptr, int len) +native_interpret_int (tree type, const unsigned char *ptr, int len) { int total_bytes = GET_MODE_SIZE (TYPE_MODE (type)); int byte, offset, word, words; @@ -7451,7 +7451,7 @@ native_interpret_int (tree type, unsigned char *ptr, int len) If the buffer cannot be interpreted, return NULL_TREE. */ static tree -native_interpret_real (tree type, unsigned char *ptr, int len) +native_interpret_real (tree type, const unsigned char *ptr, int len) { enum machine_mode mode = TYPE_MODE (type); int total_bytes = GET_MODE_SIZE (mode); @@ -7501,7 +7501,7 @@ native_interpret_real (tree type, unsigned char *ptr, int len) If the buffer cannot be interpreted, return NULL_TREE. */ static tree -native_interpret_complex (tree type, unsigned char *ptr, int len) +native_interpret_complex (tree type, const unsigned char *ptr, int len) { tree etype, rpart, ipart; int size; @@ -7525,7 +7525,7 @@ native_interpret_complex (tree type, unsigned char *ptr, int len) If the buffer cannot be interpreted, return NULL_TREE. */ static tree -native_interpret_vector (tree type, unsigned char *ptr, int len) +native_interpret_vector (tree type, const unsigned char *ptr, int len) { tree etype, elem, elements; int i, size, count; @@ -7555,7 +7555,7 @@ native_interpret_vector (tree type, unsigned char *ptr, int len) return NULL_TREE. */ tree -native_interpret_expr (tree type, unsigned char *ptr, int len) +native_interpret_expr (tree type, const unsigned char *ptr, int len) { switch (TREE_CODE (type)) { diff --git a/gcc/function.c b/gcc/function.c index 20dff67..eaeaeeb 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1824,7 +1824,7 @@ aggregate_value_p (tree exp, tree fntype) should live on the local stack. */ bool -use_register_for_decl (tree decl) +use_register_for_decl (const_tree decl) { /* Honor volatile. */ if (TREE_SIDE_EFFECTS (decl)) diff --git a/gcc/gimplify.c b/gcc/gimplify.c index fdf34d1..5b317c7 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -505,9 +505,9 @@ create_tmp_var (tree type, const char *prefix) I.E. given <temp> = &A, return A. */ const char * -get_name (tree t) +get_name (const_tree t) { - tree stripped_decl; + const_tree stripped_decl; stripped_decl = t; STRIP_NOPS (stripped_decl); diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 23a80c1..e7b05e7 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * lang.c (java_get_callee_fndecl): Constify. + 2007-07-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * mangle.c (set_type_package_list): Constify. diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 693193d..3f2af64 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -63,7 +63,7 @@ static int inline_init_test_initialization (void * *, void *); static bool java_dump_tree (void *, tree); static void dump_compound_expr (dump_info_p, tree); static bool java_decl_ok_for_sibcall (tree); -static tree java_get_callee_fndecl (tree); +static tree java_get_callee_fndecl (const_tree); static void java_clear_binding_stack (void); #ifndef TARGET_OBJECT_SUFFIX @@ -951,7 +951,7 @@ java_decl_ok_for_sibcall (tree decl) will replace the indirection with a direct call, which undoes the purpose of the atable indirection. */ static tree -java_get_callee_fndecl (tree call_expr) +java_get_callee_fndecl (const_tree call_expr) { tree method, table, element, atable_methods; diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 133c706..a08e1b0 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -43,6 +43,7 @@ extern HOST_WIDE_INT lhd_get_alias_set (tree); extern tree lhd_return_tree (tree); extern tree lhd_return_null_tree_v (void); extern tree lhd_return_null_tree (tree); +extern tree lhd_return_null_const_tree (const_tree); extern tree lhd_do_nothing_iii_return_null_tree (int, int, int); extern tree lhd_staticp (tree); extern void lhd_print_tree_nothing (FILE *, tree, int); @@ -113,7 +114,7 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, #define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function #define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name #define LANG_HOOKS_DWARF_NAME lhd_dwarf_name -#define LANG_HOOKS_GET_CALLEE_FNDECL lhd_return_null_tree +#define LANG_HOOKS_GET_CALLEE_FNDECL lhd_return_null_const_tree #define LANG_HOOKS_EXPR_SIZE lhd_expr_size #define LANG_HOOKS_TREE_SIZE lhd_tree_size #define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 3600436..d47a993 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -100,6 +100,14 @@ lhd_return_null_tree (tree ARG_UNUSED (t)) return NULL_TREE; } +/* Do nothing (return NULL_TREE). */ + +tree +lhd_return_null_const_tree (const_tree ARG_UNUSED (t)) +{ + return NULL_TREE; +} + /* The default post options hook. */ bool diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 7bb5246..68c20ff 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -364,7 +364,7 @@ struct lang_hooks int (*types_compatible_p) (tree x, tree y); /* Given a CALL_EXPR, return a function decl that is its target. */ - tree (*lang_get_callee_fndecl) (tree); + tree (*lang_get_callee_fndecl) (const_tree); /* Called by report_error_function to print out function name. */ void (*print_error_function) (struct diagnostic_context *, const char *); diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index fdcec9d..9c41a97 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * objc-act.c (objc_get_callee_fndecl): Constify. + * objc-act.h (objc_get_callee_fndecl): Likewise. + 2007-07-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * objc-act.c (volatilized_hash, volatilized_eq, string_hash, diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 3f0d6de..4e94c6f 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -9512,7 +9512,7 @@ objc_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p) version looks for the OBJ_TYPE_REF_EXPR which is used for objc_msgSend. */ tree -objc_get_callee_fndecl (tree call_expr) +objc_get_callee_fndecl (const_tree call_expr) { tree addr = CALL_EXPR_FN (call_expr); if (TREE_CODE (addr) != OBJ_TYPE_REF) diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index d801865..c706095 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -29,7 +29,7 @@ Boston, MA 02110-1301, USA. */ bool objc_init (void); const char *objc_printable_name (tree, int); -tree objc_get_callee_fndecl (tree); +tree objc_get_callee_fndecl (const_tree); void objc_finish_file (void); tree objc_fold_obj_type_ref (tree, tree); enum gimplify_status objc_gimplify_expr (tree *, tree *, tree *); diff --git a/gcc/output.h b/gcc/output.h index ecfba07..87d5a86 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -283,7 +283,7 @@ extern void output_object_blocks (void); and has been exposed to let other functions like categorize_ctor_elements evaluate the property while walking a constructor for other purposes. */ -extern bool constructor_static_from_elts_p (tree); +extern bool constructor_static_from_elts_p (const_tree); /* Return nonzero if VALUE is a valid constant-valued expression for use in initializing a static variable; one that can be an diff --git a/gcc/rtl-factoring.c b/gcc/rtl-factoring.c index 298308f..d0386d6 100644 --- a/gcc/rtl-factoring.c +++ b/gcc/rtl-factoring.c @@ -938,7 +938,7 @@ determine_seq_blocks (void) /* Builds a symbol_ref for LABEL. */ static rtx -gen_symbol_ref_rtx_for_label (rtx label) +gen_symbol_ref_rtx_for_label (const_rtx label) { char name[20]; rtx sym; @@ -1044,10 +1044,10 @@ extern bool subreg_offset_representable_p (unsigned int, enum machine_mode, unsigned int, enum machine_mode); extern unsigned int subreg_regno (const_rtx); extern unsigned int subreg_nregs (const_rtx); -extern unsigned HOST_WIDE_INT nonzero_bits (rtx, enum machine_mode); -extern unsigned int num_sign_bit_copies (rtx, enum machine_mode); +extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, enum machine_mode); +extern unsigned int num_sign_bit_copies (const_rtx, enum machine_mode); extern bool constant_pool_constant_p (rtx); -extern bool truncated_to_mode (enum machine_mode, rtx); +extern bool truncated_to_mode (enum machine_mode, const_rtx); /* 1 if RTX is a subreg containing a reg that is already known to be @@ -1496,7 +1496,7 @@ extern rtx operand_subword (rtx, unsigned int, int, enum machine_mode); /* In emit-rtl.c */ extern rtx operand_subword_force (rtx, unsigned int, enum machine_mode); -extern int subreg_lowpart_p (rtx); +extern int subreg_lowpart_p (const_rtx); extern unsigned int subreg_lowpart_offset (enum machine_mode, enum machine_mode); extern unsigned int subreg_highpart_offset (enum machine_mode, @@ -1697,7 +1697,7 @@ extern int reg_set_p (rtx, rtx); extern rtx single_set_2 (const_rtx, const_rtx); extern int multiple_sets (const_rtx); extern int set_noop_p (const_rtx); -extern int noop_move_p (rtx); +extern int noop_move_p (const_rtx); extern rtx find_last_value (rtx, rtx *, rtx, int); extern int refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *); extern int reg_overlap_mentioned_p (const_rtx, const_rtx); @@ -2268,11 +2268,11 @@ struct rtl_hooks { rtx (*gen_lowpart) (enum machine_mode, rtx); rtx (*gen_lowpart_no_emit) (enum machine_mode, rtx); - rtx (*reg_nonzero_bits) (rtx, enum machine_mode, rtx, enum machine_mode, + rtx (*reg_nonzero_bits) (const_rtx, enum machine_mode, const_rtx, enum machine_mode, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *); - rtx (*reg_num_sign_bit_copies) (rtx, enum machine_mode, rtx, enum machine_mode, + rtx (*reg_num_sign_bit_copies) (const_rtx, enum machine_mode, const_rtx, enum machine_mode, unsigned int, unsigned int *); - bool (*reg_truncated_to_mode) (enum machine_mode, rtx); + bool (*reg_truncated_to_mode) (enum machine_mode, const_rtx); /* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */ }; diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index bfca0bd..9f88a50 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -62,16 +62,16 @@ static void subreg_get_info (unsigned int, enum machine_mode, unsigned int, enum machine_mode, struct subreg_info *); -static unsigned HOST_WIDE_INT cached_nonzero_bits (rtx, enum machine_mode, - rtx, enum machine_mode, +static unsigned HOST_WIDE_INT cached_nonzero_bits (const_rtx, enum machine_mode, + const_rtx, enum machine_mode, unsigned HOST_WIDE_INT); -static unsigned HOST_WIDE_INT nonzero_bits1 (rtx, enum machine_mode, - rtx, enum machine_mode, +static unsigned HOST_WIDE_INT nonzero_bits1 (const_rtx, enum machine_mode, + const_rtx, enum machine_mode, unsigned HOST_WIDE_INT); -static unsigned int cached_num_sign_bit_copies (rtx, enum machine_mode, rtx, +static unsigned int cached_num_sign_bit_copies (const_rtx, enum machine_mode, const_rtx, enum machine_mode, unsigned int); -static unsigned int num_sign_bit_copies1 (rtx, enum machine_mode, rtx, +static unsigned int num_sign_bit_copies1 (const_rtx, enum machine_mode, const_rtx, enum machine_mode, unsigned int); /* Offset of the first 'e', 'E' or 'V' operand for each rtx code, or @@ -1106,7 +1106,7 @@ set_noop_p (const_rtx set) value to itself. */ int -noop_move_p (rtx insn) +noop_move_p (const_rtx insn) { rtx pat = PATTERN (insn); @@ -3503,13 +3503,13 @@ default_address_cost (rtx x) unsigned HOST_WIDE_INT -nonzero_bits (rtx x, enum machine_mode mode) +nonzero_bits (const_rtx x, enum machine_mode mode) { return cached_nonzero_bits (x, mode, NULL_RTX, VOIDmode, 0); } unsigned int -num_sign_bit_copies (rtx x, enum machine_mode mode) +num_sign_bit_copies (const_rtx x, enum machine_mode mode) { return cached_num_sign_bit_copies (x, mode, NULL_RTX, VOIDmode, 0); } @@ -3519,7 +3519,7 @@ num_sign_bit_copies (rtx x, enum machine_mode mode) identical subexpressions on the first or the second level. */ static unsigned HOST_WIDE_INT -cached_nonzero_bits (rtx x, enum machine_mode mode, rtx known_x, +cached_nonzero_bits (const_rtx x, enum machine_mode mode, const_rtx known_x, enum machine_mode known_mode, unsigned HOST_WIDE_INT known_ret) { @@ -3572,7 +3572,7 @@ cached_nonzero_bits (rtx x, enum machine_mode mode, rtx known_x, an arithmetic operation, we can do better. */ static unsigned HOST_WIDE_INT -nonzero_bits1 (rtx x, enum machine_mode mode, rtx known_x, +nonzero_bits1 (const_rtx x, enum machine_mode mode, const_rtx known_x, enum machine_mode known_mode, unsigned HOST_WIDE_INT known_ret) { @@ -4028,7 +4028,7 @@ nonzero_bits1 (rtx x, enum machine_mode mode, rtx known_x, first or the second level. */ static unsigned int -cached_num_sign_bit_copies (rtx x, enum machine_mode mode, rtx known_x, +cached_num_sign_bit_copies (const_rtx x, enum machine_mode mode, const_rtx known_x, enum machine_mode known_mode, unsigned int known_ret) { @@ -4079,7 +4079,7 @@ cached_num_sign_bit_copies (rtx x, enum machine_mode mode, rtx known_x, be between 1 and the number of bits in MODE. */ static unsigned int -num_sign_bit_copies1 (rtx x, enum machine_mode mode, rtx known_x, +num_sign_bit_copies1 (const_rtx x, enum machine_mode mode, const_rtx known_x, enum machine_mode known_mode, unsigned int known_ret) { @@ -4866,7 +4866,7 @@ init_num_sign_bit_copies_in_rep (void) assume it already contains a truncated value of MODE. */ bool -truncated_to_mode (enum machine_mode mode, rtx x) +truncated_to_mode (enum machine_mode mode, const_rtx x) { /* This register has already been used in MODE without explicit truncation. */ diff --git a/gcc/rtlhooks-def.h b/gcc/rtlhooks-def.h index 78d4a41f..a3bc52d 100644 --- a/gcc/rtlhooks-def.h +++ b/gcc/rtlhooks-def.h @@ -39,13 +39,13 @@ along with GCC; see the file COPYING3. If not see extern rtx gen_lowpart_general (enum machine_mode, rtx); extern rtx gen_lowpart_no_emit_general (enum machine_mode, rtx); -extern rtx reg_nonzero_bits_general (rtx, enum machine_mode, rtx, +extern rtx reg_nonzero_bits_general (const_rtx, enum machine_mode, const_rtx, enum machine_mode, unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *); -extern rtx reg_num_sign_bit_copies_general (rtx, enum machine_mode, rtx, +extern rtx reg_num_sign_bit_copies_general (const_rtx, enum machine_mode, const_rtx, enum machine_mode, unsigned int, unsigned int *); -extern bool reg_truncated_to_mode_general (enum machine_mode, rtx); +extern bool reg_truncated_to_mode_general (enum machine_mode, const_rtx); #endif /* GCC_RTL_HOOKS_DEF_H */ diff --git a/gcc/rtlhooks.c b/gcc/rtlhooks.c index 7391b03..8939b21 100644 --- a/gcc/rtlhooks.c +++ b/gcc/rtlhooks.c @@ -95,9 +95,9 @@ gen_lowpart_no_emit_general (enum machine_mode mode, rtx x) } rtx -reg_num_sign_bit_copies_general (rtx x ATTRIBUTE_UNUSED, +reg_num_sign_bit_copies_general (const_rtx x ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, - rtx known_x ATTRIBUTE_UNUSED, + const_rtx known_x ATTRIBUTE_UNUSED, enum machine_mode known_mode ATTRIBUTE_UNUSED, unsigned int known_ret ATTRIBUTE_UNUSED, unsigned int *result ATTRIBUTE_UNUSED) @@ -106,9 +106,9 @@ reg_num_sign_bit_copies_general (rtx x ATTRIBUTE_UNUSED, } rtx -reg_nonzero_bits_general (rtx x ATTRIBUTE_UNUSED, +reg_nonzero_bits_general (const_rtx x ATTRIBUTE_UNUSED, enum machine_mode mode ATTRIBUTE_UNUSED, - rtx known_x ATTRIBUTE_UNUSED, + const_rtx known_x ATTRIBUTE_UNUSED, enum machine_mode known_mode ATTRIBUTE_UNUSED, unsigned HOST_WIDE_INT known_ret ATTRIBUTE_UNUSED, unsigned HOST_WIDE_INT *nonzero ATTRIBUTE_UNUSED) @@ -118,7 +118,7 @@ reg_nonzero_bits_general (rtx x ATTRIBUTE_UNUSED, bool reg_truncated_to_mode_general (enum machine_mode mode ATTRIBUTE_UNUSED, - rtx x ATTRIBUTE_UNUSED) + const_rtx x ATTRIBUTE_UNUSED) { return false; } @@ -1392,7 +1392,7 @@ expand_expr_stmt (tree exp) (potential) location of the expression. */ int -warn_if_unused_value (tree exp, location_t locus) +warn_if_unused_value (const_tree exp, location_t locus) { restart: if (TREE_USED (exp) || TREE_NO_WARNING (exp)) @@ -1747,7 +1747,7 @@ expand_return (tree retval) *that* node in turn will point to the relevant FUNCTION_DECL node. */ int -is_body_block (tree stmt) +is_body_block (const_tree stmt) { if (lang_hooks.no_body_blocks) return 0; diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index ba0218e..fc33d8e 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -187,7 +187,7 @@ mode_for_size (unsigned int size, enum mode_class class, int limit) /* Similar, except passed a tree node. */ enum machine_mode -mode_for_size_tree (tree size, enum mode_class class, int limit) +mode_for_size_tree (const_tree size, enum mode_class class, int limit) { unsigned HOST_WIDE_INT uhwi; unsigned int ui; diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 8897564..c623a47 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -1295,7 +1295,7 @@ memref_eq (const void *obj1, const void *obj2) { const struct mem_ref *const mem1 = (const struct mem_ref *) obj1; - return operand_equal_p (mem1->mem, (tree) obj2, 0); + return operand_equal_p (mem1->mem, (const_tree) obj2, 0); } /* Gathers memory references in statement STMT in LOOP, storing the diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 2ac0b9e..74c55a3 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -2485,7 +2485,7 @@ var_at_stmt (struct loop *loop, struct iv_cand *cand, tree stmt) but the bit is determined from TYPE_PRECISION, not MODE_BITSIZE. */ int -tree_int_cst_sign_bit (tree t) +tree_int_cst_sign_bit (const_tree t) { unsigned bitno = TYPE_PRECISION (TREE_TYPE (t)) - 1; unsigned HOST_WIDE_INT w; @@ -2213,7 +2213,7 @@ tree_node_structure (const_tree t) or offset that depends on a field within a record. */ bool -contains_placeholder_p (tree exp) +contains_placeholder_p (const_tree exp) { enum tree_code code; @@ -2274,9 +2274,9 @@ contains_placeholder_p (tree exp) { case CALL_EXPR: { - tree arg; - call_expr_arg_iterator iter; - FOR_EACH_CALL_EXPR_ARG (arg, iter, exp) + const_tree arg; + const_call_expr_arg_iterator iter; + FOR_EACH_CONST_CALL_EXPR_ARG (arg, iter, exp) if (CONTAINS_PLACEHOLDER_P (arg)) return 1; return 0; @@ -4787,9 +4787,9 @@ attribute_list_contained (tree l1, tree l2) Also, the TREE_PURPOSEs must match. */ int -type_list_equal (tree l1, tree l2) +type_list_equal (const_tree l1, const_tree l2) { - tree t1, t2; + const_tree t1, t2; for (t1 = l1, t2 = l2; t1 && t2; t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2)) if (TREE_VALUE (t1) != TREE_VALUE (t2) @@ -4972,7 +4972,7 @@ simple_cst_list_equal (const_tree l1, const_tree l2) this function. */ int -simple_cst_equal (tree t1, tree t2) +simple_cst_equal (const_tree t1, const_tree t2) { enum tree_code code1, code2; int cmp; @@ -5043,13 +5043,13 @@ simple_cst_equal (tree t1, tree t2) if (call_expr_nargs (t1) != call_expr_nargs (t2)) return 0; { - tree arg1, arg2; - call_expr_arg_iterator iter1, iter2; - for (arg1 = first_call_expr_arg (t1, &iter1), - arg2 = first_call_expr_arg (t2, &iter2); + const_tree arg1, arg2; + const_call_expr_arg_iterator iter1, iter2; + for (arg1 = first_const_call_expr_arg (t1, &iter1), + arg2 = first_const_call_expr_arg (t2, &iter2); arg1 && arg2; - arg1 = next_call_expr_arg (&iter1), - arg2 = next_call_expr_arg (&iter2)) + arg1 = next_const_call_expr_arg (&iter1), + arg2 = next_const_call_expr_arg (&iter2)) { cmp = simple_cst_equal (arg1, arg2); if (cmp <= 0) @@ -6509,12 +6509,12 @@ decl_type_context (const_tree decl) determined. */ tree -get_callee_fndecl (tree call) +get_callee_fndecl (const_tree call) { tree addr; if (call == error_mark_node) - return call; + return error_mark_node; /* It's invalid to call this function with anything but a CALL_EXPR. */ @@ -8010,7 +8010,7 @@ lower_bound_in_type (tree outer, tree inner) and get the same result, only slower. */ int -operand_equal_for_phi_arg_p (tree arg0, tree arg1) +operand_equal_for_phi_arg_p (const_tree arg0, const_tree arg1) { if (arg0 == arg1) return 1; @@ -3826,10 +3826,10 @@ extern int host_integerp (const_tree, int); extern HOST_WIDE_INT tree_low_cst (const_tree, int); extern int tree_int_cst_msb (const_tree); extern int tree_int_cst_sgn (const_tree); -extern int tree_int_cst_sign_bit (tree); +extern int tree_int_cst_sign_bit (const_tree); extern bool tree_expr_nonnegative_p (tree); extern bool tree_expr_nonnegative_warnv_p (tree, bool *); -extern bool may_negate_without_overflow_p (tree); +extern bool may_negate_without_overflow_p (const_tree); extern tree get_inner_array_type (const_tree); /* From expmed.c. Since rtl.h is included after tree.h, we can't @@ -4068,7 +4068,7 @@ extern void relayout_decl (tree); The value is BLKmode if no other mode is found. This is like mode_for_size, but is passed a tree. */ -extern enum machine_mode mode_for_size_tree (tree, enum mode_class, int); +extern enum machine_mode mode_for_size_tree (const_tree, enum mode_class, int); /* Return an expr equal to X but certainly not valid as an lvalue. */ @@ -4176,10 +4176,10 @@ extern bool initializer_zerop (const_tree); Return whether or not CTOR is a valid static constant initializer, the same as "initializer_constant_valid_p (CTOR, TREE_TYPE (CTOR)) != 0". */ -extern bool categorize_ctor_elements (tree, HOST_WIDE_INT *, HOST_WIDE_INT *, +extern bool categorize_ctor_elements (const_tree, HOST_WIDE_INT *, HOST_WIDE_INT *, bool *); -extern HOST_WIDE_INT count_type_elements (tree, bool); +extern HOST_WIDE_INT count_type_elements (const_tree, bool); /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0. */ @@ -4233,7 +4233,7 @@ enum tree_node_structure_enum tree_node_structure (const_tree); Note that we only allow such expressions within simple arithmetic or a COND_EXPR. */ -extern bool contains_placeholder_p (tree); +extern bool contains_placeholder_p (const_tree); /* This macro calls the above function but short-circuits the common case of a constant to save time. Also check for null. */ @@ -4318,7 +4318,7 @@ extern tree get_inner_reference (tree, HOST_WIDE_INT *, HOST_WIDE_INT *, look for whether EXP or any nested component-refs within EXP is marked as PACKED. */ -extern bool contains_packed_reference (tree exp); +extern bool contains_packed_reference (const_tree exp); /* Return 1 if T is an expression that get_inner_reference handles. */ @@ -4378,14 +4378,14 @@ extern GTY(()) const char * current_function_func_begin_label; extern unsigned crc32_string (unsigned, const char *); extern void clean_symbol_name (char *); extern tree get_file_function_name (const char *); -extern tree get_callee_fndecl (tree); +extern tree get_callee_fndecl (const_tree); extern void change_decl_assembler_name (tree, tree); extern int type_num_arguments (const_tree); extern bool associative_tree_code (enum tree_code); extern bool commutative_tree_code (enum tree_code); extern tree upper_bound_in_type (tree, tree); extern tree lower_bound_in_type (tree, tree); -extern int operand_equal_for_phi_arg_p (tree, tree); +extern int operand_equal_for_phi_arg_p (const_tree, const_tree); extern bool empty_body_p (tree); extern tree call_expr_arg (tree, int); extern tree *call_expr_argp (tree, int); @@ -4394,14 +4394,14 @@ extern tree call_expr_arglist (tree); /* In stmt.c */ extern void expand_expr_stmt (tree); -extern int warn_if_unused_value (tree, location_t); +extern int warn_if_unused_value (const_tree, location_t); extern void expand_label (tree); extern void expand_goto (tree); extern rtx expand_stack_save (void); extern void expand_stack_restore (tree); extern void expand_return (tree); -extern int is_body_block (tree); +extern int is_body_block (const_tree); /* In tree-eh.c */ extern void using_eh_for_cleanups (void); @@ -4413,8 +4413,8 @@ extern void using_eh_for_cleanups (void); extern int folding_initializer; /* Convert between trees and native memory representation. */ -extern int native_encode_expr (tree, unsigned char *, int); -extern tree native_interpret_expr (tree, unsigned char *, int); +extern int native_encode_expr (const_tree, unsigned char *, int); +extern tree native_interpret_expr (tree, const unsigned char *, int); /* Fold constants as much as possible in an expression. Returns the simplified expression. @@ -4437,7 +4437,7 @@ extern tree fold_build2_initializer (enum tree_code, tree, tree, tree); extern tree fold_build3_initializer (enum tree_code, tree, tree, tree, tree); extern tree fold_build_call_array (tree, tree, int, tree *); extern tree fold_build_call_array_initializer (tree, tree, int, tree *); -extern bool fold_convertible_p (tree, tree); +extern bool fold_convertible_p (const_tree, const_tree); extern tree fold_convert (tree, tree); extern tree fold_single_bit_test (enum tree_code, tree, tree, tree); extern tree fold_ignored_result (tree); @@ -4493,7 +4493,7 @@ enum operand_equal_flag OEP_PURE_SAME = 2 }; -extern int operand_equal_p (tree, tree, unsigned int); +extern int operand_equal_p (const_tree, const_tree, unsigned int); extern int multiple_of_p (tree, tree, tree); extern tree omit_one_operand (tree, tree, tree); extern tree omit_two_operands (tree, tree, tree, tree); @@ -4502,7 +4502,7 @@ extern tree fold_truth_not_expr (tree); extern tree fold_unary_to_constant (enum tree_code, tree, tree); extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree); extern tree fold_read_from_constant_string (tree); -extern tree int_const_binop (enum tree_code, tree, tree, int); +extern tree int_const_binop (enum tree_code, const_tree, const_tree, int); extern tree build_fold_addr_expr (tree); extern tree fold_build_cleanup_point_expr (tree type, tree expr); extern tree fold_strip_sign_ops (tree); @@ -4512,7 +4512,7 @@ extern tree fold_indirect_ref (tree); extern tree constant_boolean_node (int, tree); extern tree build_low_bits_mask (tree, unsigned); -extern bool tree_swap_operands_p (tree, tree, bool); +extern bool tree_swap_operands_p (const_tree, const_tree, bool); extern void swap_tree_operands (tree, tree *, tree *); extern enum tree_code swap_tree_comparison (enum tree_code); @@ -4535,7 +4535,7 @@ extern tree fold_builtin_stxcpy_chk (tree, tree, tree, tree, tree, bool, extern tree fold_builtin_strncpy_chk (tree, tree, tree, tree, tree); extern tree fold_builtin_snprintf_chk (tree, tree, enum built_in_function); extern bool fold_builtin_next_arg (tree, bool); -extern enum built_in_function builtin_mathfn_code (tree); +extern enum built_in_function builtin_mathfn_code (const_tree); extern tree build_function_call_expr (tree, tree); extern tree fold_build_call_expr (tree, tree, tree, tree); extern tree fold_builtin_call_array (tree, tree, int, tree *); @@ -4547,7 +4547,7 @@ extern tree c_strlen (tree, int); extern tree std_gimplify_va_arg_expr (tree, tree, tree *, tree *); extern tree build_va_arg_indirect_ref (tree); extern tree build_string_literal (int, const char *); -extern bool validate_arglist (tree, ...); +extern bool validate_arglist (const_tree, ...); extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode); extern int get_pointer_alignment (tree, unsigned int); @@ -4568,10 +4568,10 @@ extern void get_type_static_bounds (tree, mpz_t, mpz_t); extern bool variably_modified_type_p (tree, tree); extern int tree_log2 (const_tree); extern int tree_floor_log2 (const_tree); -extern int simple_cst_equal (tree, tree); +extern int simple_cst_equal (const_tree, const_tree); extern hashval_t iterative_hash_expr (const_tree, hashval_t); extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT); -extern int type_list_equal (tree, tree); +extern int type_list_equal (const_tree, const_tree); extern int chain_member (const_tree, const_tree); extern tree type_hash_lookup (unsigned int, tree); extern void type_hash_add (unsigned int, tree); @@ -4630,7 +4630,7 @@ extern void expand_dummy_function_end (void); extern unsigned int init_function_for_compilation (void); extern void allocate_struct_function (tree); extern void init_function_start (tree); -extern bool use_register_for_decl (tree); +extern bool use_register_for_decl (const_tree); extern void generate_setjmp_warnings (void); extern void init_temp_slots (void); extern void free_temp_slots (void); @@ -4696,7 +4696,7 @@ extern tree build_duplicate_type (tree); #define ECF_NOVOPS 1024 extern int flags_from_decl_or_type (const_tree); -extern int call_expr_flags (tree); +extern int call_expr_flags (const_tree); extern int setjmp_call_p (const_tree); extern bool alloca_call_p (const_tree); @@ -4758,7 +4758,7 @@ extern tree tree_overlaps_hard_reg_set (tree, HARD_REG_SET *); /* In gimplify.c. */ extern tree create_artificial_label (void); extern void gimplify_function_tree (tree); -extern const char *get_name (tree); +extern const char *get_name (const_tree); extern tree unshare_expr (tree); extern void sort_case_labels (tree); @@ -4918,7 +4918,7 @@ extern void fini_object_sizes (void); extern unsigned HOST_WIDE_INT compute_builtin_object_size (tree, int); /* In expr.c. */ -extern unsigned HOST_WIDE_INT highest_pow2_factor (tree); +extern unsigned HOST_WIDE_INT highest_pow2_factor (const_tree); /* In tree-inline.c. */ @@ -4948,6 +4948,13 @@ typedef struct call_expr_arg_iterator_d GTY (()) int i; /* next argument index */ } call_expr_arg_iterator; +typedef struct const_call_expr_arg_iterator_d GTY (()) +{ + const_tree t; /* the call_expr */ + int n; /* argument count */ + int i; /* next argument index */ +} const_call_expr_arg_iterator; + /* Initialize the abstract argument list iterator object ITER with the arguments from CALL_EXPR node EXP. */ static inline void @@ -4958,6 +4965,14 @@ init_call_expr_arg_iterator (tree exp, call_expr_arg_iterator *iter) iter->i = 0; } +static inline void +init_const_call_expr_arg_iterator (const_tree exp, const_call_expr_arg_iterator *iter) +{ + iter->t = exp; + iter->n = call_expr_nargs (exp); + iter->i = 0; +} + /* Return the next argument from abstract argument list iterator object ITER, and advance its state. Return NULL_TREE if there are no more arguments. */ static inline tree @@ -4971,6 +4986,17 @@ next_call_expr_arg (call_expr_arg_iterator *iter) return result; } +static inline const_tree +next_const_call_expr_arg (const_call_expr_arg_iterator *iter) +{ + const_tree result; + if (iter->i >= iter->n) + return NULL_TREE; + result = CALL_EXPR_ARG (iter->t, iter->i); + iter->i++; + return result; +} + /* Initialize the abstract argument list iterator object ITER, then advance past and return the first argument. Useful in for expressions, e.g. for (arg = first_call_expr_arg (exp, &iter); arg; @@ -4982,6 +5008,13 @@ first_call_expr_arg (tree exp, call_expr_arg_iterator *iter) return next_call_expr_arg (iter); } +static inline const_tree +first_const_call_expr_arg (const_tree exp, const_call_expr_arg_iterator *iter) +{ + init_const_call_expr_arg_iterator (exp, iter); + return next_const_call_expr_arg (iter); +} + /* Test whether there are more arguments in abstract argument list iterator ITER, without changing its state. */ static inline bool @@ -4990,6 +5023,11 @@ more_call_expr_args_p (const call_expr_arg_iterator *iter) return (iter->i < iter->n); } +static inline bool +more_const_call_expr_args_p (const const_call_expr_arg_iterator *iter) +{ + return (iter->i < iter->n); +} /* Iterate through each argument ARG of CALL_EXPR CALL, using variable ITER (of type call_expr_arg_iterator) to hold the iteration state. */ @@ -4997,4 +5035,8 @@ more_call_expr_args_p (const call_expr_arg_iterator *iter) for ((arg) = first_call_expr_arg ((call), &(iter)); (arg); \ (arg) = next_call_expr_arg (&(iter))) +#define FOR_EACH_CONST_CALL_EXPR_ARG(arg, iter, call) \ + for ((arg) = first_const_call_expr_arg ((call), &(iter)); (arg); \ + (arg) = next_const_call_expr_arg (&(iter))) + #endif /* GCC_TREE_H */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 530c7ea..a265db8 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4004,7 +4004,7 @@ output_addressed_constants (tree exp) evaluate the property while walking a constructor for other purposes. */ bool -constructor_static_from_elts_p (tree ctor) +constructor_static_from_elts_p (const_tree ctor) { return (TREE_CONSTANT (ctor) && (TREE_CODE (TREE_TYPE (ctor)) == UNION_TYPE |