public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH INSTALLED]: const typedefs part 10/N
@ 2007-07-29  7:37 Kaveh R. GHAZI
  0 siblings, 0 replies; only message in thread
From: Kaveh R. GHAZI @ 2007-07-29  7:37 UTC (permalink / raw)
  To: gcc-patches

Yet more constification.  With this patch, (and the CONST_CAST patch,)
I get only about 20 remaining -Wcast-qual warnings.  If I can get it
down far enough I'd like to add that flag to the bootstrap.

Tested on sparc-sun-solaris2.10, no regressions.  Installed.

		--Kaveh


2007-07-28  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.

cp:
	* 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.

java:
	* lang.c (java_get_callee_fndecl): Constify.

objc:
	* objc-act.c (objc_get_callee_fndecl): Constify.
	* objc-act.h (objc_get_callee_fndecl): Likewise.

diff -rup orig/egcc-SVN20070728/gcc/attribs.c egcc-SVN20070728/gcc/attribs.c
--- orig/egcc-SVN20070728/gcc/attribs.c	2007-07-27 23:01:36.000000000 -0400
+++ egcc-SVN20070728/gcc/attribs.c	2007-07-28 12:03:40.443190469 -0400
@@ -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 -rup orig/egcc-SVN20070728/gcc/builtins.c egcc-SVN20070728/gcc/builtins.c
--- orig/egcc-SVN20070728/gcc/builtins.c	2007-07-26 23:03:36.000000000 -0400
+++ egcc-SVN20070728/gcc/builtins.c	2007-07-28 16:12:00.550273829 -0400
@@ -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, rt
    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, t
    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 c
    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 -rup orig/egcc-SVN20070728/gcc/calls.c egcc-SVN20070728/gcc/calls.c
--- orig/egcc-SVN20070728/gcc/calls.c	2007-07-28 10:58:13.000000000 -0400
+++ egcc-SVN20070728/gcc/calls.c	2007-07-28 14:09:17.949165254 -0400
@@ -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 -rup orig/egcc-SVN20070728/gcc/combine.c egcc-SVN20070728/gcc/combine.c
--- orig/egcc-SVN20070728/gcc/combine.c	2007-07-26 23:04:08.000000000 -0400
+++ egcc-SVN20070728/gcc/combine.c	2007-07-28 13:20:06.658667970 -0400
@@ -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,
 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 mach
    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, enu
    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 sub
    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 i
    is known longer known reliably.  */

 static rtx
