[PATCH INSTALLED]: const typedefs part 19/N

Kaveh R. GHAZI ghazi@caip.rutgers.edu
Mon Aug 27 05:22:00 GMT 2007


This patch constifies cfg_hooks and debug_hooks, plus a bunch of of other
random predicates.

Bootstrapped on sparc-sun-solaris2.10, no regressions.  I also ran my
cross-compile farm to check platforms with other debug-types activating
different debugging code in the various *out.c files.  I didn't see any
relevant warnings from building cc1 to those targets.

Installed on mainline.

		--Kaveh



2007-08-26  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* alias.c (memory_modified_1, memory_modified_in_insn_p):
	Constify.
	* basic-block.h (tree_predicted_by_p, rtl_predicted_by_p):
	Likewise.
	* bb-reorder.c (copy_bb_p): Likewise.
	* cfghooks.c (can_remove_branch_p, can_merge_blocks_p,
	predicted_by_p, can_duplicate_block_p, block_ends_with_call_p,
	block_ends_with_condjump_p): Likewise.
	* cfghooks.h (can_remove_branch_p, can_merge_blocks_p,
	predicted_by_p, can_duplicate_block_p, block_ends_with_call_p,
	block_ends_with_condjump_p): Likewise.
	* cfglayout.c (cfg_layout_can_duplicate_bb_p): Likewise.
	* cfgrtl.c (can_delete_note_p, can_delete_label_p,
	rtl_can_merge_blocks, cfg_layout_can_merge_blocks_p,
	rtl_block_ends_with_call_p, rtl_block_ends_with_condjump_p,
	need_fake_edge_p, rtl_can_remove_branch_p): Likewise.
	* dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Use
	debug_true_const_tree instad of debug_true_tree.
	* debug.c (do_nothing_debug_hooks): Likewise.
	* debug.h (ignore_block, debug_true_const_tree): Constify.
	* dwarf2out.c (stack_adjust_offset, clobbers_queued_reg_save,
	dwarf2out_ignore_block, is_pseudo_reg, is_tagged_type,
	decl_ultimate_origin, block_ultimate_origin, lookup_decl_loc,
	same_dw_val_p, add_ranges, is_subrange_type, type_is_enum,
	dbx_reg_number, is_based_loc, field_type,
	simple_type_align_in_bits, simple_decl_align_in_bits,
	simple_type_size_in_bits, field_byte_offset, insert_float,
	type_tag, member_declared_type, is_redundant_typedef,
	secname_for_decl, is_inlined_entry_point): Likewise.
	* emit-rtl.c (const_next_insn, const_previous_insn,
	const_next_nonnote_insn, const_prev_nonnote_insn,
	const_next_real_insn, const_prev_real_insn,
	const_next_active_insn, const_prev_active_insn, const_next_label,
	const_prev_label): Likewise.
	* except.h (lookup_stmt_eh_region_fn, lookup_stmt_eh_region):
	Likewise.
	* haifa-sched.c (may_trap_exp, haifa_classify_insn,
	find_set_reg_weight, no_real_insns_p, find_set_reg_weight,
	sched_insn_is_legitimate_for_speculation_p): Likewise.
	* jump.c (reversed_comparison_code_parts,
	reversed_comparison_code, reversed_comparison, condjump_label):
	Likewise.
	* predict.c (rtl_predicted_by_p, tree_predicted_by_p): Likewise.
	* reg-stack.c (stack_regs_mentioned_p, stack_regs_mentioned):
	Likewise.
	* rtl.h (const_previous_insn, const_next_insn,
	const_prev_nonnote_insn, const_next_nonnote_insn,
	const_prev_real_insn, const_next_real_insn,
	const_prev_active_insn, const_next_active_insn, const_prev_label,
	const_next_label, modified_between_p, modified_in_p,
	const_note_storeskeep_with_call_p, condjump_label,
	reversed_comparison, reversed_comparison_code,
	reversed_comparison_code_parts, memory_modified_in_insn_p,
	stack_regs_mentioned): Likewise.
	* rtlanal.c (modified_between_p, modified_in_p, const_note_stores,
	keep_with_call_p): Likewise.
	* sched-deps.c (deps_may_trap_p, sched_get_condition,
	conditions_mutex_p, sched_insns_conditions_mutex_psd_next_list,
	sd_lists_size, sd_lists_empty_p): Likewise.
	* sched-int.h (sched_insns_conditions_mutex_p,
	haifa_classify_insn, no_real_insns_p,
	sched_insn_is_legitimate_for_speculation_p, sd_next_list,
	sd_lists_size, sd_lists_empty_p): Likewise.
	* sdbout.c (sdb_debug_hooks): Likewise.
	* tree-cfg.c (tree_can_merge_blocks_p, is_ctrl_altering_stmt,
	stmt_ends_bb_p, tree_can_remove_branch_p, tree_can_duplicate_bb_p,
	-tree_block_ends_with_call_p, tree_block_ends_with_condjump_p):
	Likewise.
	* tree-eh.c (lookup_stmt_eh_region_fn, lookup_stmt_eh_region,
	tree_can_throw_internal): Likewise.
	* tree-flow-inline.h (phi_nodes): Likewise.
	* tree-flow.h (phi_nodesstmt_ends_bb_p, is_ctrl_altering_stmt,
	tree_can_throw_internal, lookup_stmt_eh_region): Likewise.
	* tree-gimple.c (const_get_call_expr_in): Likewise.
	* tree-gimple.h (const_get_call_expr_in): Likewise.
	* tree.c (const_lookup_attribute, attribute_list_equal,
	attribute_list_contained): Likewise.
	* tree.h (attribute_list_equal, attribute_list_contained,
	const_lookup_attribute): Likewise.
	* vmsdbgout.c (vmsdbgout_ignore_block): Likewise.

diff -rup orig/egcc-SVN20070825/gcc/alias.c egcc-SVN20070825/gcc/alias.c
--- orig/egcc-SVN20070825/gcc/alias.c	2007-08-23 12:12:27.000000000 -0400
+++ egcc-SVN20070825/gcc/alias.c	2007-08-25 15:53:27.444490338 -0400
@@ -167,7 +167,7 @@ static rtx adjust_offset_for_component_r
 static int nonoverlapping_memrefs_p (const_rtx, const_rtx);
 static int write_dependence_p (const_rtx, const_rtx, int);

-static void memory_modified_1 (rtx, const_rtx, void *);
+static void memory_modified_1 (const_rtx, const_rtx, const void *);
 static void record_alias_subset (alias_set_type, alias_set_type);

 /* Set up all info needed to perform alias analysis on memory references.  */
@@ -2354,11 +2354,11 @@ init_alias_once (void)
    to be memory reference.  */
 static bool memory_modified;
 static void
-memory_modified_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
+memory_modified_1 (const_rtx x, const_rtx pat ATTRIBUTE_UNUSED, const void *data)
 {
   if (MEM_P (x))
     {
-      if (anti_dependence (x, (rtx)data) || output_dependence (x, (rtx)data))
+      if (anti_dependence (x, (const_rtx)data) || output_dependence (x, (const_rtx)data))
 	memory_modified = true;
     }
 }