-get_last_value (rtx x)
+get_last_value (const_rtx x)
 {
   unsigned int regno;
   rtx value;
diff -rup orig/egcc-SVN20070728/gcc/cp/parser.c egcc-SVN20070728/gcc/cp/parser.c
--- orig/egcc-SVN20070728/gcc/cp/parser.c	2007-07-28 11:39:48.948610921 -0400
+++ egcc-SVN20070728/gcc/cp/parser.c	2007-07-28 11:39:46.318408233 -0400
@@ -98,7 +98,7 @@ typedef struct cp_token *cp_token_positi
 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
   /* 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
       ++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 -rup orig/egcc-SVN20070728/gcc/emit-rtl.c egcc-SVN20070728/gcc/emit-rtl.c
--- orig/egcc-SVN20070728/gcc/emit-rtl.c	2007-07-26 23:03:59.000000000 -0400
+++ egcc-SVN20070728/gcc/emit-rtl.c	2007-07-28 13:21:02.686184137 -0400
@@ -1283,7 +1283,7 @@ subreg_highpart_offset (enum machine_mod
    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;
diff -rup orig/egcc-SVN20070728/gcc/expr.c egcc-SVN20070728/gcc/expr.c
--- orig/egcc-SVN20070728/gcc/expr.c	2007-07-26 23:03:49.000000000 -0400
+++ egcc-SVN20070728/gcc/expr.c	2007-07-28 16:06:21.500158599 -0400
@@ -144,7 +144,7 @@ static void store_constructor (tree, rtx
 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 ca
 /* 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, H
    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, HOS
    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
    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 -rup orig/egcc-SVN20070728/gcc/fold-const.c egcc-SVN20070728/gcc/fold-const.c
--- orig/egcc-SVN20070728/gcc/fold-const.c	2007-07-26 23:03:39.000000000 -0400
+++ egcc-SVN20070728/gcc/fold-const.c	2007-07-28 15:53:51.933592797 -0400
@@ -1074,7 +1074,7 @@ negate_mathfn_p (enum built_in_function
    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
    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, u

 	  /* 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;

@@ -6714,7 +6714,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);
@@ -7209,7 +7209,7 @@ fold_plusminus_mult_expr (enum tree_code
    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));
@@ -7254,7 +7254,7 @@ native_encode_int (tree expr, unsigned c
    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));
@@ -7302,7 +7302,7 @@ native_encode_real (tree expr, unsigned
    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;
@@ -7325,7 +7325,7 @@ native_encode_complex (tree expr, unsign
    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;
@@ -7368,7 +7368,7 @@ native_encode_vector (tree expr, unsigne
    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))
     {
@@ -7395,7 +7395,7 @@ native_encode_expr (tree expr, unsigned
    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;
@@ -7443,7 +7443,7 @@ native_interpret_int (tree type, unsigne
    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);
@@ -7493,7 +7493,7 @@ native_interpret_real (tree type, unsign
    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;
@@ -7517,7 +7517,7 @@ native_interpret_complex (tree type, uns
    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;
@@ -7547,7 +7547,7 @@ native_interpret_vector (tree type, unsi
    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 -rup orig/egcc-SVN20070728/gcc/function.c egcc-SVN20070728/gcc/function.c
--- orig/egcc-SVN20070728/gcc/function.c	2007-07-26 23:03:53.000000000 -0400
+++ egcc-SVN20070728/gcc/function.c	2007-07-28 15:59:38.107068104 -0400
@@ -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 -rup orig/egcc-SVN20070728/gcc/gimplify.c egcc-SVN20070728/gcc/gimplify.c
--- orig/egcc-SVN20070728/gcc/gimplify.c	2007-07-26 23:03:57.000000000 -0400
+++ egcc-SVN20070728/gcc/gimplify.c	2007-07-28 16:10:25.840459081 -0400
@@ -505,9 +505,9 @@ create_tmp_var (tree type, const char *p
     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 -rup orig/egcc-SVN20070728/gcc/java/lang.c egcc-SVN20070728/gcc/java/lang.c
--- orig/egcc-SVN20070728/gcc/java/lang.c	2007-07-26 23:02:12.000000000 -0400
+++ egcc-SVN20070728/gcc/java/lang.c	2007-07-28 14:16:16.091098391 -0400
@@ -63,7 +63,7 @@ static int inline_init_test_initializati
 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 -rup orig/egcc-SVN20070728/gcc/langhooks-def.h egcc-SVN20070728/gcc/langhooks-def.h
--- orig/egcc-SVN20070728/gcc/langhooks-def.h	2007-07-26 23:04:14.000000000 -0400
+++ egcc-SVN20070728/gcc/langhooks-def.h	2007-07-28 14:13:08.872288792 -0400
@@ -43,6 +43,7 @@ extern HOST_WIDE_INT lhd_get_alias_set (
 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_
 #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 -rup orig/egcc-SVN20070728/gcc/langhooks.c egcc-SVN20070728/gcc/langhooks.c
--- orig/egcc-SVN20070728/gcc/langhooks.c	2007-07-26 23:03:52.000000000 -0400
+++ egcc-SVN20070728/gcc/langhooks.c	2007-07-28 14:12:24.787204873 -0400
@@ -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 -rup orig/egcc-SVN20070728/gcc/langhooks.h egcc-SVN20070728/gcc/langhooks.h
--- orig/egcc-SVN20070728/gcc/langhooks.h	2007-07-26 23:03:54.000000000 -0400
+++ egcc-SVN20070728/gcc/langhooks.h	2007-07-28 14:13:13.525019196 -0400
@@ -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 -rup orig/egcc-SVN20070728/gcc/objc/objc-act.c egcc-SVN20070728/gcc/objc/objc-act.c
--- orig/egcc-SVN20070728/gcc/objc/objc-act.c	2007-07-25 15:13:19.000000000 -0400
+++ egcc-SVN20070728/gcc/objc/objc-act.c	2007-07-28 14:14:19.661435646 -0400
@@ -9512,7 +9512,7 @@ objc_gimplify_expr (tree *expr_p, tree *
    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 -rup orig/egcc-SVN20070728/gcc/objc/objc-act.h egcc-SVN20070728/gcc/objc/objc-act.h
--- orig/egcc-SVN20070728/gcc/objc/objc-act.h	2006-01-22 23:26:04.000000000 -0500
+++ egcc-SVN20070728/gcc/objc/objc-act.h	2007-07-28 14:14:21.836182775 -0400
@@ -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 -rup orig/egcc-SVN20070728/gcc/output.h egcc-SVN20070728/gcc/output.h
--- orig/egcc-SVN20070728/gcc/output.h	2007-07-26 23:04:07.000000000 -0400
+++ egcc-SVN20070728/gcc/output.h	2007-07-28 15:25:56.889500626 -0400
@@ -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 -rup orig/egcc-SVN20070728/gcc/rtl-factoring.c egcc-SVN20070728/gcc/rtl-factoring.c
--- orig/egcc-SVN20070728/gcc/rtl-factoring.c	2007-07-26 23:03:58.000000000 -0400
+++ egcc-SVN20070728/gcc/rtl-factoring.c	2007-07-28 11:16:41.093230403 -0400
@@ -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;
diff -rup orig/egcc-SVN20070728/gcc/rtl.h egcc-SVN20070728/gcc/rtl.h
--- orig/egcc-SVN20070728/gcc/rtl.h	2007-07-26 23:04:05.000000000 -0400
+++ egcc-SVN20070728/gcc/rtl.h	2007-07-28 13:21:10.782510743 -0400
@@ -1044,10 +1044,10 @@ extern bool subreg_offset_representable_
 					   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, unsigne

 /* 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 -rup orig/egcc-SVN20070728/gcc/rtlanal.c egcc-SVN20070728/gcc/rtlanal.c
--- orig/egcc-SVN20070728/gcc/rtlanal.c	2007-07-26 23:03:32.000000000 -0400
+++ egcc-SVN20070728/gcc/rtlanal.c	2007-07-28 13:14:28.480329062 -0400
@@ -62,16 +62,16 @@ static void subreg_get_info (unsigned in
 			     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
    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
    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
    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
    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 -rup orig/egcc-SVN20070728/gcc/rtlhooks-def.h egcc-SVN20070728/gcc/rtlhooks-def.h
--- orig/egcc-SVN20070728/gcc/rtlhooks-def.h	2007-07-26 23:03:55.000000000 -0400
+++ egcc-SVN20070728/gcc/rtlhooks-def.h	2007-07-28 13:15:55.924332637 -0400
@@ -39,13 +39,13 @@ along with GCC; see the file COPYING3.

 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 -rup orig/egcc-SVN20070728/gcc/rtlhooks.c egcc-SVN20070728/gcc/rtlhooks.c
--- orig/egcc-SVN20070728/gcc/rtlhooks.c	2007-07-26 23:03:29.000000000 -0400
+++ egcc-SVN20070728/gcc/rtlhooks.c	2007-07-28 13:16:14.009654634 -0400
@@ -95,9 +95,9 @@ gen_lowpart_no_emit_general (enum machin
 }

 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 A
 }

 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 ATTRIBUT

 bool
 reg_truncated_to_mode_general (enum machine_mode mode ATTRIBUTE_UNUSED,
-			       rtx x ATTRIBUTE_UNUSED)
+			       const_rtx x ATTRIBUTE_UNUSED)
 {
   return false;
 }
diff -rup orig/egcc-SVN20070728/gcc/stmt.c egcc-SVN20070728/gcc/stmt.c
--- orig/egcc-SVN20070728/gcc/stmt.c	2007-07-26 23:04:13.000000000 -0400
+++ egcc-SVN20070728/gcc/stmt.c	2007-07-28 15:47:41.223929627 -0400
@@ -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 -rup orig/egcc-SVN20070728/gcc/stor-layout.c egcc-SVN20070728/gcc/stor-layout.c
--- orig/egcc-SVN20070728/gcc/stor-layout.c	2007-07-26 23:03:55.000000000 -0400
+++ egcc-SVN20070728/gcc/stor-layout.c	2007-07-28 16:07:15.067863730 -0400
@@ -187,7 +187,7 @@ mode_for_size (unsigned int size, enum m
 /* 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 -rup orig/egcc-SVN20070728/gcc/tree-ssa-loop-im.c egcc-SVN20070728/gcc/tree-ssa-loop-im.c
--- orig/egcc-SVN20070728/gcc/tree-ssa-loop-im.c	2007-07-26 23:03:28.000000000 -0400
+++ egcc-SVN20070728/gcc/tree-ssa-loop-im.c	2007-07-28 14:21:24.940621482 -0400
@@ -1295,7 +1295,7 @@ memref_eq (const void *obj1, const void
 {
   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 -rup orig/egcc-SVN20070728/gcc/tree-ssa-loop-ivopts.c egcc-SVN20070728/gcc/tree-ssa-loop-ivopts.c
--- orig/egcc-SVN20070728/gcc/tree-ssa-loop-ivopts.c	2007-07-26 23:03:44.000000000 -0400
+++ egcc-SVN20070728/gcc/tree-ssa-loop-ivopts.c	2007-07-28 15:45:13.456406918 -0400
@@ -2485,7 +2485,7 @@ var_at_stmt (struct loop *loop, struct i
    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;
diff -rup orig/egcc-SVN20070728/gcc/tree.c egcc-SVN20070728/gcc/tree.c
--- orig/egcc-SVN20070728/gcc/tree.c	2007-07-28 11:39:48.983789056 -0400
+++ egcc-SVN20070728/gcc/tree.c	2007-07-28 15:29:18.170180938 -0400
@@ -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
    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, co
    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 in
    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;
diff -rup orig/egcc-SVN20070728/gcc/tree.h egcc-SVN20070728/gcc/tree.h
--- orig/egcc-SVN20070728/gcc/tree.h	2007-07-28 10:58:09.000000000 -0400
+++ egcc-SVN20070728/gcc/tree.h	2007-07-28 16:10:12.503810014 -0400
@@ -3826,10 +3826,10 @@ extern int host_integerp (const_tree, in
 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_tre
    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_
    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, H
    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_func
 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 (enu
 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 (tre
 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
 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 (v
 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 (
 /* 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
   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, c
   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_iterat
   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
   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_a
   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_a
   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 -rup orig/egcc-SVN20070728/gcc/varasm.c egcc-SVN20070728/gcc/varasm.c
--- orig/egcc-SVN20070728/gcc/varasm.c	2007-07-26 23:04:04.000000000 -0400
+++ egcc-SVN20070728/gcc/varasm.c	2007-07-28 15:25:45.396896331 -0400
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-29  5:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-29  7:37 [PATCH INSTALLED]: const typedefs part 10/N Kaveh R. GHAZI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).