@@ -2367,12 +2367,12 @@ memory_modified_1 (rtx x, const_rtx pat
 /* Return true when INSN possibly modify memory contents of MEM
    (i.e. address can be modified).  */
 bool
-memory_modified_in_insn_p (rtx mem, rtx insn)
+memory_modified_in_insn_p (const_rtx mem, const_rtx insn)
 {
   if (!INSN_P (insn))
     return false;
   memory_modified = false;
-  note_stores (PATTERN (insn), memory_modified_1, mem);
+  const_note_stores (PATTERN (insn), memory_modified_1, mem);
   return memory_modified;
 }

diff -rup orig/egcc-SVN20070825/gcc/basic-block.h egcc-SVN20070825/gcc/basic-block.h
--- orig/egcc-SVN20070825/gcc/basic-block.h	2007-08-14 01:01:51.000000000 -0400
+++ egcc-SVN20070825/gcc/basic-block.h	2007-08-25 13:28:55.871340138 -0400
@@ -830,8 +830,8 @@ extern void compute_available (sbitmap *
 extern bool maybe_hot_bb_p (const_basic_block);
 extern bool probably_cold_bb_p (const_basic_block);
 extern bool probably_never_executed_bb_p (const_basic_block);
-extern bool tree_predicted_by_p (basic_block, enum br_predictor);
-extern bool rtl_predicted_by_p (basic_block, enum br_predictor);
+extern bool tree_predicted_by_p (const_basic_block, enum br_predictor);
+extern bool rtl_predicted_by_p (const_basic_block, enum br_predictor);
 extern void tree_predict_edge (edge, enum br_predictor, int);
 extern void rtl_predict_edge (edge, enum br_predictor, int);
 extern void predict_edge_def (edge, enum br_predictor, enum prediction);
diff -rup orig/egcc-SVN20070825/gcc/bb-reorder.c egcc-SVN20070825/gcc/bb-reorder.c
--- orig/egcc-SVN20070825/gcc/bb-reorder.c	2007-08-14 01:01:48.000000000 -0400
+++ egcc-SVN20070825/gcc/bb-reorder.c	2007-08-25 13:48:05.253514060 -0400
@@ -176,7 +176,7 @@ static basic_block copy_bb (basic_block,
 static fibheapkey_t bb_to_key (basic_block);
 static bool better_edge_p (const_basic_block, const_edge, int, int, int, int, const_edge);
 static void connect_traces (int, struct trace *);
-static bool copy_bb_p (basic_block, int);
+static bool copy_bb_p (const_basic_block, int);
 static int get_uncond_jump_length (void);
 static bool push_to_next_round_p (const_basic_block, int, int, int, gcov_type);
 static void find_rarely_executed_basic_blocks_and_crossing_edges (edge **,
@@ -1156,7 +1156,7 @@ connect_traces (int n_traces, struct tra
    when code size is allowed to grow by duplication.  */

 static bool
-copy_bb_p (basic_block bb, int code_may_grow)
+copy_bb_p (const_basic_block bb, int code_may_grow)
 {
   int size = 0;
   int max_size = uncond_jump_length;
diff -rup orig/egcc-SVN20070825/gcc/cfghooks.c egcc-SVN20070825/gcc/cfghooks.c
--- orig/egcc-SVN20070825/gcc/cfghooks.c	2007-07-26 23:03:39.000000000 -0400
+++ egcc-SVN20070825/gcc/cfghooks.c	2007-08-25 13:43:28.874649100 -0400
@@ -321,7 +321,7 @@ redirect_edge_and_branch (edge e, basic_
    to the destination of the other edge going from its source.  */

 bool
-can_remove_branch_p (edge e)
+can_remove_branch_p (const_edge e)
 {
   if (!cfg_hooks->can_remove_branch_p)
     internal_error ("%s does not support can_remove_branch_p",
@@ -616,7 +616,7 @@ create_empty_bb (basic_block after)
 /* Checks whether we may merge blocks BB1 and BB2.  */

 bool
-can_merge_blocks_p (basic_block bb1, basic_block bb2)
+can_merge_blocks_p (const_basic_block bb1, const_basic_block bb2)
 {
   bool ret;

@@ -638,7 +638,7 @@ predict_edge (edge e, enum br_predictor
 }

 bool
-predicted_by_p (basic_block bb, enum br_predictor predictor)
+predicted_by_p (const_basic_block bb, enum br_predictor predictor)
 {
   if (!cfg_hooks->predict_edge)
     internal_error ("%s does not support predicted_by_p", cfg_hooks->name);
@@ -839,7 +839,7 @@ tidy_fallthru_edges (void)
 /* Returns true if we can duplicate basic block BB.  */

 bool
-can_duplicate_block_p (basic_block bb)
+can_duplicate_block_p (const_basic_block bb)
 {
   if (!cfg_hooks->can_duplicate_block_p)
     internal_error ("%s does not support can_duplicate_block_p",
@@ -938,7 +938,7 @@ duplicate_block (basic_block bb, edge e,
    instructions that must stay with the call, 0 otherwise.  */

 bool
-block_ends_with_call_p (basic_block bb)
+block_ends_with_call_p (const_basic_block bb)
 {
   if (!cfg_hooks->block_ends_with_call_p)
     internal_error ("%s does not support block_ends_with_call_p", cfg_hooks->name);
@@ -949,7 +949,7 @@ block_ends_with_call_p (basic_block bb)
 /* Return 1 if BB ends with a conditional branch, 0 otherwise.  */

 bool
-block_ends_with_condjump_p (basic_block bb)
+block_ends_with_condjump_p (const_basic_block bb)
 {
   if (!cfg_hooks->block_ends_with_condjump_p)
     internal_error ("%s does not support block_ends_with_condjump_p",
diff -rup orig/egcc-SVN20070825/gcc/cfghooks.h egcc-SVN20070825/gcc/cfghooks.h
--- orig/egcc-SVN20070825/gcc/cfghooks.h	2007-07-26 23:03:39.000000000 -0400
+++ egcc-SVN20070825/gcc/cfghooks.h	2007-08-25 13:43:07.006060248 -0400
@@ -48,7 +48,7 @@ struct cfg_hooks

   /* Returns true if it is possible to remove the edge by redirecting it
      to the destination of the other edge going from its source.  */
-  bool (*can_remove_branch_p) (edge);
+  bool (*can_remove_branch_p) (const_edge);

   /* Remove statements corresponding to a given basic block.  */
   void (*delete_basic_block) (basic_block);
@@ -61,7 +61,7 @@ struct cfg_hooks
   bool (*move_block_after) (basic_block b, basic_block a);

   /* Return true when blocks A and B can be merged into single basic block.  */
-  bool (*can_merge_blocks_p) (basic_block a, basic_block b);
+  bool (*can_merge_blocks_p) (const_basic_block a, const_basic_block b);

   /* Merge blocks A and B.  */
   void (*merge_blocks) (basic_block a, basic_block b);
@@ -71,10 +71,10 @@ struct cfg_hooks

   /* Return true if the one of outgoing edges is already predicted by
      PREDICTOR.  */
-  bool (*predicted_by_p) (basic_block bb, enum br_predictor predictor);
+  bool (*predicted_by_p) (const_basic_block bb, enum br_predictor predictor);

   /* Return true when block A can be duplicated.  */
-  bool (*can_duplicate_block_p) (basic_block a);
+  bool (*can_duplicate_block_p) (const_basic_block a);

   /* Duplicate block A.  */
   basic_block (*duplicate_block) (basic_block a);
@@ -89,11 +89,11 @@ struct cfg_hooks

   /* Say whether a block ends with a call, possibly followed by some
      other code that must stay with the call.  */
-  bool (*block_ends_with_call_p) (basic_block);
+  bool (*block_ends_with_call_p) (const_basic_block);

   /* Say whether a block ends with a conditional branch.  Switches
      and unconditional branches do not qualify.  */
-  bool (*block_ends_with_condjump_p) (basic_block);
+  bool (*block_ends_with_condjump_p) (const_basic_block);

   /* Add fake edges to the function exit for any non constant and non noreturn
      calls, volatile inline assembly in the bitmap of blocks specified by
@@ -141,7 +141,7 @@ extern void verify_flow_info (void);
 extern void dump_bb (basic_block, FILE *, int);
 extern edge redirect_edge_and_branch (edge, basic_block);
 extern basic_block redirect_edge_and_branch_force (edge, basic_block);
-extern bool can_remove_branch_p (edge);
+extern bool can_remove_branch_p (const_edge);
 extern void remove_branch (edge);
 extern void remove_edge (edge);
 extern edge split_block (basic_block, void *);
@@ -151,18 +151,18 @@ extern void delete_basic_block (basic_bl
 extern basic_block split_edge (edge);
 extern basic_block create_basic_block (void *, void *, basic_block);
 extern basic_block create_empty_bb (basic_block);
-extern bool can_merge_blocks_p (basic_block, basic_block);
+extern bool can_merge_blocks_p (const_basic_block, const_basic_block);
 extern void merge_blocks (basic_block, basic_block);
 extern edge make_forwarder_block (basic_block, bool (*)(edge),
 				  void (*) (basic_block));
 extern void tidy_fallthru_edge (edge);
 extern void tidy_fallthru_edges (void);
 extern void predict_edge (edge e, enum br_predictor predictor, int probability);
-extern bool predicted_by_p (basic_block bb, enum br_predictor predictor);
-extern bool can_duplicate_block_p (basic_block);
+extern bool predicted_by_p (const_basic_block bb, enum br_predictor predictor);
+extern bool can_duplicate_block_p (const_basic_block);
 extern basic_block duplicate_block (basic_block, edge, basic_block);
-extern bool block_ends_with_call_p (basic_block bb);
-extern bool block_ends_with_condjump_p (basic_block bb);
+extern bool block_ends_with_call_p (const_basic_block bb);
+extern bool block_ends_with_condjump_p (const_basic_block bb);
 extern int flow_call_edges_add (sbitmap);
 extern void execute_on_growing_pred (edge);
 extern void execute_on_shrinking_pred (edge);
diff -rup orig/egcc-SVN20070825/gcc/cfglayout.c egcc-SVN20070825/gcc/cfglayout.c
--- orig/egcc-SVN20070825/gcc/cfglayout.c	2007-07-28 23:02:58.000000000 -0400
+++ egcc-SVN20070825/gcc/cfglayout.c	2007-08-25 13:32:32.542100628 -0400
@@ -1019,10 +1019,10 @@ force_one_exit_fallthru (void)
    only be used through the cfghooks interface, and we do not want to move
    it to cfgrtl.c since it would require also moving quite a lot of related
    code.  */
-extern bool cfg_layout_can_duplicate_bb_p (basic_block);
+extern bool cfg_layout_can_duplicate_bb_p (const_basic_block);

 bool
-cfg_layout_can_duplicate_bb_p (basic_block bb)
+cfg_layout_can_duplicate_bb_p (const_basic_block bb)
 {
   /* Do not attempt to duplicate tablejumps, as we need to unshare
      the dispatch table.  This is difficult to do, as the instructions
diff -rup orig/egcc-SVN20070825/gcc/cfgrtl.c egcc-SVN20070825/gcc/cfgrtl.c
--- orig/egcc-SVN20070825/gcc/cfgrtl.c	2007-08-14 11:34:24.000000000 -0400
+++ egcc-SVN20070825/gcc/cfgrtl.c	2007-08-25 14:02:33.230824273 -0400
@@ -62,8 +62,8 @@ along with GCC; see the file COPYING3.
 #include "tree-pass.h"
 #include "df.h"

-static int can_delete_note_p (rtx);
-static int can_delete_label_p (rtx);
+static int can_delete_note_p (const_rtx);
+static int can_delete_label_p (const_rtx);
 static void commit_one_edge_insertion (edge);
 static basic_block rtl_split_edge (edge);
 static bool rtl_move_block_after (basic_block, basic_block);
@@ -84,7 +84,7 @@ static void rtl_make_forwarder_block (ed
    so that we may simply delete it.  */

 static int
-can_delete_note_p (rtx note)
+can_delete_note_p (const_rtx note)
 {
   return (NOTE_KIND (note) == NOTE_INSN_DELETED
 	  || NOTE_KIND (note) == NOTE_INSN_BASIC_BLOCK);
@@ -93,7 +93,7 @@ can_delete_note_p (rtx note)
 /* True if a given label can be deleted.  */

 static int
-can_delete_label_p (rtx label)
+can_delete_label_p (const_rtx label)
 {
   return (!LABEL_PRESERVE_P (label)
 	  /* User declared labels must be preserved.  */
@@ -625,7 +625,8 @@ rtl_merge_blocks (basic_block a, basic_b

 /* Return true when block A and B can be merged.  */
 static bool
-rtl_can_merge_blocks (basic_block a,basic_block b)
+
+rtl_can_merge_blocks (const_basic_block a, const_basic_block b)
 {
   /* If we are partitioning hot/cold basic blocks, we don't want to
      mess up unconditional or indirect jumps that cross between hot
@@ -2530,7 +2531,7 @@ cfg_layout_delete_block (basic_block bb)

 /* Return true when blocks A and B can be safely merged.  */
 static bool
-cfg_layout_can_merge_blocks_p (basic_block a, basic_block b)
+cfg_layout_can_merge_blocks_p (const_basic_block a, const_basic_block b)
 {
   /* If we are partitioning hot/cold basic blocks, we don't want to
      mess up unconditional or indirect jumps that cross between hot
@@ -2686,7 +2687,7 @@ rtl_make_forwarder_block (edge fallthru
    instructions that must stay with the call, 0 otherwise.  */

 static bool
-rtl_block_ends_with_call_p (basic_block bb)
+rtl_block_ends_with_call_p (const_basic_block bb)
 {
   rtx insn = BB_END (bb);

@@ -2700,7 +2701,7 @@ rtl_block_ends_with_call_p (basic_block
 /* Return 1 if BB ends with a conditional branch, 0 otherwise.  */

 static bool
-rtl_block_ends_with_condjump_p (basic_block bb)
+rtl_block_ends_with_condjump_p (const_basic_block bb)
 {
   return any_condjump_p (BB_END (bb));
 }
@@ -2709,7 +2710,7 @@ rtl_block_ends_with_condjump_p (basic_bl
    Helper function for rtl_flow_call_edges_add.  */

 static bool
-need_fake_edge_p (rtx insn)
+need_fake_edge_p (const_rtx insn)
 {
   if (!INSN_P (insn))
     return false;
@@ -3012,11 +3013,11 @@ insert_insn_end_bb_new (rtx pat, basic_b
    it to the destination of the other edge from E->src.  */

 static bool
-rtl_can_remove_branch_p (edge e)
+rtl_can_remove_branch_p (const_edge e)
 {
-  basic_block src = e->src;
-  basic_block target = EDGE_SUCC (src, EDGE_SUCC (src, 0) == e)->dest;
-  rtx insn = BB_END (src), set;
+  const_basic_block src = e->src;
+  const_basic_block target = EDGE_SUCC (src, EDGE_SUCC (src, 0) == e)->dest;
+  const_rtx insn = BB_END (src), set;

   /* The conditions are taken from try_redirect_by_replacing_jump.  */
   if (target == EXIT_BLOCK_PTR)
@@ -3082,7 +3083,7 @@ struct cfg_hooks rtl_cfg_hooks = {
    should only be used through the cfghooks interface, and we do not want to
    move them here since it would require also moving quite a lot of related
    code.  They are in cfglayout.c.  */
-extern bool cfg_layout_can_duplicate_bb_p (basic_block);
+extern bool cfg_layout_can_duplicate_bb_p (const_basic_block);
 extern basic_block cfg_layout_duplicate_bb (basic_block);

 struct cfg_hooks cfg_layout_rtl_cfg_hooks = {
diff -rup orig/egcc-SVN20070825/gcc/dbxout.c egcc-SVN20070825/gcc/dbxout.c
--- orig/egcc-SVN20070825/gcc/dbxout.c	2007-08-18 20:02:30.000000000 -0400
+++ egcc-SVN20070825/gcc/dbxout.c	2007-08-25 17:29:35.109917407 -0400
@@ -353,7 +353,7 @@ const struct gcc_debug_hooks dbx_debug_h
   dbxout_end_source_file,
   dbxout_begin_block,
   dbxout_end_block,
-  debug_true_tree,		         /* ignore_block */
+  debug_true_const_tree,	         /* ignore_block */
   dbxout_source_line,		         /* source_line */
   dbxout_begin_prologue,	         /* begin_prologue */
   debug_nothing_int_charstar,	         /* end_prologue */
@@ -389,7 +389,7 @@ const struct gcc_debug_hooks xcoff_debug
   dbxout_end_source_file,
   xcoffout_begin_block,
   xcoffout_end_block,
-  debug_true_tree,		         /* ignore_block */
+  debug_true_const_tree,	         /* ignore_block */
   xcoffout_source_line,
   xcoffout_begin_prologue,	         /* begin_prologue */
   debug_nothing_int_charstar,	         /* end_prologue */
diff -rup orig/egcc-SVN20070825/gcc/debug.c egcc-SVN20070825/gcc/debug.c
--- orig/egcc-SVN20070825/gcc/debug.c	2007-07-26 23:03:42.000000000 -0400
+++ egcc-SVN20070825/gcc/debug.c	2007-08-25 17:27:46.361262900 -0400
@@ -32,7 +32,7 @@ const struct gcc_debug_hooks do_nothing_
   debug_nothing_int,
   debug_nothing_int_int,	         /* begin_block */
   debug_nothing_int_int,	         /* end_block */
-  debug_true_tree,		         /* ignore_block */
+  debug_true_const_tree,	         /* ignore_block */
   debug_nothing_int_charstar,	         /* source_line */
   debug_nothing_int_charstar,	         /* begin_prologue */
   debug_nothing_int_charstar,	         /* end_prologue */
@@ -72,7 +72,7 @@ debug_nothing_tree_tree (tree t1 ATTRIBU
 }

 bool
-debug_true_tree (tree block ATTRIBUTE_UNUSED)
+debug_true_const_tree (const_tree block ATTRIBUTE_UNUSED)
 {
   return true;
 }
diff -rup orig/egcc-SVN20070825/gcc/debug.h egcc-SVN20070825/gcc/debug.h
--- orig/egcc-SVN20070825/gcc/debug.h	2007-08-18 20:02:29.000000000 -0400
+++ egcc-SVN20070825/gcc/debug.h	2007-08-25 17:27:53.862590957 -0400
@@ -56,7 +56,7 @@ struct gcc_debug_hooks
      instructions.  This may not be the case for blocks containing
      nested functions, since we may actually call such a function even
      though the BLOCK information is messed up.  Defaults to true.  */
-  bool (* ignore_block) (tree);
+  bool (* ignore_block) (const_tree);

   /* Record a source file location at (FILE, LINE).  */
   void (* source_line) (unsigned int line, const char *file);
@@ -140,7 +140,7 @@ extern void debug_nothing_int_int (unsig
 extern void debug_nothing_tree (tree);
 extern void debug_nothing_tree_int (tree, int);
 extern void debug_nothing_tree_tree (tree, tree);
-extern bool debug_true_tree (tree);
+extern bool debug_true_const_tree (const_tree);
 extern void debug_nothing_rtx (rtx);

 /* Hooks for various debug formats.  */
diff -rup orig/egcc-SVN20070825/gcc/dwarf2out.c egcc-SVN20070825/gcc/dwarf2out.c
--- orig/egcc-SVN20070825/gcc/dwarf2out.c	2007-08-21 20:03:29.000000000 -0400
+++ egcc-SVN20070825/gcc/dwarf2out.c	2007-08-25 17:22:35.939995224 -0400
@@ -354,12 +354,12 @@ static void reg_save (const char *, unsi
 #ifdef DWARF2_UNWIND_INFO
 static void initial_return_save (rtx);
 #endif
-static HOST_WIDE_INT stack_adjust_offset (rtx);
+static HOST_WIDE_INT stack_adjust_offset (const_rtx);
 static void output_cfi (dw_cfi_ref, dw_fde_ref, int);
 static void output_call_frame_info (int);
 static void dwarf2out_stack_adjust (rtx, bool);
 static void flush_queued_reg_saves (void);
-static bool clobbers_queued_reg_save (rtx);
+static bool clobbers_queued_reg_save (const_rtx);
 static void dwarf2out_frame_debug_expr (rtx, const char *);

 /* Support for complex CFA locations.  */
@@ -1025,10 +1025,10 @@ initial_return_save (rtx rtl)
    contains.  */

 static HOST_WIDE_INT
-stack_adjust_offset (rtx pattern)
+stack_adjust_offset (const_rtx pattern)
 {
-  rtx src = SET_SRC (pattern);
-  rtx dest = SET_DEST (pattern);
+  const_rtx src = SET_SRC (pattern);
+  const_rtx dest = SET_DEST (pattern);
   HOST_WIDE_INT offset = 0;
   enum rtx_code code;

@@ -1286,7 +1286,7 @@ flush_queued_reg_saves (void)
    have a new location for?  */

 static bool
-clobbers_queued_reg_save (rtx insn)
+clobbers_queued_reg_save (const_rtx insn)
 {
   struct queued_reg_save *q;

@@ -3651,7 +3651,7 @@ static void dwarf2out_start_source_file
 static void dwarf2out_end_source_file (unsigned);
 static void dwarf2out_begin_block (unsigned, unsigned);
 static void dwarf2out_end_block (unsigned, unsigned);
-static bool dwarf2out_ignore_block (tree);
+static bool dwarf2out_ignore_block (const_tree);
 static void dwarf2out_global_decl (tree);
 static void dwarf2out_type_decl (tree, int);
 static void dwarf2out_imported_module_or_decl (tree, tree);
@@ -4069,14 +4069,14 @@ static HOST_WIDE_INT frame_pointer_fb_of

 /* Forward declarations for functions defined in this file.  */

-static int is_pseudo_reg (rtx);
+static int is_pseudo_reg (const_rtx);
 static tree type_main_variant (tree);
-static int is_tagged_type (tree);
+static int is_tagged_type (const_tree);
 static const char *dwarf_tag_name (unsigned);
 static const char *dwarf_attr_name (unsigned);
 static const char *dwarf_form_name (unsigned);
-static tree decl_ultimate_origin (tree);
-static tree block_ultimate_origin (tree);
+static tree decl_ultimate_origin (const_tree);
+static tree block_ultimate_origin (const_tree);
 static tree decl_class_context (tree);
 static void add_dwarf_attr (dw_die_ref, dw_attr_ref);
 static inline enum dw_val_class AT_class (dw_attr_ref);
@@ -4139,7 +4139,7 @@ static int decl_die_table_eq (const void
 static dw_die_ref lookup_decl_die (tree);
 static hashval_t decl_loc_table_hash (const void *);
 static int decl_loc_table_eq (const void *, const void *);
-static var_loc_list *lookup_decl_loc (tree);
+static var_loc_list *lookup_decl_loc (const_tree);
 static void equate_decl_number_to_die (tree, dw_die_ref);
 static void add_var_loc_to_decl (tree, struct var_loc_node *);
 static void print_spaces (FILE *);
@@ -4151,7 +4151,7 @@ static void loc_checksum (dw_loc_descr_r
 static void attr_checksum (dw_attr_ref, struct md5_ctx *, int *);
 static void die_checksum (dw_die_ref, struct md5_ctx *, int *);
 static int same_loc_p (dw_loc_descr_ref, dw_loc_descr_ref, int *);
-static int same_dw_val_p (dw_val_node *, dw_val_node *, int *);
+static int same_dw_val_p (const dw_val_node *, const dw_val_node *, int *);
 static int same_attr_p (dw_attr_ref, dw_attr_ref, int *);
 static int same_die_p (dw_die_ref, dw_die_ref, int *);
 static int same_die_p_wrap (dw_die_ref, dw_die_ref);
@@ -4191,18 +4191,18 @@ static void output_pubnames (VEC (pubnam
 static void add_arange (tree, dw_die_ref);
 static void output_aranges (void);
 static unsigned int add_ranges_num (int);
-static unsigned int add_ranges (tree);
+static unsigned int add_ranges (const_tree);
 static unsigned int add_ranges_by_labels (const char *, const char *);
 static void output_ranges (void);
 static void output_line_info (void);
 static void output_file_names (void);
 static dw_die_ref base_type_die (tree);
 static int is_base_type (tree);
-static bool is_subrange_type (tree);
+static bool is_subrange_type (const_tree);
 static dw_die_ref subrange_type_die (tree, dw_die_ref);
 static dw_die_ref modified_type_die (tree, int, int, dw_die_ref);
-static int type_is_enum (tree);
-static unsigned int dbx_reg_number (rtx);
+static int type_is_enum (const_tree);
+static unsigned int dbx_reg_number (const_rtx);
 static void add_loc_descr_op_piece (dw_loc_descr_ref *, int);
 static dw_loc_descr_ref reg_loc_descriptor (rtx, enum var_init_status);
 static dw_loc_descr_ref one_reg_loc_descriptor (unsigned int,
@@ -4212,7 +4212,7 @@ static dw_loc_descr_ref multiple_reg_loc
 static dw_loc_descr_ref int_loc_descriptor (HOST_WIDE_INT);
 static dw_loc_descr_ref based_loc_descr (rtx, HOST_WIDE_INT,
 					 enum var_init_status);
-static int is_based_loc (rtx);
+static int is_based_loc (const_rtx);
 static dw_loc_descr_ref mem_loc_descriptor (rtx, enum machine_mode mode,
 					    enum var_init_status);
 static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx,
@@ -4221,18 +4221,18 @@ static dw_loc_descr_ref loc_descriptor (
 static dw_loc_descr_ref loc_descriptor_from_tree_1 (tree, int);
 static dw_loc_descr_ref loc_descriptor_from_tree (tree);
 static HOST_WIDE_INT ceiling (HOST_WIDE_INT, unsigned int);
-static tree field_type (tree);
-static unsigned int simple_type_align_in_bits (tree);
-static unsigned int simple_decl_align_in_bits (tree);
-static unsigned HOST_WIDE_INT simple_type_size_in_bits (tree);
-static HOST_WIDE_INT field_byte_offset (tree);
+static tree field_type (const_tree);
+static unsigned int simple_type_align_in_bits (const_tree);
+static unsigned int simple_decl_align_in_bits (const_tree);
+static unsigned HOST_WIDE_INT simple_type_size_in_bits (const_tree);
+static HOST_WIDE_INT field_byte_offset (const_tree);
 static void add_AT_location_description	(dw_die_ref, enum dwarf_attribute,
 					 dw_loc_descr_ref);
 static void add_data_member_location_attribute (dw_die_ref, tree);
 static void add_const_value_attribute (dw_die_ref, rtx);
 static void insert_int (HOST_WIDE_INT, unsigned, unsigned char *);
 static HOST_WIDE_INT extract_int (const unsigned char *, unsigned);
-static void insert_float (rtx, unsigned char *);
+static void insert_float (const_rtx, unsigned char *);
 static rtx rtl_for_decl_location (tree);
 static void add_location_or_const_value_attribute (dw_die_ref, tree,
 						   enum dwarf_attribute);
@@ -4256,8 +4256,8 @@ static inline int local_scope_p (dw_die_
 static inline int class_or_namespace_scope_p (dw_die_ref);
 static void add_type_attribute (dw_die_ref, tree, int, int, dw_die_ref);
 static void add_calling_convention_attribute (dw_die_ref, tree);
-static const char *type_tag (tree);
-static tree member_declared_type (tree);
+static const char *type_tag (const_tree);
+static tree member_declared_type (const_tree);
 #if 0
 static const char *decl_start_label (tree);
 #endif
@@ -4290,7 +4290,7 @@ static void gen_type_die (tree, dw_die_r
 static void gen_tagged_type_instantiation_die (tree, dw_die_ref);
 static void gen_block_die (tree, dw_die_ref, int);
 static void decls_for_scope (tree, dw_die_ref, int);
-static int is_redundant_typedef (tree);
+static int is_redundant_typedef (const_tree);
 static void gen_namespace_die (tree);
 static void gen_decl_die (tree, dw_die_ref);
 static dw_die_ref force_decl_die (tree);
@@ -4437,7 +4437,7 @@ dwarf2out_set_demangle_name_func (const
 /* Test if rtl node points to a pseudo register.  */

 static inline int
-is_pseudo_reg (rtx rtl)
+is_pseudo_reg (const_rtx rtl)
 {
   return ((REG_P (rtl) && REGNO (rtl) >= FIRST_PSEUDO_REGISTER)
 	  || (GET_CODE (rtl) == SUBREG
@@ -4467,7 +4467,7 @@ type_main_variant (tree type)
 /* Return nonzero if the given type node represents a tagged type.  */

 static inline int
-is_tagged_type (tree type)
+is_tagged_type (const_tree type)
 {
   enum tree_code code = TREE_CODE (type);

@@ -4863,7 +4863,7 @@ dwarf_form_name (unsigned int form)
    given block.  */

 static tree
-decl_ultimate_origin (tree decl)
+decl_ultimate_origin (const_tree decl)
 {
   if (!CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_COMMON))
     return NULL_TREE;
@@ -4888,7 +4888,7 @@ decl_ultimate_origin (tree decl)
    given block.  */

 static tree
-block_ultimate_origin (tree block)
+block_ultimate_origin (const_tree block)
 {
   tree immediate_origin = BLOCK_ABSTRACT_ORIGIN (block);

@@ -5734,7 +5734,7 @@ decl_loc_table_eq (const void *x, const
 /* Return the var_loc list associated with a given declaration.  */

 static inline var_loc_list *
-lookup_decl_loc (tree decl)
+lookup_decl_loc (const_tree decl)
 {
   return htab_find_with_hash (decl_loc_table, decl, DECL_UID (decl));
 }
@@ -6099,7 +6099,7 @@ same_loc_p (dw_loc_descr_ref loc1, dw_lo

 /* Do the values look the same?  */
 static int
-same_dw_val_p (dw_val_node *v1, dw_val_node *v2, int *mark)
+same_dw_val_p (const dw_val_node *v1, const dw_val_node *v2, int *mark)
 {
   dw_loc_descr_ref loc1, loc2;
   rtx r1, r2;
@@ -7667,7 +7667,7 @@ add_ranges_num (int num)
    range terminator if BLOCK is NULL.  */

 static unsigned int
-add_ranges (tree block)
+add_ranges (const_tree block)
 {
   return add_ranges_num (block ? BLOCK_NUMBER (block) : 0);
 }
@@ -8515,7 +8515,7 @@ is_base_type (tree type)
    ERROR_MARK node.  */

 static inline unsigned HOST_WIDE_INT
-simple_type_size_in_bits (tree type)
+simple_type_size_in_bits (const_tree type)
 {
   if (TREE_CODE (type) == ERROR_MARK)
     return BITS_PER_WORD;
@@ -8531,7 +8531,7 @@ simple_type_size_in_bits (tree type)
    emitted as a subrange type.  */

 static inline bool
-is_subrange_type (tree type)
+is_subrange_type (const_tree type)
 {
   tree subtype = TREE_TYPE (type);

@@ -8757,7 +8757,7 @@ modified_type_die (tree type, int is_con
    an enumerated type.  */

 static inline int
-type_is_enum (tree type)
+type_is_enum (const_tree type)
 {
   return TREE_CODE (type) == ENUMERAL_TYPE;
 }
@@ -8765,7 +8765,7 @@ type_is_enum (tree type)
 /* Return the DBX register number described by a given RTL node.  */

 static unsigned int
-dbx_reg_number (rtx rtl)
+dbx_reg_number (const_rtx rtl)
 {
   unsigned regno = REGNO (rtl);

@@ -8991,7 +8991,7 @@ based_loc_descr (rtx reg, HOST_WIDE_INT
 /* Return true if this RTL expression describes a base+offset calculation.  */

 static inline int
-is_based_loc (rtx rtl)
+is_based_loc (const_rtx rtl)
 {
   return (GET_CODE (rtl) == PLUS
 	  && ((REG_P (XEXP (rtl, 0))
@@ -9840,7 +9840,7 @@ ceiling (HOST_WIDE_INT value, unsigned i
    ERROR_MARK node.  */

 static inline tree
-field_type (tree decl)
+field_type (const_tree decl)
 {
   tree type;

@@ -9859,13 +9859,13 @@ field_type (tree decl)
    be an ERROR_MARK node.  */

 static inline unsigned
-simple_type_align_in_bits (tree type)
+simple_type_align_in_bits (const_tree type)
 {
   return (TREE_CODE (type) != ERROR_MARK) ? TYPE_ALIGN (type) : BITS_PER_WORD;
 }

 static inline unsigned
-simple_decl_align_in_bits (tree decl)
+simple_decl_align_in_bits (const_tree decl)
 {
   return (TREE_CODE (decl) != ERROR_MARK) ? DECL_ALIGN (decl) : BITS_PER_WORD;
 }
@@ -9896,7 +9896,7 @@ round_up_to_align (HOST_WIDE_INT t, unsi
    just yet).  */

 static HOST_WIDE_INT
-field_byte_offset (tree decl)
+field_byte_offset (const_tree decl)
 {
   HOST_WIDE_INT object_offset_in_bits;
   HOST_WIDE_INT bitpos_int;
@@ -10162,7 +10162,7 @@ extract_int (const unsigned char *src, u
 /* Writes floating point values to dw_vec_const array.  */

 static void
-insert_float (rtx rtl, unsigned char *array)
+insert_float (const_rtx rtl, unsigned char *array)
 {
   REAL_VALUE_TYPE rv;
   long val[4];
@@ -10622,7 +10622,7 @@ rtl_for_decl_location (tree decl)
    XXX: If you split a variable across multiple sections, we won't notice.  */

 static const char *
-secname_for_decl (tree decl)
+secname_for_decl (const_tree decl)
 {
   const char *secname;

@@ -11488,7 +11488,7 @@ add_calling_convention_attribute (dw_die
    was declared without a tag.  */

 static const char *
-type_tag (tree type)
+type_tag (const_tree type)
 {
   const char *name = 0;

@@ -11526,7 +11526,7 @@ type_tag (tree type)
    for bit field types.  */

 static inline tree
-member_declared_type (tree member)
+member_declared_type (const_tree member)
 {
   return (DECL_BIT_FIELD_TYPE (member)
 	  ? DECL_BIT_FIELD_TYPE (member) : TREE_TYPE (member));
@@ -12484,7 +12484,7 @@ add_call_src_coords_attributes (tree stm
    first subblock's abstract origin is the function's outermost block,
    then we're looking at the main entry point.  */
 static bool
-is_inlined_entry_point (tree stmt)
+is_inlined_entry_point (const_tree stmt)
 {
   tree decl, block;

@@ -13339,7 +13339,7 @@ decls_for_scope (tree stmt, dw_die_ref c
 /* Is this a typedef we can avoid emitting?  */

 static inline int
-is_redundant_typedef (tree decl)
+is_redundant_typedef (const_tree decl)
 {
   if (TYPE_DECL_IS_STUB (decl))
     return 1;
@@ -13950,7 +13950,7 @@ dwarf2out_end_block (unsigned int line A
    we may end up calling them anyway.  */

 static bool
-dwarf2out_ignore_block (tree block)
+dwarf2out_ignore_block (const_tree block)
 {
   tree decl;

diff -rup orig/egcc-SVN20070825/gcc/emit-rtl.c egcc-SVN20070825/gcc/emit-rtl.c
--- orig/egcc-SVN20070825/gcc/emit-rtl.c	2007-08-24 15:16:12.000000000 -0400
+++ egcc-SVN20070825/gcc/emit-rtl.c	2007-08-25 15:06:33.285603616 -0400
@@ -2865,103 +2865,169 @@ get_max_uid (void)
 /* Return the next insn.  If it is a SEQUENCE, return the first insn
    of the sequence.  */

+#define NEXT_INSN_BODY do { \
+  if (insn) \
+    { \
+      insn = NEXT_INSN (insn); \
+      if (insn && NONJUMP_INSN_P (insn) \
+	  && GET_CODE (PATTERN (insn)) == SEQUENCE) \
+	insn = XVECEXP (PATTERN (insn), 0, 0); \
+    } \
+  return insn; \
+} while (0)
+
 rtx
 next_insn (rtx insn)
 {
-  if (insn)
-    {
-      insn = NEXT_INSN (insn);
-      if (insn && NONJUMP_INSN_P (insn)
-	  && GET_CODE (PATTERN (insn)) == SEQUENCE)
-	insn = XVECEXP (PATTERN (insn), 0, 0);
-    }
+  NEXT_INSN_BODY;
+}

-  return insn;
+const_rtx
+const_next_insn (const_rtx insn)
+{
+  NEXT_INSN_BODY;
 }

+#undef NEXT_INSN_BODY
+
 /* Return the previous insn.  If it is a SEQUENCE, return the last insn
    of the sequence.  */

+#define PREVIOUS_INSN_BODY do { \
+  if (insn) \
+    { \
+      insn = PREV_INSN (insn); \
+      if (insn && NONJUMP_INSN_P (insn) \
+	  && GET_CODE (PATTERN (insn)) == SEQUENCE) \
+	insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1); \
+    } \
+  return insn; \
+} while (0)
+
 rtx
 previous_insn (rtx insn)
 {
-  if (insn)
-    {
-      insn = PREV_INSN (insn);
-      if (insn && NONJUMP_INSN_P (insn)
-	  && GET_CODE (PATTERN (insn)) == SEQUENCE)
-	insn = XVECEXP (PATTERN (insn), 0, XVECLEN (PATTERN (insn), 0) - 1);
-    }
+  PREVIOUS_INSN_BODY;
+}

-  return insn;
+const_rtx
+const_previous_insn (const_rtx insn)
+{
+  PREVIOUS_INSN_BODY;
 }

+#undef PREVIOUS_INSN_BODY
+
 /* Return the next insn after INSN that is not a NOTE.  This routine does not
    look inside SEQUENCEs.  */

+#define NEXT_NONNOTE_INSN_BODY do { \
+  while (insn) \
+    { \
+      insn = NEXT_INSN (insn); \
+      if (insn == 0 || !NOTE_P (insn)) \
+	break; \
+    } \
+  return insn; \
+} while (0)
+
 rtx
 next_nonnote_insn (rtx insn)
 {
-  while (insn)
-    {
-      insn = NEXT_INSN (insn);
-      if (insn == 0 || !NOTE_P (insn))
-	break;
-    }
+  NEXT_NONNOTE_INSN_BODY;
+}

-  return insn;
+const_rtx
+const_next_nonnote_insn (const_rtx insn)
+{
+  NEXT_NONNOTE_INSN_BODY;
 }

+#undef NEXT_NONNOTE_INSN_BODY
+
 /* Return the previous insn before INSN that is not a NOTE.  This routine does
    not look inside SEQUENCEs.  */

+#define PREV_NONNOTE_INSN_BODY do { \
+  while (insn) \
+    { \
+      insn = PREV_INSN (insn); \
+      if (insn == 0 || !NOTE_P (insn)) \
+	break; \
+    } \
+  return insn; \
+} while (0)
+
 rtx
 prev_nonnote_insn (rtx insn)
 {
-  while (insn)
-    {
-      insn = PREV_INSN (insn);
-      if (insn == 0 || !NOTE_P (insn))
-	break;
-    }
+  PREV_NONNOTE_INSN_BODY;
+}

-  return insn;
+const_rtx
+const_prev_nonnote_insn (const_rtx insn)
+{
+  PREV_NONNOTE_INSN_BODY;
 }

+#undef PREV_NONNOTE_INSN_BODY
+
 /* Return the next INSN, CALL_INSN or JUMP_INSN after INSN;
    or 0, if there is none.  This routine does not look inside
    SEQUENCEs.  */

+#define NEXT_REAL_INSN_BODY do { \
+  while (insn) \
+    { \
+      insn = NEXT_INSN (insn); \
+      if (insn == 0 || INSN_P (insn)) \
+	break; \
+    } \
+  return insn; \
+} while (0)
+
 rtx
 next_real_insn (rtx insn)
 {
-  while (insn)
-    {
-      insn = NEXT_INSN (insn);
-      if (insn == 0 || INSN_P (insn))
-	break;
-    }
+  NEXT_REAL_INSN_BODY;
+}

-  return insn;
+const_rtx
+const_next_real_insn (const_rtx insn)
+{
+  NEXT_REAL_INSN_BODY;
 }

+#undef NEXT_REAL_INSN_BODY
+
 /* Return the last INSN, CALL_INSN or JUMP_INSN before INSN;
    or 0, if there is none.  This routine does not look inside
    SEQUENCEs.  */

+#define PREV_REAL_INSN_BODY do { \
+  while (insn) \
+    { \
+      insn = PREV_INSN (insn); \
+      if (insn == 0 || INSN_P (insn)) \
+	break; \
+    } \
+  return insn; \
+} while (0)
+
 rtx
 prev_real_insn (rtx insn)
 {
-  while (insn)
-    {
-      insn = PREV_INSN (insn);
-      if (insn == 0 || INSN_P (insn))
-	break;
-    }
+  PREV_REAL_INSN_BODY;
+}

-  return insn;
+const_rtx
+const_prev_real_insn (const_rtx insn)
+{
+  PREV_REAL_INSN_BODY;
 }

+#undef PREV_REAL_INSN_BODY
+
 /* Return the last CALL_INSN in the current list, or 0 if there is none.
    This routine does not look inside SEQUENCEs.  */

@@ -2992,66 +3058,110 @@ active_insn_p (const_rtx insn)
 		      && GET_CODE (PATTERN (insn)) != CLOBBER))));
 }

+#define NEXT_ACTIVE_INSN_BODY do { \
+  while (insn) \
+    { \
+      insn = NEXT_INSN (insn); \
+      if (insn == 0 || active_insn_p (insn)) \
+	break; \
+    } \
+  return insn;\
+} while (0)
+
 rtx
 next_active_insn (rtx insn)
 {
-  while (insn)
-    {
-      insn = NEXT_INSN (insn);
-      if (insn == 0 || active_insn_p (insn))
-	break;
-    }
+  NEXT_ACTIVE_INSN_BODY;
+}

-  return insn;
+const_rtx
+const_next_active_insn (const_rtx insn)
+{
+  NEXT_ACTIVE_INSN_BODY;
 }

+#undef NEXT_ACTIVE_INSN_BODY
+
 /* Find the last insn before INSN that really does something.  This routine
    does not look inside SEQUENCEs.  Until reload has completed, this is the
    same as prev_real_insn.  */

+#define PREV_ACTIVE_INSN_BODY do { \
+  while (insn) \
+    { \
+      insn = PREV_INSN (insn);\
+      if (insn == 0 || active_insn_p (insn)) \
+	break; \
+    } \
+  return insn; \
+} while (0)
+
 rtx
 prev_active_insn (rtx insn)
 {
-  while (insn)
-    {
-      insn = PREV_INSN (insn);
-      if (insn == 0 || active_insn_p (insn))
-	break;
-    }
+  PREV_ACTIVE_INSN_BODY;
+}

-  return insn;
+const_rtx
+const_prev_active_insn (const_rtx insn)
+{
+  PREV_ACTIVE_INSN_BODY;
 }

+#undef PREV_ACTIVE_INSN_BODY
+
 /* Return the next CODE_LABEL after the insn INSN, or 0 if there is none.  */

+#define NEXT_LABEL_BODY do { \
+  while (insn) \
+    { \
+      insn = NEXT_INSN (insn); \
+      if (insn == 0 || LABEL_P (insn)) \
+	break; \
+    } \
+  return insn; \
+} while (0)
+
 rtx
 next_label (rtx insn)
 {
-  while (insn)
-    {
-      insn = NEXT_INSN (insn);
-      if (insn == 0 || LABEL_P (insn))
-	break;
-    }
+  NEXT_LABEL_BODY;
+}

-  return insn;
+const_rtx
+const_next_label (const_rtx insn)
+{
+  NEXT_LABEL_BODY;
 }

+#undef NEXT_LABEL_BODY
+
 /* Return the last CODE_LABEL before the insn INSN, or 0 if there is none.  */

+#define PREV_LABEL_BODY do { \
+  while (insn) \
+    { \
+      insn = PREV_INSN (insn); \
+      if (insn == 0 || LABEL_P (insn)) \
+	break; \
+    } \
+  return insn; \
+} while (0)
+
 rtx
 prev_label (rtx insn)
 {
-  while (insn)
-    {
-      insn = PREV_INSN (insn);
-      if (insn == 0 || LABEL_P (insn))
-	break;
-    }
+  PREV_LABEL_BODY;
+}

-  return insn;
+const_rtx
+const_prev_label (const_rtx insn)
+{
+  PREV_LABEL_BODY;
 }

+#undef PREV_LABEL_BODY
+
 /* Return the last label to mark the same position as LABEL.  Return null
    if LABEL itself is null.  */

diff -rup orig/egcc-SVN20070825/gcc/except.h egcc-SVN20070825/gcc/except.h
--- orig/egcc-SVN20070825/gcc/except.h	2007-08-14 01:01:48.000000000 -0400
+++ egcc-SVN20070825/gcc/except.h	2007-08-25 13:21:21.469182816 -0400
@@ -112,8 +112,8 @@ extern int eh_region_outermost (struct f
 /* tree-eh.c */
 extern void add_stmt_to_eh_region_fn (struct function *, tree, int);
 extern bool remove_stmt_from_eh_region_fn (struct function *, tree);
-extern int lookup_stmt_eh_region_fn (struct function *, tree);
-extern int lookup_stmt_eh_region (tree);
+extern int lookup_stmt_eh_region_fn (struct function *, const_tree);
+extern int lookup_stmt_eh_region (const_tree);
 extern bool verify_eh_edges (tree);

 /* If non-NULL, this is a function that returns an expression to be
diff -rup orig/egcc-SVN20070825/gcc/haifa-sched.c egcc-SVN20070825/gcc/haifa-sched.c
--- orig/egcc-SVN20070825/gcc/haifa-sched.c	2007-08-22 20:03:47.000000000 -0400
+++ egcc-SVN20070825/gcc/haifa-sched.c	2007-08-25 16:57:09.105661898 -0400
@@ -328,7 +328,7 @@ static int clock_var;
 /* Number of instructions in current scheduling region.  */
 static int rgn_n_insns;

-static int may_trap_exp (rtx, int);
+static int may_trap_exp (const_rtx, int);

 /* Nonzero iff the address is comprised from at most 1 register.  */
 #define CONST_BASED_ADDRESS_P(x)			\
@@ -342,7 +342,7 @@ static int may_trap_exp (rtx, int);
    as found by analyzing insn's expression.  */

 static int
-may_trap_exp (rtx x, int is_store)
+may_trap_exp (const_rtx x, int is_store)
 {
   enum rtx_code code;

@@ -415,7 +415,7 @@ may_trap_exp (rtx x, int is_store)
    being either PFREE or PRISKY.  */

 int
-haifa_classify_insn (rtx insn)
+haifa_classify_insn (const_rtx insn)
 {
   rtx pat = PATTERN (insn);
   int tmp_class = TRAP_FREE;
@@ -499,7 +499,7 @@ static int rank_for_schedule (const void
 static void swap_sort (rtx *, int);
 static void queue_insn (rtx, int);
 static int schedule_insn (rtx);
-static int find_set_reg_weight (rtx);
+static int find_set_reg_weight (const_rtx);
 static void find_insn_reg_weight (basic_block);
 static void find_insn_reg_weight1 (rtx);
 static void adjust_priority (rtx);
@@ -1358,7 +1358,7 @@ get_ebb_head_tail (basic_block beg, basi
 /* Return nonzero if there are no real insns in the range [ HEAD, TAIL ].  */

 int
-no_real_insns_p (rtx head, rtx tail)
+no_real_insns_p (const_rtx head, const_rtx tail)
 {
   while (head != NEXT_INSN (tail))
     {
@@ -1408,7 +1408,7 @@ rm_other_notes (rtx head, rtx tail)
    a new register is not needed.  */

 static int
-find_set_reg_weight (rtx x)
+find_set_reg_weight (const_rtx x)
 {
   if (GET_CODE (x) == CLOBBER
       && register_operand (SET_DEST (x), VOIDmode))
@@ -4017,7 +4017,7 @@ change_pattern (rtx insn, rtx new_pat)

 /* Return true if INSN can potentially be speculated with type DS.  */
 bool
-sched_insn_is_legitimate_for_speculation_p (rtx insn, ds_t ds)
+sched_insn_is_legitimate_for_speculation_p (const_rtx insn, ds_t ds)
 {
   if (HAS_INTERNAL_DEP (insn))
     return false;
diff -rup orig/egcc-SVN20070825/gcc/jump.c egcc-SVN20070825/gcc/jump.c
--- orig/egcc-SVN20070825/gcc/jump.c	2007-08-24 15:16:09.000000000 -0400
+++ egcc-SVN20070825/gcc/jump.c	2007-08-25 16:17:30.404520684 -0400
@@ -233,7 +233,8 @@ mark_all_labels (rtx f)
    description should define REVERSIBLE_CC_MODE and REVERSE_CONDITION macros
    to help this function avoid overhead in these cases.  */
 enum rtx_code
-reversed_comparison_code_parts (enum rtx_code code, rtx arg0, rtx arg1, rtx insn)
+reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
+				const_rtx arg1, const_rtx insn)
 {
   enum machine_mode mode;

@@ -290,7 +291,7 @@ reversed_comparison_code_parts (enum rtx

   if (GET_MODE_CLASS (mode) == MODE_CC || CC0_P (arg0))
     {
-      rtx prev;
+      const_rtx prev;
       /* Try to search for the comparison to determine the real mode.
          This code is expensive, but with sane machine description it
          will be never used, since REVERSIBLE_CC_MODE will return true
@@ -298,9 +299,9 @@ reversed_comparison_code_parts (enum rtx
       if (! insn)
 	return UNKNOWN;

-      for (prev = prev_nonnote_insn (insn);
+      for (prev = const_prev_nonnote_insn (insn);
 	   prev != 0 && !LABEL_P (prev);
-	   prev = prev_nonnote_insn (prev))
+	   prev = const_prev_nonnote_insn (prev))
 	{
 	  const_rtx set = set_of (arg0, prev);
 	  if (set && GET_CODE (set) == SET
@@ -346,7 +347,7 @@ reversed_comparison_code_parts (enum rtx
 /* A wrapper around the previous function to take COMPARISON as rtx
    expression.  This simplifies many callers.  */
 enum rtx_code
-reversed_comparison_code (rtx comparison, rtx insn)
+reversed_comparison_code (const_rtx comparison, const_rtx insn)
 {
   if (!COMPARISON_P (comparison))
     return UNKNOWN;
@@ -358,7 +359,7 @@ reversed_comparison_code (rtx comparison
 /* Return comparison with reversed code of EXP.
    Return NULL_RTX in case we fail to do the reversal.  */
 rtx
-reversed_comparison (rtx exp, enum machine_mode mode)
+reversed_comparison (const_rtx exp, enum machine_mode mode)
 {
   enum rtx_code reversed_code = reversed_comparison_code (exp, NULL_RTX);
   if (reversed_code == UNKNOWN)
@@ -789,7 +790,7 @@ any_condjump_p (const_rtx insn)
 /* Return the label of a conditional jump.  */

 rtx
-condjump_label (rtx insn)
+condjump_label (const_rtx insn)
 {
   rtx x = pc_set (insn);

diff -rup orig/egcc-SVN20070825/gcc/predict.c egcc-SVN20070825/gcc/predict.c
--- orig/egcc-SVN20070825/gcc/predict.c	2007-08-16 10:44:46.000000000 -0400
+++ egcc-SVN20070825/gcc/predict.c	2007-08-25 13:28:56.574212187 -0400
@@ -162,7 +162,7 @@ probably_never_executed_bb_p (const_basi
    PREDICTOR.  */

 bool
-rtl_predicted_by_p (basic_block bb, enum br_predictor predictor)
+rtl_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
 {
   rtx note;
   if (!INSN_P (BB_END (bb)))
@@ -183,7 +183,7 @@ static struct pointer_map_t *bb_predicti
    PREDICTOR.  */

 bool
-tree_predicted_by_p (basic_block bb, enum br_predictor predictor)
+tree_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
 {
   struct edge_prediction *i;
   void **preds = pointer_map_contains (bb_predictions, bb);
diff -rup orig/egcc-SVN20070825/gcc/reg-stack.c egcc-SVN20070825/gcc/reg-stack.c
--- orig/egcc-SVN20070825/gcc/reg-stack.c	2007-07-28 23:02:58.000000000 -0400
+++ egcc-SVN20070825/gcc/reg-stack.c	2007-08-25 15:18:59.375811715 -0400
@@ -249,7 +249,7 @@ static rtx not_a_num;

 /* Forward declarations */

-static int stack_regs_mentioned_p (rtx pat);
+static int stack_regs_mentioned_p (const_rtx pat);
 static void pop_stack (stack, int);
 static rtx *get_true_reg (rtx *);

@@ -276,7 +276,7 @@ static rtx next_flags_user (rtx);
 /* Return nonzero if any stack register is mentioned somewhere within PAT.  */

 static int
-stack_regs_mentioned_p (rtx pat)
+stack_regs_mentioned_p (const_rtx pat)
 {
   const char *fmt;
   int i;
@@ -305,7 +305,7 @@ stack_regs_mentioned_p (rtx pat)
 /* Return nonzero if INSN mentions stacked registers, else return zero.  */

 int
-stack_regs_mentioned (rtx insn)
+stack_regs_mentioned (const_rtx insn)
 {
   unsigned int uid, max;
   int test;
diff -rup orig/egcc-SVN20070825/gcc/rtl.h egcc-SVN20070825/gcc/rtl.h
--- orig/egcc-SVN20070825/gcc/rtl.h	2007-08-25 11:25:45.000000000 -0400
+++ egcc-SVN20070825/gcc/rtl.h	2007-08-25 16:17:38.974847658 -0400
@@ -1593,16 +1593,26 @@ extern rtx make_jump_insn_raw (rtx);
 extern void add_function_usage_to (rtx, rtx);
 extern rtx last_call_insn (void);
 extern rtx previous_insn (rtx);
+extern const_rtx const_previous_insn (const_rtx);
 extern rtx next_insn (rtx);
+extern const_rtx const_next_insn (const_rtx);
 extern rtx prev_nonnote_insn (rtx);
+extern const_rtx const_prev_nonnote_insn (const_rtx);
 extern rtx next_nonnote_insn (rtx);
+extern const_rtx const_next_nonnote_insn (const_rtx);
 extern rtx prev_real_insn (rtx);
+extern const_rtx const_prev_real_insn (const_rtx);
 extern rtx next_real_insn (rtx);
+extern const_rtx const_next_real_insn (const_rtx);
 extern rtx prev_active_insn (rtx);
+extern const_rtx const_prev_active_insn (const_rtx);
 extern rtx next_active_insn (rtx);
+extern const_rtx const_next_active_insn (const_rtx);
 extern int active_insn_p (const_rtx);
 extern rtx prev_label (rtx);
+extern const_rtx const_prev_label (const_rtx);
 extern rtx next_label (rtx);
+extern const_rtx const_next_label (const_rtx);
 extern rtx skip_consecutive_labels (rtx);
 extern rtx next_cc0_user (rtx);
 extern rtx prev_cc0_setter (rtx);
@@ -1708,9 +1718,9 @@ extern int reg_used_between_p (const_rtx
 extern int reg_set_between_p (const_rtx, const_rtx, const_rtx);
 extern int commutative_operand_precedence (rtx);
 extern bool swap_commutative_operands_p (rtx, rtx);
-extern int modified_between_p (rtx, rtx, rtx);
+extern int modified_between_p (const_rtx, const_rtx, const_rtx);
 extern int no_labels_between_p (const_rtx, const_rtx);
-extern int modified_in_p (rtx, rtx);
+extern int modified_in_p (const_rtx, const_rtx);
 extern int reg_set_p (const_rtx, const_rtx);
 extern rtx single_set_2 (const_rtx, const_rtx);
 extern int multiple_sets (const_rtx);
@@ -1721,6 +1731,7 @@ extern int refers_to_regno_p (unsigned i
 extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
 extern const_rtx set_of (const_rtx, const_rtx);
 extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
+extern void const_note_stores (const_rtx, void (*) (const_rtx, const_rtx, const void *), const void *);
 extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
 extern int dead_or_set_p (const_rtx, const_rtx);
 extern int dead_or_set_regno_p (const_rtx, unsigned int);
@@ -1753,7 +1764,7 @@ extern int in_expr_list_p (const_rtx, co
 extern void remove_node_from_expr_list (const_rtx, rtx *);
 extern int loc_mentioned_in_p (rtx *, const_rtx);
 extern rtx find_first_parameter_load (rtx, rtx);
-extern bool keep_with_call_p (rtx);
+extern bool keep_with_call_p (const_rtx);
 extern bool label_is_jump_target_p (const_rtx, const_rtx);
 extern int insn_rtx_cost (rtx);

@@ -2028,7 +2039,7 @@ extern int condjump_p (const_rtx);
 extern int any_condjump_p (const_rtx);
 extern int any_uncondjump_p (const_rtx);
 extern rtx pc_set (const_rtx);
-extern rtx condjump_label (rtx);
+extern rtx condjump_label (const_rtx);
 extern int simplejump_p (const_rtx);
 extern int returnjump_p (rtx);
 extern int onlyjump_p (const_rtx);
@@ -2043,10 +2054,10 @@ extern int redirect_jump_1 (rtx, rtx);
 extern void redirect_jump_2 (rtx, rtx, rtx, int, int);
 extern int redirect_jump (rtx, rtx, int);
 extern void rebuild_jump_labels (rtx);
-extern rtx reversed_comparison (rtx, enum machine_mode);
-extern enum rtx_code reversed_comparison_code (rtx, rtx);
-extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, rtx,
-						     rtx, rtx);
+extern rtx reversed_comparison (const_rtx, enum machine_mode);
+extern enum rtx_code reversed_comparison_code (const_rtx, const_rtx);
+extern enum rtx_code reversed_comparison_code_parts (enum rtx_code, const_rtx,
+						     const_rtx, const_rtx);
 extern void delete_for_peephole (rtx, rtx);
 extern int condjump_in_parallel_p (const_rtx);

@@ -2246,14 +2257,14 @@ extern int output_dependence (const_rtx,
 extern void init_alias_once (void);
 extern void init_alias_analysis (void);
 extern void end_alias_analysis (void);
-extern bool memory_modified_in_insn_p (rtx, rtx);
+extern bool memory_modified_in_insn_p (const_rtx, const_rtx);
 extern rtx find_base_term (rtx);
 extern rtx gen_hard_reg_clobber (enum machine_mode, unsigned int);
 extern rtx get_reg_known_value (unsigned int);
 extern bool get_reg_known_equiv_p (unsigned int);

 #ifdef STACK_REGS
-extern int stack_regs_mentioned (rtx insn);
+extern int stack_regs_mentioned (const_rtx insn);
 #endif

 /* In toplev.c */
diff -rup orig/egcc-SVN20070825/gcc/rtlanal.c egcc-SVN20070825/gcc/rtlanal.c
--- orig/egcc-SVN20070825/gcc/rtlanal.c	2007-08-23 12:12:22.000000000 -0400
+++ egcc-SVN20070825/gcc/rtlanal.c	2007-08-25 15:54:45.730877994 -0400
@@ -844,9 +844,9 @@ reg_set_p (const_rtx reg, const_rtx insn
    X contains a MEM; this routine does usememory aliasing.  */

 int
-modified_between_p (rtx x, rtx start, rtx end)
+modified_between_p (const_rtx x, const_rtx start, const_rtx end)
 {
-  enum rtx_code code = GET_CODE (x);
+  const enum rtx_code code = GET_CODE (x);
   const char *fmt;
   int i, j;
   rtx insn;
@@ -907,9 +907,9 @@ modified_between_p (rtx x, rtx start, rt
    does use memory aliasing.  */

 int
-modified_in_p (rtx x, rtx insn)
+modified_in_p (const_rtx x, const_rtx insn)
 {
-  enum rtx_code code = GET_CODE (x);
+  const enum rtx_code code = GET_CODE (x);
   const char *fmt;
   int i, j;

@@ -1412,41 +1412,49 @@ reg_overlap_mentioned_p (const_rtx x, co
   If the item being stored in or clobbered is a SUBREG of a hard register,
   the SUBREG will be passed.  */

+#define NOTE_STORES_BODY(NOTE_STORES_FN) do { \
+  int i; \
+  if (GET_CODE (x) == COND_EXEC) \
+    x = COND_EXEC_CODE (x); \
+  if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER) \
+    { \
+      rtx dest = SET_DEST (x); \
+      while ((GET_CODE (dest) == SUBREG \
+	      && (!REG_P (SUBREG_REG (dest)) \
+		  || REGNO (SUBREG_REG (dest)) >= FIRST_PSEUDO_REGISTER)) \
+	     || GET_CODE (dest) == ZERO_EXTRACT \
+	     || GET_CODE (dest) == STRICT_LOW_PART) \
+	dest = XEXP (dest, 0); \
+      /* If we have a PARALLEL, SET_DEST is a list of EXPR_LIST expressions, \
+	 each of whose first operand is a register.  */ \
+      if (GET_CODE (dest) == PARALLEL) \
+	{ \
+	  for (i = XVECLEN (dest, 0) - 1; i >= 0; i--) \
+	    if (XEXP (XVECEXP (dest, 0, i), 0) != 0) \
+	      (*fun) (XEXP (XVECEXP (dest, 0, i), 0), x, data); \
+	} \
+      else \
+	(*fun) (dest, x, data); \
+    } \
+  else if (GET_CODE (x) == PARALLEL) \
+    for (i = XVECLEN (x, 0) - 1; i >= 0; i--) \
+      NOTE_STORES_FN (XVECEXP (x, 0, i), fun, data); \
+} while (0)
+
 void
 note_stores (const_rtx x, void (*fun) (rtx, const_rtx, void *), void *data)
 {
-  int i;
-
-  if (GET_CODE (x) == COND_EXEC)
-    x = COND_EXEC_CODE (x);
+  NOTE_STORES_BODY(note_stores);
+}

-  if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER)
-    {
-      rtx dest = SET_DEST (x);
+void
+const_note_stores (const_rtx x, void (*fun) (const_rtx, const_rtx, const void *), const void *data)
+{
+  NOTE_STORES_BODY(const_note_stores);
+}

-      while ((GET_CODE (dest) == SUBREG
-	      && (!REG_P (SUBREG_REG (dest))
-		  || REGNO (SUBREG_REG (dest)) >= FIRST_PSEUDO_REGISTER))
-	     || GET_CODE (dest) == ZERO_EXTRACT
-	     || GET_CODE (dest) == STRICT_LOW_PART)
-	dest = XEXP (dest, 0);
-
-      /* If we have a PARALLEL, SET_DEST is a list of EXPR_LIST expressions,
-	 each of whose first operand is a register.  */
-      if (GET_CODE (dest) == PARALLEL)
-	{
-	  for (i = XVECLEN (dest, 0) - 1; i >= 0; i--)
-	    if (XEXP (XVECEXP (dest, 0, i), 0) != 0)
-	      (*fun) (XEXP (XVECEXP (dest, 0, i), 0), x, data);
-	}
-      else
-	(*fun) (dest, x, data);
-    }
+#undef NOTE_STORES_BODY

-  else if (GET_CODE (x) == PARALLEL)
-    for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
-      note_stores (XVECEXP (x, 0, i), fun, data);
-}

 /* Like notes_stores, but call FUN for each expression that is being
    referenced in PBODY, a pointer to the PATTERN of an insn.  We only call
@@ -3363,7 +3371,7 @@ find_first_parameter_load (rtx call_insn
    call instruction.  */

 bool
-keep_with_call_p (rtx insn)
+keep_with_call_p (const_rtx insn)
 {
   rtx set;

@@ -3384,7 +3392,7 @@ keep_with_call_p (rtx insn)
 	 if we can break or not.  */
       if (SET_DEST (set) == stack_pointer_rtx)
 	{
-	  rtx i2 = next_nonnote_insn (insn);
+	  const_rtx i2 = const_next_nonnote_insn (insn);
 	  if (i2 && keep_with_call_p (i2))
 	    return true;
 	}
diff -rup orig/egcc-SVN20070825/gcc/sched-deps.c egcc-SVN20070825/gcc/sched-deps.c
--- orig/egcc-SVN20070825/gcc/sched-deps.c	2007-08-23 12:12:28.000000000 -0400
+++ egcc-SVN20070825/gcc/sched-deps.c	2007-08-25 16:45:13.267230776 -0400
@@ -418,7 +418,7 @@ static bitmap_head *anti_dependency_cach
 static bitmap_head *spec_dependency_cache;
 static int cache_size;

-static int deps_may_trap_p (rtx);
+static int deps_may_trap_p (const_rtx);
 static void add_dependence_list (rtx, rtx, int, enum reg_note);
 static void add_dependence_list_and_free (rtx, rtx *, int, enum reg_note);
 static void delete_all_dependences (rtx);
@@ -429,8 +429,8 @@ static void sched_analyze_1 (struct deps
 static void sched_analyze_2 (struct deps *, rtx, rtx);
 static void sched_analyze_insn (struct deps *, rtx, rtx);

-static rtx sched_get_condition (rtx);
-static int conditions_mutex_p (rtx, rtx);
+static rtx sched_get_condition (const_rtx);
+static int conditions_mutex_p (const_rtx, const_rtx);

 static enum DEPS_ADJUST_RESULT maybe_add_or_update_dep_1 (dep_t, bool,
 							  rtx, rtx);
@@ -446,13 +446,13 @@ static void check_dep (dep_t, bool);
 /* Return nonzero if a load of the memory reference MEM can cause a trap.  */

 static int
-deps_may_trap_p (rtx mem)
+deps_may_trap_p (const_rtx mem)
 {
-  rtx addr = XEXP (mem, 0);
+  const_rtx addr = XEXP (mem, 0);

   if (REG_P (addr) && REGNO (addr) >= FIRST_PSEUDO_REGISTER)
     {
-      rtx t = get_reg_known_value (REGNO (addr));
+      const_rtx t = get_reg_known_value (REGNO (addr));
       if (t)
 	addr = t;
     }
@@ -462,7 +462,7 @@ deps_may_trap_p (rtx mem)
 /* Find the condition under which INSN is executed.  */

 static rtx
-sched_get_condition (rtx insn)
+sched_get_condition (const_rtx insn)
 {
   rtx pat = PATTERN (insn);
   rtx src;
@@ -498,7 +498,7 @@ sched_get_condition (rtx insn)
 /* Return nonzero if conditions COND1 and COND2 can never be both true.  */

 static int
-conditions_mutex_p (rtx cond1, rtx cond2)
+conditions_mutex_p (const_rtx cond1, const_rtx cond2)
 {
   if (COMPARISON_P (cond1)
       && COMPARISON_P (cond2)
@@ -512,7 +512,7 @@ conditions_mutex_p (rtx cond1, rtx cond2
 /* Return true if insn1 and insn2 can never depend on one another because
    the conditions under which they are executed are mutually exclusive.  */
 bool
-sched_insns_conditions_mutex_p (rtx insn1, rtx insn2)
+sched_insns_conditions_mutex_p (const_rtx insn1, const_rtx insn2)
 {
   rtx cond1, cond2;

@@ -542,7 +542,7 @@ sched_insns_conditions_mutex_p (rtx insn
    This function is used to switch sd_iterator to the next list.
    !!! For internal use only.  Might consider moving it to sched-int.h.  */
 void
-sd_next_list (rtx insn, sd_list_types_def *types_ptr,
+sd_next_list (const_rtx insn, sd_list_types_def *types_ptr,
 	      deps_list_t *list_ptr, bool *resolved_p_ptr)
 {
   sd_list_types_def types = *types_ptr;
@@ -587,7 +587,7 @@ sd_next_list (rtx insn, sd_list_types_de

 /* Return the summary size of INSN's lists defined by LIST_TYPES.  */
 int
-sd_lists_size (rtx insn, sd_list_types_def list_types)
+sd_lists_size (const_rtx insn, sd_list_types_def list_types)
 {
   int size = 0;

@@ -605,7 +605,7 @@ sd_lists_size (rtx insn, sd_list_types_d

 /* Return true if INSN's lists defined by LIST_TYPES are all empty.  */
 bool
-sd_lists_empty_p (rtx insn, sd_list_types_def list_types)
+sd_lists_empty_p (const_rtx insn, sd_list_types_def list_types)
 {
   return sd_lists_size (insn, list_types) == 0;
 }
diff -rup orig/egcc-SVN20070825/gcc/sched-int.h egcc-SVN20070825/gcc/sched-int.h
--- orig/egcc-SVN20070825/gcc/sched-int.h	2007-08-14 11:34:24.000000000 -0400
+++ egcc-SVN20070825/gcc/sched-int.h	2007-08-25 16:57:13.210222154 -0400
@@ -811,7 +811,7 @@ enum INSN_TRAP_CLASS
 extern void print_insn (char *, rtx, int);

 /* Functions in sched-deps.c.  */
-extern bool sched_insns_conditions_mutex_p (rtx, rtx);
+extern bool sched_insns_conditions_mutex_p (const_rtx, const_rtx);
 extern void add_dependence (rtx, rtx, enum reg_note);
 extern void sched_analyze (struct deps *, rtx, rtx);
 extern bool deps_pools_are_empty_p (void);
@@ -829,9 +829,9 @@ extern ds_t ds_merge (ds_t, ds_t);
 extern void debug_ds (ds_t);

 /* Functions in haifa-sched.c.  */
-extern int haifa_classify_insn (rtx);
+extern int haifa_classify_insn (const_rtx);
 extern void get_ebb_head_tail (basic_block, basic_block, rtx *, rtx *);
-extern int no_real_insns_p (rtx, rtx);
+extern int no_real_insns_p (const_rtx, const_rtx);

 extern void rm_other_notes (rtx, rtx);

@@ -845,7 +845,7 @@ extern void sched_finish (void);

 extern int try_ready (rtx);
 extern void * xrecalloc (void *, size_t, size_t, size_t);
-extern bool sched_insn_is_legitimate_for_speculation_p (rtx, ds_t);
+extern bool sched_insn_is_legitimate_for_speculation_p (const_rtx, ds_t);
 extern void unlink_bb_notes (basic_block, basic_block);
 extern void add_block (basic_block, basic_block);
 extern rtx bb_note (basic_block);
@@ -882,7 +882,7 @@ extern void debug_dependencies (rtx, rtx
 /* A type to hold above flags.  */
 typedef int sd_list_types_def;

-extern void sd_next_list (rtx, sd_list_types_def *, deps_list_t *, bool *);
+extern void sd_next_list (const_rtx, sd_list_types_def *, deps_list_t *, bool *);

 /* Iterator to walk through, resolve and delete dependencies.  */
 struct _sd_iterator
@@ -980,8 +980,8 @@ sd_iterator_next (sd_iterator_def *it_pt
        sd_iterator_cond (&(ITER), &(DEP));			\
        sd_iterator_next (&(ITER)))

-extern int sd_lists_size (rtx, sd_list_types_def);
-extern bool sd_lists_empty_p (rtx, sd_list_types_def);
+extern int sd_lists_size (const_rtx, sd_list_types_def);
+extern bool sd_lists_empty_p (const_rtx, sd_list_types_def);
 extern void sd_init_insn (rtx);
 extern void sd_finish_insn (rtx);
 extern dep_t sd_find_dep_between (rtx, rtx, bool);
diff -rup orig/egcc-SVN20070825/gcc/sdbout.c egcc-SVN20070825/gcc/sdbout.c
--- orig/egcc-SVN20070825/gcc/sdbout.c	2007-08-23 12:12:27.000000000 -0400
+++ egcc-SVN20070825/gcc/sdbout.c	2007-08-25 17:30:44.301813037 -0400
@@ -312,7 +312,7 @@ const struct gcc_debug_hooks sdb_debug_h
   sdbout_end_source_file,	         /* end_source_file */
   sdbout_begin_block,		         /* begin_block */
   sdbout_end_block,		         /* end_block */
-  debug_true_tree,		         /* ignore_block */
+  debug_true_const_tree,	         /* ignore_block */
   sdbout_source_line,		         /* source_line */
 #ifdef MIPS_DEBUGGING_INFO
   /* Defer on MIPS systems so that parameter descriptions follow
diff -rup orig/egcc-SVN20070825/gcc/tree-cfg.c egcc-SVN20070825/gcc/tree-cfg.c
--- orig/egcc-SVN20070825/gcc/tree-cfg.c	2007-08-16 10:44:50.000000000 -0400
+++ egcc-SVN20070825/gcc/tree-cfg.c	2007-08-25 13:39:43.417098635 -0400
@@ -104,7 +104,7 @@ static inline void change_bb_for_stmt (t

 /* Flowgraph optimization and cleanup.  */
 static void tree_merge_blocks (basic_block, basic_block);
-static bool tree_can_merge_blocks_p (basic_block, basic_block);
+static bool tree_can_merge_blocks_p (const_basic_block, const_basic_block);
 static void remove_bb (basic_block);
 static edge find_taken_edge_computed_goto (basic_block, tree);
 static edge find_taken_edge_cond_expr (basic_block, tree);
@@ -1135,10 +1135,10 @@ group_case_labels (void)
 /* Checks whether we can merge block B into block A.  */

 static bool
-tree_can_merge_blocks_p (basic_block a, basic_block b)
+tree_can_merge_blocks_p (const_basic_block a, const_basic_block b)
 {
-  tree stmt;
-  block_stmt_iterator bsi;
+  const_tree stmt;
+  const_block_stmt_iterator bsi;
   tree phi;

   if (!single_succ_p (a))
@@ -1158,7 +1158,7 @@ tree_can_merge_blocks_p (basic_block a,

   /* If A ends by a statement causing exceptions or something similar, we
      cannot merge the blocks.  */
-  stmt = last_stmt (a);
+  stmt = const_last_stmt (a);
   if (stmt && stmt_ends_bb_p (stmt))
     return false;

@@ -1184,9 +1184,9 @@ tree_can_merge_blocks_p (basic_block a,
     }

   /* Do not remove user labels.  */
-  for (bsi = bsi_start (b); !bsi_end_p (bsi); bsi_next (&bsi))
+  for (bsi = cbsi_start (b); !cbsi_end_p (bsi); cbsi_next (&bsi))
     {
-      stmt = bsi_stmt (bsi);
+      stmt = cbsi_stmt (bsi);
       if (TREE_CODE (stmt) != LABEL_EXPR)
 	break;
       if (!DECL_ARTIFICIAL (LABEL_EXPR_LABEL (stmt)))
@@ -2451,12 +2451,12 @@ is_ctrl_stmt (const_tree t)
    (e.g., a call to a non-returning function).  */

 bool
-is_ctrl_altering_stmt (tree t)
+is_ctrl_altering_stmt (const_tree t)
 {
-  tree call;
+  const_tree call;

   gcc_assert (t);
-  call = get_call_expr_in (t);
+  call = const_get_call_expr_in (t);
   if (call)
     {
       /* A non-pure/const CALL_EXPR alters flow control if the current
@@ -2558,7 +2558,7 @@ stmt_starts_bb_p (const_tree t, const_tr
 /* Return true if T should end a basic block.  */

 bool
-stmt_ends_bb_p (tree t)
+stmt_ends_bb_p (const_tree t)
 {
   return is_ctrl_stmt (t) || is_ctrl_altering_stmt (t);
 }
@@ -4860,7 +4860,7 @@ tree_redirect_edge_and_branch (edge e, b
    it to the destination of the other edge from E->src.  */

 static bool
-tree_can_remove_branch_p (edge e)
+tree_can_remove_branch_p (const_edge e)
 {
   if (e->flags & EDGE_ABNORMAL)
     return false;
@@ -4956,7 +4956,7 @@ tree_move_block_after (basic_block bb, b
 /* Return true if basic_block can be duplicated.  */

 static bool
-tree_can_duplicate_bb_p (basic_block bb ATTRIBUTE_UNUSED)
+tree_can_duplicate_bb_p (const_basic_block bb ATTRIBUTE_UNUSED)
 {
   return true;
 }
@@ -5917,10 +5917,10 @@ debug_loop_ir (void)
    otherwise.  */

 static bool
-tree_block_ends_with_call_p (basic_block bb)
+tree_block_ends_with_call_p (const_basic_block bb)
 {
-  block_stmt_iterator bsi = bsi_last (bb);
-  return get_call_expr_in (bsi_stmt (bsi)) != NULL;
+  const_block_stmt_iterator bsi = cbsi_last (bb);
+  return const_get_call_expr_in (cbsi_stmt (bsi)) != NULL;
 }


@@ -5928,9 +5928,9 @@ tree_block_ends_with_call_p (basic_block
    otherwise.  */

 static bool
-tree_block_ends_with_condjump_p (basic_block bb)
+tree_block_ends_with_condjump_p (const_basic_block bb)
 {
-  tree stmt = last_stmt (bb);
+  const_tree stmt = const_last_stmt (bb);
   return (stmt && TREE_CODE (stmt) == COND_EXPR);
 }

diff -rup orig/egcc-SVN20070825/gcc/tree-eh.c egcc-SVN20070825/gcc/tree-eh.c
--- orig/egcc-SVN20070825/gcc/tree-eh.c	2007-08-16 20:02:49.000000000 -0400
+++ egcc-SVN20070825/gcc/tree-eh.c	2007-08-25 13:25:11.526092746 -0400
@@ -148,14 +148,16 @@ remove_stmt_from_eh_region (tree t)
 }

 int
-lookup_stmt_eh_region_fn (struct function *ifun, tree t)
+lookup_stmt_eh_region_fn (struct function *ifun, const_tree t)
 {
   struct throw_stmt_node *p, n;

   if (!get_eh_throw_stmt_table (ifun))
     return -2;

-  n.stmt = t;
+  /* The CONST_CAST is okay because we don't modify n.stmt throughout
+     its scope, or the scope of p.  */
+  n.stmt = (tree) CONST_CAST (t);
   p = (struct throw_stmt_node *) htab_find (get_eh_throw_stmt_table (ifun),
                                             &n);

@@ -163,7 +165,7 @@ lookup_stmt_eh_region_fn (struct functio
 }

 int
-lookup_stmt_eh_region (tree t)
+lookup_stmt_eh_region (const_tree t)
 {
   /* We can get called from initialized data when -fnon-call-exceptions
      is on; prevent crash.  */
@@ -2032,7 +2034,7 @@ tree_could_throw_p (tree t)
 }

 bool
-tree_can_throw_internal (tree stmt)
+tree_can_throw_internal (const_tree stmt)
 {
   int region_nr;
   bool is_resx = false;
diff -rup orig/egcc-SVN20070825/gcc/tree-flow-inline.h egcc-SVN20070825/gcc/tree-flow-inline.h
--- orig/egcc-SVN20070825/gcc/tree-flow-inline.h	2007-08-21 20:03:30.000000000 -0400
+++ egcc-SVN20070825/gcc/tree-flow-inline.h	2007-08-25 12:44:44.390501306 -0400
@@ -611,7 +611,7 @@ addresses_taken (tree stmt)
 /* Return the PHI nodes for basic block BB, or NULL if there are no
    PHI nodes.  */
 static inline tree
-phi_nodes (basic_block bb)
+phi_nodes (const_basic_block bb)
 {
   gcc_assert (!(bb->flags & BB_RTL));
   if (!bb->il.tree)
diff -rup orig/egcc-SVN20070825/gcc/tree-flow.h egcc-SVN20070825/gcc/tree-flow.h
--- orig/egcc-SVN20070825/gcc/tree-flow.h	2007-08-25 11:25:46.000000000 -0400
+++ egcc-SVN20070825/gcc/tree-flow.h	2007-08-25 13:19:20.706244730 -0400
@@ -545,7 +545,7 @@ struct edge_prediction GTY((chain_next (
 };

 /* Accessors for basic block annotations.  */
-static inline tree phi_nodes (basic_block);
+static inline tree phi_nodes (const_basic_block);
 static inline void set_phi_nodes (basic_block, tree);

 /*---------------------------------------------------------------------------
@@ -721,9 +721,9 @@ extern void free_omp_regions (void);
 #define PENDING_STMT(e)	((e)->insns.t)

 extern void delete_tree_cfg_annotations (void);
-extern bool stmt_ends_bb_p (tree);
+extern bool stmt_ends_bb_p (const_tree);
 extern bool is_ctrl_stmt (const_tree);
-extern bool is_ctrl_altering_stmt (tree);
+extern bool is_ctrl_altering_stmt (const_tree);
 extern bool computed_goto_p (const_tree);
 extern bool simple_goto_p (const_tree);
 extern bool tree_can_make_abnormal_goto (const_tree);
@@ -1073,9 +1073,9 @@ static inline bool unmodifiable_var_p (c
 extern void make_eh_edges (tree);
 extern bool tree_could_trap_p (tree);
 extern bool tree_could_throw_p (tree);
-extern bool tree_can_throw_internal (tree);
+extern bool tree_can_throw_internal (const_tree);
 extern bool tree_can_throw_external (tree);
-extern int lookup_stmt_eh_region (tree);
+extern int lookup_stmt_eh_region (const_tree);
 extern void add_stmt_to_eh_region (tree, int);
 extern bool remove_stmt_from_eh_region (tree);
 extern bool maybe_clean_or_replace_eh_stmt (tree, tree);
diff -rup orig/egcc-SVN20070825/gcc/tree-gimple.c egcc-SVN20070825/gcc/tree-gimple.c
--- orig/egcc-SVN20070825/gcc/tree-gimple.c	2007-08-14 01:01:46.000000000 -0400
+++ egcc-SVN20070825/gcc/tree-gimple.c	2007-08-25 13:12:45.093649089 -0400
@@ -436,18 +436,28 @@ is_gimple_call_addr (tree t)
 /* If T makes a function call, return the corresponding CALL_EXPR operand.
    Otherwise, return NULL_TREE.  */

+#define GET_CALL_EXPR_IN_BODY do { \
+  /* FIXME tuples: delete the assertion below when conversion complete.  */ \
+  gcc_assert (TREE_CODE (t) != MODIFY_EXPR); \
+  if (TREE_CODE (t) == GIMPLE_MODIFY_STMT) \
+    t = GIMPLE_STMT_OPERAND (t, 1); \
+  if (TREE_CODE (t) == WITH_SIZE_EXPR) \
+    t = TREE_OPERAND (t, 0); \
+  if (TREE_CODE (t) == CALL_EXPR) \
+    return t; \
+  return NULL_TREE; \
+} while (0)
+
 tree
 get_call_expr_in (tree t)
 {
-  /* FIXME tuples: delete the assertion below when conversion complete.  */
-  gcc_assert (TREE_CODE (t) != MODIFY_EXPR);
-  if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
-    t = GIMPLE_STMT_OPERAND (t, 1);
-  if (TREE_CODE (t) == WITH_SIZE_EXPR)
-    t = TREE_OPERAND (t, 0);
-  if (TREE_CODE (t) == CALL_EXPR)
-    return t;
-  return NULL_TREE;
+  GET_CALL_EXPR_IN_BODY;
+}
+
+const_tree
+const_get_call_expr_in (const_tree t)
+{
+  GET_CALL_EXPR_IN_BODY;
 }

 /* Given a memory reference expression T, return its base address.
diff -rup orig/egcc-SVN20070825/gcc/tree-gimple.h egcc-SVN20070825/gcc/tree-gimple.h
--- orig/egcc-SVN20070825/gcc/tree-gimple.h	2007-07-26 23:03:41.000000000 -0400
+++ egcc-SVN20070825/gcc/tree-gimple.h	2007-08-25 13:13:39.697595156 -0400
@@ -90,6 +90,7 @@ extern bool is_gimple_non_addressable (t
 extern bool is_gimple_call_addr (tree);
 /* If T makes a function call, returns the CALL_EXPR operand.  */
 extern tree get_call_expr_in (tree t);
+extern const_tree const_get_call_expr_in (const_tree t);

 extern void recalculate_side_effects (tree);

diff -rup orig/egcc-SVN20070825/gcc/tree.c egcc-SVN20070825/gcc/tree.c
--- orig/egcc-SVN20070825/gcc/tree.c	2007-08-25 11:25:36.000000000 -0400
+++ egcc-SVN20070825/gcc/tree.c	2007-08-25 14:35:33.974292920 -0400
@@ -3811,20 +3811,28 @@ is_attribute_p (const char *attr, const_
    returns the first occurrence; the TREE_CHAIN of the return value should
    be passed back in if further occurrences are wanted.  */

+#define LOOKUP_ATTRIBUTE_BODY(TYPE) do { \
+  TYPE l; \
+  size_t attr_len = strlen (attr_name); \
+  for (l = list; l; l = TREE_CHAIN (l)) \
+    { \
+      gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE); \
+      if (is_attribute_with_length_p (attr_name, attr_len, TREE_PURPOSE (l))) \
+	return l; \
+    } \
+  return NULL_TREE; \
+} while (0)
+
 tree
 lookup_attribute (const char *attr_name, tree list)
 {
-  tree l;
-  size_t attr_len = strlen (attr_name);
-
-  for (l = list; l; l = TREE_CHAIN (l))
-    {
-      gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE);
-      if (is_attribute_with_length_p (attr_name, attr_len, TREE_PURPOSE (l)))
-	return l;
-    }
+  LOOKUP_ATTRIBUTE_BODY(tree);
+}

-  return NULL_TREE;
+const_tree
+const_lookup_attribute (const char *attr_name, const_tree list)
+{
+  LOOKUP_ATTRIBUTE_BODY(const_tree);
 }

 /* Remove any instances of attribute ATTR_NAME in LIST and return the
@@ -4757,7 +4765,7 @@ attribute_hash_list (const_tree list, ha
    equivalent to l1.  */

 int
-attribute_list_equal (tree l1, tree l2)
+attribute_list_equal (const_tree l1, const_tree l2)
 {
   return attribute_list_contained (l1, l2)
 	 && attribute_list_contained (l2, l1);
@@ -4772,9 +4780,9 @@ attribute_list_equal (tree l1, tree l2)
    correctly.  */

 int
-attribute_list_contained (tree l1, tree l2)
+attribute_list_contained (const_tree l1, const_tree l2)
 {
-  tree t1, t2;
+  const_tree t1, t2;

   /* First check the obvious, maybe the lists are identical.  */
   if (l1 == l2)
@@ -4793,11 +4801,11 @@ attribute_list_contained (tree l1, tree

   for (; t2 != 0; t2 = TREE_CHAIN (t2))
     {
-      tree attr;
-      for (attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), l1);
+      const_tree attr;
+      for (attr = const_lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)), l1);
 	   attr != NULL_TREE;
-	   attr = lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
-				    TREE_CHAIN (attr)))
+	   attr = const_lookup_attribute (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
+					  TREE_CHAIN (attr)))
 	{
 	  if (TREE_VALUE (t2) != NULL
 	      && TREE_CODE (TREE_VALUE (t2)) == TREE_LIST
diff -rup orig/egcc-SVN20070825/gcc/tree.h egcc-SVN20070825/gcc/tree.h
--- orig/egcc-SVN20070825/gcc/tree.h	2007-08-25 11:25:37.000000000 -0400
+++ egcc-SVN20070825/gcc/tree.h	2007-08-25 14:40:20.135554368 -0400
@@ -3998,8 +3998,8 @@ extern bool range_in_array_bounds_p (tre
 extern tree value_member (tree, tree);
 extern tree purpose_member (const_tree, tree);

-extern int attribute_list_equal (tree, tree);
-extern int attribute_list_contained (tree, tree);
+extern int attribute_list_equal (const_tree, const_tree);
+extern int attribute_list_contained (const_tree, const_tree);
 extern int tree_int_cst_equal (const_tree, const_tree);
 extern int tree_int_cst_lt (const_tree, const_tree);
 extern int tree_int_cst_compare (const_tree, const_tree);
@@ -4143,6 +4143,7 @@ extern int is_attribute_p (const char *,
    of the attribute or NULL_TREE if not found.  */

 extern tree lookup_attribute (const char *, tree);
+extern const_tree const_lookup_attribute (const char *, const_tree);

 /* Remove any instances of attribute ATTR_NAME in LIST and return the
    modified list.  */
diff -rup orig/egcc-SVN20070825/gcc/vmsdbgout.c egcc-SVN20070825/gcc/vmsdbgout.c
--- orig/egcc-SVN20070825/gcc/vmsdbgout.c	2007-08-23 12:12:22.000000000 -0400
+++ egcc-SVN20070825/gcc/vmsdbgout.c	2007-08-25 17:31:22.069800120 -0400
@@ -172,7 +172,7 @@ static void vmsdbgout_start_source_file
 static void vmsdbgout_end_source_file (unsigned int);
 static void vmsdbgout_begin_block (unsigned int, unsigned int);
 static void vmsdbgout_end_block (unsigned int, unsigned int);
-static bool vmsdbgout_ignore_block (tree);
+static bool vmsdbgout_ignore_block (const_tree);
 static void vmsdbgout_source_line (unsigned int, const char *);
 static void vmsdbgout_begin_prologue (unsigned int, const char *);
 static void vmsdbgout_end_prologue (unsigned int, const char *);
@@ -1363,7 +1363,7 @@ vmsdbgout_end_block (register unsigned l
 /* Not implemented in VMS Debug.  */

 static bool
-vmsdbgout_ignore_block (tree block)
+vmsdbgout_ignore_block (const_tree block)
 {
   bool retval = 0;



More information about the Gcc-patches mailing list