This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tuples] tree-cfg initial conversion


Hi folks.

I got a little carried away trying to convert too much at once, so I
decided to stop and clean up what I had so far.

This is a big chunk of the conversion.  There are many interdependencies
with the rest of the compiler, which is why it's taking so long.  I
converted a little bit beyond what was necessary in this first pass.

Diego, this is the same patch I sent you this morning, with a few typos
corrected.  There are no regressions, but obviously, the pass is not
activated.  I would appreciate if you could take a quick look before I
commit it.  If you can't, it's ok, but I'll wait till tommorrow to
commit.

There are no surprises.  The only thing that actually changed is that
that the location in a basic block is now an aggregate, not a pointer.
It makes things a lot easier with the gimple IL.

After this is in, I'd like to take a step back and fix most of the
warnings and FIXMEs in gimpl*.c, tree-flow-inline.h, and tree-flow.c.
We have various loose ends (say, gimplification of OMP) which I'd like
to tie up instead of propagating FIXMEs throughout the rest of the
passes.

Time for some margaritas and a deep tissue massage before the RSI starts
bitching.

Aldy

	* tree-ssa-operands.h (update_stmt_operands): Argument is now
	gimple.
	* tree-ssa-threadupdate.c (rederiction_block_p): Use gimple_nop_p
	instead of IS_EMPTY_STMT.
	* tree-ssa-loop-niter.c: Disable use of COND_EXPR_COND.
	* tree-pretty-print.c (dump_bb_header): Adjust for tuples.
	* cgraph.c (cgraph_add_new_function): Rename
	tree_register_cfg_hooks to gimple_register_cfg_hooks.
	* value-prof.c (set_histogram_value): Stmt type is now gimple.
	(gimple_histogram_value): Same.
	(gimple_remove_histogram_value): Same.
	(gimple_remove_stmt_histograms): Same.
	* tree.h (struct ssa_use_operand_d): Same.
	* value-prof.h (struct histogram_value_t): Same.
	Change gimple_*histogram* prototypes to use gimple instead of
	tree.
	* ipa-cp.c (ipcp_insert_stage): Rename tree_register_cfg_hooks to
	gimple_register_cfg_hooks.
	* cfghooks.c (gimple_register_cfg_hooks): Rename from
	tree_register_cfg_hooks.  Initialize cfg_hooks to gimple_cfg_hooks.
	(current_ir_type): Rename tree_cfg_hooks to gimple_cfg_hooks.
	* input.h (HAS_LOCATION): New.
	* cfghooks.h: Rename tree_cfg_hooks to gimple_cfg_hooks.  Rename
	tree_register_cfg_hooks to gimple_register_cfg_hooks.
	* omp-low.c (determine_parallel_type): Comment out code, and add
	fixme note.
	(expand_omp_parallel): Rename bb_stmt_list to bb_seq.
	(expand_omp_for_generic): Call gimple_omp_return_nowait_p.
	(expand_omp_for_static_nochunk): Same.
	(expand_omp_sections): Call gimple_omp_section_last_p.
	(expand_omp_single): Comment out call to find_omp_clause.
	Call gimple_omp_return_nowait_p.
	* cgraphunit.c: Rename tree_register_cfg_hooks to
	gimple_register_cfg_hooks.
	* tree-ssa-propagate.c: Comment out non working code.
	* matrix-reorg.c (matrix_reorg): Rename tree_register_cfg_hooks to
	gimple_register_cfg_hooks.
	* tree-eh.c (add_stmt_to_eh_region_fn): Change `t' type to gimple.
	Adjust accordingly.
	(add_stmt_to_eh_region): Same.
	(remove_stmt_from_eh_region_fn): Same.
	(remove_stmt_from_eh_region): Same.
	(lookup_stmt_eh_region_fn): Same.
	(lookup_stmt_eh_region): Same.
	(make_eh_edges): Adjust for tuples.
	(stmt_can_throw_internal): Rename from tree_can_throw_internal.
	Adjust for tuples.
	(maybe_clean_or_replace_eh_stmt): Arg types are now gimple.
	* tree-vectorizer.c: Rename tree_register_cfg_hooks to
	gimple_register_cfg_hooks.
	* tree-if-conv.c (combine_blocks): Adjust for tuples.
	* profile.c (branch_prob): Same.
	* tree-flow-inline.h (bb_for_stmt): Adjust for tuples.
	(get_lineno): Same.
	(noreturn_call_p): Same.
	(mark_stmt_modified): Same.
	(update_stmt): Same.
	(update_stmt_if_modified): Same.
	(stmt_modified_p): Same.
	(link_imm_use_stmt): Same.
	(relink_imm_use_stmt): Same.
	(single_imm_use): Same.
	(gimple_phi_arg_def): New.
	(gimple_phi_arg_edge): New.
	(phi_nodes): Adjust for tuples.
	(phi_nodes_ptr): Same.
	(set_phi_nodes): Same.
	(bb_seq): Rename from bb_stmt_list and adjust for tuples.
	(set_bb_seq): Rename from set_bb_stmt_list and adjust for tuples.
	(bsi_start): Adjust for tuples.
	(bsi_after_labels): Adjust for tuples.
	(bsi_last): Same.
	(bsi_next): Same.
	(bsi_prev): Same.
	(bsi_stmt): Same.
	(bsi_stmt_ptr): Same.
	(loop_containing_stmt): Same.
	(delink_stmt_imm_use): Same.
	(first_imm_use_stmt): Same.
	(next_imm_use_stmt): Same.
	* gimplify.c (force_gimple_operand_bsi): Same.
	* coretypes.h (const_gimple): New.
	* tree-ssa-phiopt.c (empty_block_p): Call gimple_nop_p.
	(conditional_replacement): Comment out COND_EXPR_COND.
	(value_replacement): Comment out COND_EXPR_COND.
	(minmax_replacement): Same.
	(abs_replacement): Same.
	* except.h (*eh_region*): Change trees to gimple.
	(struct throw_stmt_node): Change stmt type to gimple.
	* cfgexpand.c (label_rtx_for_bb): Adjust for tuples.
	(expand_gimple_cond_expr): Same.
	(expand_gimple_basic_block): Same.
	* tree-cfgcleanup.c (split_bbs_on_noreturn_calls): Same.
	* tree-ssa-pre.c (realify_fake_stores): Comment out non working
	code.
	* tree-ssa-forwprop.c (propagate_with_phi): Rename
	tree_can_throw_internal stmt_can_throw_internal.
	* tree-inline.c (copy_edges_for_bb): Rename
	tree_can_throw_internal to stmt_can_throw_internal.
	(initialize_cfun): Same.
	(copy_cfg_body): Same.
	(gimple_expand_calls_inline): Same.
	(make_nonlocal_label_edges): Rename tree_can_make_abnormal_goto to
	stmt_can_make_abnormal_goto.
	* tree-optimize.c (tree_lowering_passes): Rename
	tree_register_cfg_hooks to gimple_register_cfg_hooks.
	(tree_rest_of_compilation): Same.
	* tree-flow.h (struct gimple_df): Make modified_noreturn_calls a
	vector of gimple types.
	Adjust prototypes for tuples.
	(struct block_stmt_iterator): Make iterator a gimple iterator.
	(enum bsi_iterator_update): Remove BSI_CHAIN_START and
	BSI_CHAIN_END.
	* Makefile.in (tree-cfg.o): Depend on GIMPLE_H.
	(GTFILES): Move gimple.[hc] entries before tree-flow.h.
	* basic-block.h (struct edge_def): Make goto_locus of type
	location_t.
	(union basic_block_il_dependent): Adjust for tuples.
	(gimple_bb_info): Rename from tree_bb_info.  Adjust for tuples.
	* tree-cfg.c: Include gimple.h.
	Adjust prototypes for tuples.
	(build_gimple_cfg): Rename from build_tree_cfg.  Adjust for
	tuples.
	(execute_build_cfg): Rename build_tree_cfg call to
	build_gimple_cfg.
	(factor_computed_gotos): Adjust for tuples.
	(make_blocks): Same.
	(create_bb): Same.
	(fold_cond_expr_cond): Same.
	(make_edges): Same.
	(make_cond_expr_edges): Same.
	(make_switch_expr_edges): Same.
	(make_goto_expr_edges): Same.
	(cleanup_dead_labels): Same.
	(group_case_labels): Same.
	(tree_can_merge_blocks_p): Same.
	(replace_uses_by): Same.
	(tree_merge_blocks): Same.
	(is_ctrl): Same.
	(is_ctrl_altering_stmt): Same.
	(computed_goto_p): Same.
	(simple_goto_p): Same.
	(stmt_can_make_abnormal_goto): Rename from
	tree_can_make_abnormal_goto.
	Adjust for tuples.
	(stmt_starts_bb_p): Adjust for tuples.
	(stmt_ends_bb_p): Same.
	(first_stmt): Same.
	(last_stmt): Same.
	(last_and_only_stmt): Same.
	(set_bb_for_stmt): Same.
	(change_bb_for_stmt): Same.
	(bsi_for_stmt): Same.
	(update_modified_stmt): Rename from update_modified_stmts.
	Adjust for tuples.
	Handle only one statement.
	(bsi_insert_before): Adjust for tuples.
	(bsi_insert_after): Same.
	(bsi_insert_seq_before): New.
	(bsi_insert_seq_after): New.
	(bsi_remove): Ajust for tuples.
	(bsi_replace): Same.
	(verify_stmt): Same.
	(gimple_split_block): Rename from tree_split_block.
	Adjust for tuples.
	(tree_purge_dead_abnormal_call_edges): Adjust for tuples.
	(tree_cfg_hooks): Same.
	* tree-ssa-operands.c (update_stmt_operands): Same.
	* Makefile.in (TREE_GIMPLE_H): Depend on GIMPLE_H.
	* gimple-iterator.h: Do not include gimple.h.

Index: tree-ssa-operands.h
===================================================================
--- tree-ssa-operands.h	(revision 127694)
+++ tree-ssa-operands.h	(working copy)
@@ -205,7 +205,7 @@ typedef struct stmt_operands_d *stmt_ope
 extern void init_ssa_operands (void);
 extern void fini_ssa_operands (void);
 extern void free_ssa_operands (stmt_operands_p);
-extern void update_stmt_operands (tree);
+extern void update_stmt_operands (gimple);
 extern bool verify_imm_links (FILE *f, tree var);
 
 extern void copy_virtual_operands (tree, tree);
Index: tree-ssa-threadupdate.c
===================================================================
--- tree-ssa-threadupdate.c	(revision 127694)
+++ tree-ssa-threadupdate.c	(working copy)
@@ -469,7 +469,7 @@ redirection_block_p (basic_block bb)
   bsi = bsi_start (bb);
   while (!bsi_end_p (bsi)
           && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
-              || IS_EMPTY_STMT (bsi_stmt (bsi))))
+              || gimple_nop_p (bsi_stmt (bsi))))
     bsi_next (&bsi);
 
   /* Check if this is an empty block.  */
Index: tree-ssa-loop-niter.c
===================================================================
--- tree-ssa-loop-niter.c	(revision 127694)
+++ tree-ssa-loop-niter.c	(working copy)
@@ -426,7 +426,10 @@ bound_difference (struct loop *loop, tre
       if (!(e->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE)))
 	continue;
 
+      /* FIXME tuples
       cond = COND_EXPR_COND (last_stmt (e->src));
+      */
+      cond = NULL; /* FIXME tuples */
       if (!COMPARISON_CLASS_P (cond))
 	continue;
       c0 = TREE_OPERAND (cond, 0);
@@ -1605,7 +1608,10 @@ simplify_using_initial_conditions (struc
       if (!(e->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE)))
 	continue;
 
+      /* FIXME tuples
       cond = COND_EXPR_COND (last_stmt (e->src));
+      */
+      cond = NULL; /* FIXME tuples */
       if (e->flags & EDGE_FALSE_VALUE)
 	cond = invert_truthvalue (cond);
       expr = tree_simplify_using_condition (cond, expr);
Index: tree-pretty-print.c
===================================================================
--- tree-pretty-print.c	(revision 127694)
+++ tree-pretty-print.c	(working copy)
@@ -2881,7 +2881,7 @@ static void
 dump_bb_header (pretty_printer *buffer, basic_block bb, int indent, int flags)
 {
   edge e;
-  tree stmt;
+  gimple stmt;
   edge_iterator ei;
 
   if (flags & TDF_BLOCKS)
@@ -2932,7 +2932,7 @@ dump_bb_header (pretty_printer *buffer, 
   else
     {
       stmt = first_stmt (bb);
-      if (!stmt || TREE_CODE (stmt) != LABEL_EXPR)
+      if (!stmt || gimple_code (stmt) != GIMPLE_LABEL)
 	{
 	  INDENT (indent - 2);
 	  pp_string (buffer, "<bb ");
@@ -3062,7 +3062,7 @@ dump_implicit_edges (pretty_printer *buf
 #ifdef USE_MAPPED_LOCATION
 	  && e->goto_locus != UNKNOWN_LOCATION
 #else
-	  && e->goto_locus
+	  && HAS_LOCATION (e->goto_locus)
 #endif
 	  )
 	{
@@ -3070,7 +3070,7 @@ dump_implicit_edges (pretty_printer *buf
 #ifdef USE_MAPPED_LOCATION
 	  goto_xloc = expand_location (e->goto_locus);
 #else
-	  goto_xloc = *e->goto_locus;
+	  goto_xloc = e->goto_locus;
 #endif
 	  pp_character (buffer, '[');
 	  if (goto_xloc.file)
Index: cgraph.c
===================================================================
--- cgraph.c	(revision 127694)
+++ cgraph.c	(working copy)
@@ -996,7 +996,7 @@ cgraph_add_new_function (tree fndecl, bo
 	   to expansion.  */
 	push_cfun (DECL_STRUCT_FUNCTION (fndecl));
 	current_function_decl = fndecl;
-	tree_register_cfg_hooks ();
+	gimple_register_cfg_hooks ();
 	if (!lowered)
           tree_lowering_passes (fndecl);
 	bitmap_obstack_initialize (NULL);
Index: value-prof.c
===================================================================
--- value-prof.c	(revision 127694)
+++ value-prof.c	(working copy)
@@ -120,7 +120,7 @@ histogram_eq (const void *x, const void 
 /* Set histogram for STMT.  */
 
 static void
-set_histogram_value (struct function *fun, tree stmt, histogram_value hist)
+set_histogram_value (struct function *fun, gimple stmt, histogram_value hist)
 {
   void **loc;
   if (!hist && !VALUE_HISTOGRAMS (fun))
@@ -143,7 +143,7 @@ set_histogram_value (struct function *fu
 /* Get histogram list for STMT.  */
 
 histogram_value
-gimple_histogram_value (struct function *fun, tree stmt)
+gimple_histogram_value (struct function *fun, gimple stmt)
 {
   if (!VALUE_HISTOGRAMS (fun))
     return NULL;
@@ -163,7 +163,8 @@ gimple_add_histogram_value (struct funct
 /* Remove histogram HIST from STMT's histogram list.  */
 
 void
-gimple_remove_histogram_value (struct function *fun, tree stmt, histogram_value hist)
+gimple_remove_histogram_value (struct function *fun, gimple stmt,
+			       histogram_value hist)
 {
   histogram_value hist2 = gimple_histogram_value (fun, stmt);
   if (hist == hist2)
@@ -311,7 +312,7 @@ dump_histograms_for_stmt (struct functio
 /* Remove all histograms associated with STMT.  */
 
 void
-gimple_remove_stmt_histograms (struct function *fun, tree stmt)
+gimple_remove_stmt_histograms (struct function *fun, gimple stmt)
 {
   histogram_value val;
   while ((val = gimple_histogram_value (fun, stmt)) != NULL)
Index: value-prof.h
===================================================================
--- value-prof.h	(revision 127694)
+++ value-prof.h	(working copy)
@@ -46,7 +46,7 @@ struct histogram_value_t
   struct
     {
       tree value;		/* The value to profile.  */
-      tree stmt;		/* Insn containing the value.  */
+      gimple stmt;		/* Insn containing the value.  */
       gcov_type *counters;		        /* Pointer to first counter.  */
       struct histogram_value_t *next;		/* Linked list pointer.  */
     } hvalue;
@@ -109,13 +109,12 @@ struct profile_hooks {
   void (*gen_ior_profiler) (histogram_value, unsigned, unsigned);
 };
 
-histogram_value gimple_histogram_value (struct function *, tree);
+histogram_value gimple_histogram_value (struct function *, gimple);
 histogram_value gimple_histogram_value_of_type (struct function *, tree, enum hist_type);
 void gimple_add_histogram_value (struct function *, tree, histogram_value);
-void gimple_remove_histogram_value (struct function *, tree, histogram_value);
 void dump_histograms_for_stmt (struct function *, FILE *, tree);
-void gimple_remove_histogram_value (struct function *, tree, histogram_value);
-void gimple_remove_stmt_histograms (struct function *, tree);
+void gimple_remove_histogram_value (struct function *, gimple, histogram_value);
+void gimple_remove_stmt_histograms (struct function *, gimple);
 void gimple_duplicate_stmt_histograms (struct function *, tree, struct function *, tree);
 void verify_histograms (void);
 void free_histograms (void);
Index: tree.h
===================================================================
--- tree.h	(revision 127694)
+++ tree.h	(working copy)
@@ -1884,7 +1884,7 @@ typedef struct ssa_use_operand_d GTY(())
 {
   struct ssa_use_operand_d* GTY((skip(""))) prev;
   struct ssa_use_operand_d* GTY((skip(""))) next;
-  tree GTY((skip(""))) stmt;
+  gimple GTY((skip(""))) stmt;
   tree *GTY((skip(""))) use;
 } ssa_use_operand_t;
 
Index: ipa-cp.c
===================================================================
--- ipa-cp.c	(revision 127694)
+++ ipa-cp.c	(working copy)
@@ -1054,7 +1054,7 @@ ipcp_insert_stage (void)
       if (const_param > 0)
 	{
 	  push_cfun (DECL_STRUCT_FUNCTION (node1->decl));
-	  tree_register_cfg_hooks ();
+	  gimple_register_cfg_hooks ();
 	  current_function_decl = node1->decl;
 
 	  for (i = 0; i < count; i++)
Index: cfghooks.c
===================================================================
--- cfghooks.c	(revision 127694)
+++ cfghooks.c	(working copy)
@@ -50,9 +50,9 @@ cfg_layout_rtl_register_cfg_hooks (void)
 /* Initialization of functions specific to the tree IR.  */
 
 void
-tree_register_cfg_hooks (void)
+gimple_register_cfg_hooks (void)
 {
-  cfg_hooks = &tree_cfg_hooks;
+  cfg_hooks = &gimple_cfg_hooks;
 }
 
 /* Returns current ir type.  */
@@ -60,7 +60,7 @@ tree_register_cfg_hooks (void)
 enum ir_type
 current_ir_type (void)
 {
-  if (cfg_hooks == &tree_cfg_hooks)
+  if (cfg_hooks == &gimple_cfg_hooks)
     return IR_GIMPLE;
   else if (cfg_hooks == &rtl_cfg_hooks)
     return IR_RTL_CFGRTL;
Index: input.h
===================================================================
--- input.h	(revision 127694)
+++ input.h	(working copy)
@@ -92,6 +92,8 @@ extern void restore_input_file_stack (in
 #define LOCATION_FILE(LOC) ((expand_location (LOC)).file)
 #define LOCATION_LINE(LOC) ((expand_location (LOC)).line)
 
+#define HAS_LOCATION(LOC) (LOCATION_FILE ((LOC)) && LOCATION_LINE ((LOC)))
+
 #define input_line LOCATION_LINE(input_location)
 #define input_filename LOCATION_FILE(input_location)
 
Index: cfghooks.h
===================================================================
--- cfghooks.h	(revision 127694)
+++ cfghooks.h	(working copy)
@@ -181,7 +181,7 @@ extern void lv_add_condition_to_bb (basi
 				    void *);
 
 /* Hooks containers.  */
-extern struct cfg_hooks tree_cfg_hooks;
+extern struct cfg_hooks gimple_cfg_hooks;
 extern struct cfg_hooks rtl_cfg_hooks;
 extern struct cfg_hooks cfg_layout_rtl_cfg_hooks;
 
@@ -189,6 +189,6 @@ extern struct cfg_hooks cfg_layout_rtl_c
 extern enum ir_type current_ir_type (void);
 extern void rtl_register_cfg_hooks (void);
 extern void cfg_layout_rtl_register_cfg_hooks (void);
-extern void tree_register_cfg_hooks (void);
+extern void gimple_register_cfg_hooks (void);
 
 #endif  /* GCC_CFGHOOKS_H */
Index: omp-low.c
===================================================================
--- omp-low.c	(revision 127694)
+++ omp-low.c	(working copy)
@@ -389,9 +389,15 @@ determine_parallel_type (struct omp_regi
   if (single_succ (par_entry_bb) == ws_entry_bb
       && single_succ (ws_exit_bb) == par_exit_bb
       && workshare_safe_to_combine_p (par_entry_bb, ws_entry_bb)
+      /* FIXME tuples:
+	 Where are we going to put the OMP_PARALLEL_COMBINED bit in a
+	 tuple?  */
+      /*
       && (OMP_PARALLEL_COMBINED (last_stmt (par_entry_bb))
 	  || (last_and_only_stmt (ws_entry_bb)
 	      && last_and_only_stmt (par_exit_bb))))
+      */
+      )
     {
       tree ws_stmt = last_stmt (ws_entry_bb);
 
@@ -2497,7 +2503,7 @@ expand_omp_parallel (struct omp_region *
       /* Declare local variables needed in CHILD_CFUN.  */
       block = DECL_INITIAL (child_fn);
       BLOCK_VARS (block) = list2chain (child_cfun->unexpanded_var_list);
-      DECL_SAVED_TREE (child_fn) = bb_stmt_list (single_succ (entry_bb));
+      DECL_SAVED_TREE (child_fn) = bb_seq (single_succ (entry_bb));
 
       /* Reset DECL_CONTEXT on locals and function arguments.  */
       for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
@@ -2695,7 +2701,7 @@ expand_omp_for_generic (struct omp_regio
 
   /* Add the loop cleanup function.  */
   si = bsi_last (exit_bb);
-  if (OMP_RETURN_NOWAIT (bsi_stmt (si)))
+  if (gimple_omp_return_nowait_p (bsi_stmt (si)))
     t = built_in_decls[BUILT_IN_GOMP_LOOP_END_NOWAIT];
   else
     t = built_in_decls[BUILT_IN_GOMP_LOOP_END];
@@ -2872,7 +2878,7 @@ expand_omp_for_static_nochunk (struct om
 
   /* Replace the OMP_RETURN with a barrier, or nothing.  */
   si = bsi_last (exit_bb);
-  if (!OMP_RETURN_NOWAIT (bsi_stmt (si)))
+  if (!gimple_omp_return_nowait_p (bsi_stmt (si)))
     {
       list = alloc_stmt_list ();
       build_omp_barrier (&list);
@@ -3063,7 +3069,7 @@ expand_omp_for_static_chunk (struct omp_
 
   /* Replace the OMP_RETURN with a barrier, or nothing.  */
   si = bsi_last (exit_bb);
-  if (!OMP_RETURN_NOWAIT (bsi_stmt (si)))
+  if (!gimple_omp_return_nowait_p (bsi_stmt (si)))
     {
       list = alloc_stmt_list ();
       build_omp_barrier (&list);
@@ -3230,7 +3236,7 @@ expand_omp_sections (struct omp_region *
 
       si = bsi_last (s_entry_bb);
       gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_SECTION);
-      gcc_assert (i < len || OMP_SECTION_LAST (bsi_stmt (si)));
+      gcc_assert (i < len || gimple_omp_section_last_p (bsi_stmt (si)));
       bsi_remove (&si, true);
       single_succ_edge (s_entry_bb)->flags = EDGE_FALLTHRU;
 
@@ -3269,7 +3275,7 @@ expand_omp_sections (struct omp_region *
 
       /* Cleanup function replaces OMP_RETURN in EXIT_BB.  */
       si = bsi_last (l2_bb);
-      if (OMP_RETURN_NOWAIT (bsi_stmt (si)))
+      if (gimple_omp_return_nowait_p (bsi_stmt (si)))
 	t = built_in_decls[BUILT_IN_GOMP_SECTIONS_END_NOWAIT];
       else
 	t = built_in_decls[BUILT_IN_GOMP_SECTIONS_END];
@@ -3307,15 +3313,17 @@ expand_omp_single (struct omp_region *re
   /* The terminal barrier at the end of a GOMP_single_copy sequence cannot
      be removed.  We need to ensure that the thread that entered the single
      does not exit before the data is copied out by the other threads.  */
+  /* FIXME tuples
   if (find_omp_clause (OMP_SINGLE_CLAUSES (bsi_stmt (si)),
 		       OMP_CLAUSE_COPYPRIVATE))
     need_barrier = true;
+  */
   gcc_assert (TREE_CODE (bsi_stmt (si)) == OMP_SINGLE);
   bsi_remove (&si, true);
   single_succ_edge (entry_bb)->flags = EDGE_FALLTHRU;
 
   si = bsi_last (exit_bb);
-  if (!OMP_RETURN_NOWAIT (bsi_stmt (si)) || need_barrier)
+  if (!gimple_omp_return_nowait_p (bsi_stmt (si)) || need_barrier)
     {
       tree t = alloc_stmt_list ();
       build_omp_barrier (&t);
Index: cgraphunit.c
===================================================================
--- cgraphunit.c	(revision 127694)
+++ cgraphunit.c	(working copy)
@@ -372,7 +372,7 @@ cgraph_process_new_functions (void)
 	     transformations that has been already performed on the whole
 	     cgraph but not on this function.  */
 
-	  tree_register_cfg_hooks ();
+	  gimple_register_cfg_hooks ();
 	  if (!node->analyzed)
 	    cgraph_analyze_function (node);
 	  push_cfun (DECL_STRUCT_FUNCTION (fndecl));
@@ -769,7 +769,7 @@ cgraph_analyze_function (struct cgraph_n
   if (!flag_unit_at_a_time)
     {
       bitmap_obstack_initialize (NULL);
-      tree_register_cfg_hooks ();
+      gimple_register_cfg_hooks ();
       execute_pass_list (pass_early_local_passes.sub);
       free_dominance_info (CDI_POST_DOMINATORS);
       free_dominance_info (CDI_DOMINATORS);
@@ -1258,7 +1258,7 @@ ipa_passes (void)
 {
   cfun = NULL;
   current_function_decl = NULL;
-  tree_register_cfg_hooks ();
+  gimple_register_cfg_hooks ();
   bitmap_obstack_initialize (NULL);
   execute_ipa_pass_list (all_ipa_passes);
   bitmap_obstack_release (NULL);
Index: tree-ssa-propagate.c
===================================================================
--- tree-ssa-propagate.c	(revision 127694)
+++ tree-ssa-propagate.c	(working copy)
@@ -501,6 +501,8 @@ ssa_prop_init (void)
     if (ssa_name (i))
       SSA_NAME_VALUE (ssa_name (i)) = NULL_TREE;
 
+  /* FIXME tuples */
+#if 0
   /* Initially assume that every edge in the CFG is not executable.
      (including the edges coming out of ENTRY_BLOCK_PTR).  */
   FOR_ALL_BB (bb)
@@ -513,6 +515,7 @@ ssa_prop_init (void)
       FOR_EACH_EDGE (e, ei, bb->succs)
 	e->flags &= ~EDGE_EXECUTABLE;
     }
+#endif
 
   /* Seed the algorithm by adding the successors of the entry block to the
      edge worklist.  */
Index: matrix-reorg.c
===================================================================
--- matrix-reorg.c	(revision 127694)
+++ matrix-reorg.c	(working copy)
@@ -2228,7 +2228,7 @@ matrix_reorg (void)
 	current_function_decl = node->decl;
 	push_cfun (DECL_STRUCT_FUNCTION (node->decl));
 	bitmap_obstack_initialize (NULL);
-	tree_register_cfg_hooks ();
+	gimple_register_cfg_hooks ();
 
 	if (!gimple_in_ssa_p (cfun))
 	  {
@@ -2293,7 +2293,7 @@ matrix_reorg (void)
 	current_function_decl = node->decl;
 	push_cfun (DECL_STRUCT_FUNCTION (node->decl));
 	bitmap_obstack_initialize (NULL);
-	tree_register_cfg_hooks ();
+	gimple_register_cfg_hooks ();
 	record_all_accesses_in_func ();
 	htab_traverse (matrices_to_reorg, transform_access_sites, NULL);
 	free_dominance_info (CDI_DOMINATORS);
Index: tree-eh.c
===================================================================
--- tree-eh.c	(revision 127694)
+++ tree-eh.c	(working copy)
@@ -92,13 +92,13 @@ record_stmt_eh_region (struct eh_region 
 }
 
 void
-add_stmt_to_eh_region_fn (struct function *ifun, tree t, int num)
+add_stmt_to_eh_region_fn (struct function *ifun, gimple t, int num)
 {
   struct throw_stmt_node *n;
   void **slot;
 
   gcc_assert (num >= 0);
-  gcc_assert (TREE_CODE (t) != RESX_EXPR);
+  gcc_assert (gimple_code (t) != GIMPLE_RESX);
 
   n = GGC_NEW (struct throw_stmt_node);
   n->stmt = t;
@@ -115,13 +115,13 @@ add_stmt_to_eh_region_fn (struct functio
 }
 
 void
-add_stmt_to_eh_region (tree t, int num)
+add_stmt_to_eh_region (gimple t, int num)
 {
   add_stmt_to_eh_region_fn (cfun, t, num);
 }
 
 bool
-remove_stmt_from_eh_region_fn (struct function *ifun, tree t)
+remove_stmt_from_eh_region_fn (struct function *ifun, gimple t)
 {
   struct throw_stmt_node dummy;
   void **slot;
@@ -142,13 +142,13 @@ remove_stmt_from_eh_region_fn (struct fu
 }
 
 bool
-remove_stmt_from_eh_region (tree t)
+remove_stmt_from_eh_region (gimple t)
 {
   return remove_stmt_from_eh_region_fn (cfun, t);
 }
 
 int
-lookup_stmt_eh_region_fn (struct function *ifun, tree t)
+lookup_stmt_eh_region_fn (struct function *ifun, gimple t)
 {
   struct throw_stmt_node *p, n;
 
@@ -163,7 +163,7 @@ lookup_stmt_eh_region_fn (struct functio
 }
 
 int
-lookup_stmt_eh_region (tree t)
+lookup_stmt_eh_region (gimple t)
 {
   /* We can get called from initialized data when -fnon-call-exceptions
      is on; prevent crash.  */
@@ -1723,14 +1723,14 @@ make_eh_edge (struct eh_region *region, 
 }
 
 void
-make_eh_edges (tree stmt)
+make_eh_edges (gimple stmt)
 {
   int region_nr;
   bool is_resx;
 
-  if (TREE_CODE (stmt) == RESX_EXPR)
+  if (gimple_code (stmt) == GIMPLE_RESX)
     {
-      region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0));
+      region_nr = gimple_resx_region (stmt);
       is_resx = true;
     }
   else
@@ -2013,13 +2013,16 @@ tree_could_throw_p (tree t)
 }
 
 bool
-tree_can_throw_internal (tree stmt)
+stmt_can_throw_internal (gimple stmt)
 {
   int region_nr;
   bool is_resx = false;
 
-  if (TREE_CODE (stmt) == RESX_EXPR)
-    region_nr = TREE_INT_CST_LOW (TREE_OPERAND (stmt, 0)), is_resx = true;
+  if (gimple_code (stmt) == GIMPLE_RESX)
+    {
+      region_nr = gimple_resx_region (stmt);
+      is_resx = true;
+    }
   else
     region_nr = lookup_stmt_eh_region (stmt);
   if (region_nr < 0)
@@ -2049,7 +2052,7 @@ tree_can_throw_external (tree stmt)
    done that my require an EH edge purge.  */
 
 bool 
-maybe_clean_or_replace_eh_stmt (tree old_stmt, tree new_stmt) 
+maybe_clean_or_replace_eh_stmt (gimple old_stmt, gimple new_stmt) 
 {
   int region_nr = lookup_stmt_eh_region (old_stmt);
 
Index: tree-vectorizer.c
===================================================================
--- tree-vectorizer.c	(revision 127694)
+++ tree-vectorizer.c	(working copy)
@@ -1068,7 +1068,7 @@ slpeel_tree_peel_loop_to_edge (struct lo
    cfg_hooks->split_edge, the function tree_split_edge 
    is actually called and, when calling cfg_hooks->duplicate_block,
    the function tree_duplicate_bb is called.  */
-  tree_register_cfg_hooks ();
+  gimple_register_cfg_hooks ();
 
 
   /* 1. Generate a copy of LOOP and put it on E (E is the entry/exit of LOOP).
Index: tree-if-conv.c
===================================================================
--- tree-if-conv.c	(revision 127694)
+++ tree-if-conv.c	(working copy)
@@ -983,9 +983,9 @@ combine_blocks (struct loop *loop)
 	}
 
       /* Update stmt list.  */
-      last = tsi_last (bb_stmt_list (merge_target_bb));
-      tsi_link_after (&last, bb_stmt_list (bb), TSI_NEW_STMT);
-      set_bb_stmt_list (bb, NULL);
+      last = tsi_last (bb_seq (merge_target_bb));
+      tsi_link_after (&last, bb_seq (bb), TSI_NEW_STMT);
+      set_bb_seq (bb, NULL);
 
       delete_basic_block (bb);
     }
Index: profile.c
===================================================================
--- profile.c	(revision 127694)
+++ profile.c	(working copy)
@@ -812,7 +812,7 @@ branch_prob (void)
 	     if (blah) goto something;
 	     is not computed twice.  */
 	  if (last && EXPR_LOCUS (last)
-	      && e->goto_locus
+	      && HAS_LOCATION (e->goto_locus)
 	      && !single_succ_p (bb)
 #ifdef USE_MAPPED_LOCATION
 	      && (LOCATION_FILE (e->goto_locus)
@@ -820,8 +820,9 @@ branch_prob (void)
 		  || (LOCATION_LINE (e->goto_locus)
 		      != LOCATION_LINE (EXPR_LOCATION  (last)))))
 #else
-	      && (e->goto_locus->file != EXPR_LOCUS (last)->file
-		  || (e->goto_locus->line != EXPR_LOCUS (last)->line)))
+	      && (LOCATION_FILE (e->goto_locus) != EXPR_LOCUS (last)->file
+		  || (LOCATION_LINE (e->goto_locus)
+		      != EXPR_LOCUS (last)->line)))
 #endif
 	    {
 	      basic_block new = split_edge (e);
@@ -1018,18 +1019,13 @@ branch_prob (void)
 
 	  /* Notice GOTO expressions we eliminated while constructing the
 	     CFG.  */
-	  if (single_succ_p (bb) && single_succ_edge (bb)->goto_locus)
+	  if (single_succ_p (bb)
+	      && HAS_LOCATION (single_succ_edge (bb)->goto_locus))
 	    {
-	      /* ??? source_locus type is marked deprecated in input.h.  */
-	      source_locus curr_location = single_succ_edge (bb)->goto_locus;
+	      location_t curr_location = single_succ_edge (bb)->goto_locus;
 	      /* ??? The FILE/LINE API is inconsistent for these cases.  */
-#ifdef USE_MAPPED_LOCATION 
 	      output_location (LOCATION_FILE (curr_location),
 			       LOCATION_LINE (curr_location), &offset, bb);
-#else
-	      output_location (curr_location->file, curr_location->line,
-			       &offset, bb);
-#endif
 	    }
 
 	  if (offset)
Index: tree-flow-inline.h
===================================================================
--- tree-flow-inline.h	(revision 127694)
+++ tree-flow-inline.h	(working copy)
@@ -291,15 +291,9 @@ ann_type (tree_ann_t ann)
 
 /* Return the basic block for statement T.  */
 static inline basic_block
-bb_for_stmt (tree t)
+bb_for_stmt (gimple t)
 {
-  stmt_ann_t ann;
-
-  if (TREE_CODE (t) == PHI_NODE)
-    return PHI_BB (t);
-
-  ann = stmt_ann (t);
-  return ann ? ann->bb : NULL;
+  return gimple_bb (t);
 }
 
 /* Return the may_aliases bitmap for variable VAR, or NULL if it has
@@ -313,56 +307,53 @@ may_aliases (const_tree var)
 /* Return the line number for EXPR, or return -1 if we have no line
    number information for it.  */
 static inline int
-get_lineno (tree expr)
+get_lineno (gimple stmt)
 {
-  if (expr == NULL_TREE)
-    return -1;
-
-  if (TREE_CODE (expr) == COMPOUND_EXPR)
-    expr = TREE_OPERAND (expr, 0);
-
-  if (! EXPR_HAS_LOCATION (expr))
-    return -1;
+  if (!stmt)
+    return;
 
-  return EXPR_LINENO (expr);
+  return gimple_locus (stmt).line;
 }
 
 /* Return true if T is a noreturn call.  */
 static inline bool
-noreturn_call_p (tree t)
+noreturn_call_p (gimple t)
 {
-  tree call = get_call_expr_in (t);
-  return call != 0 && (call_expr_flags (call) & ECF_NORETURN) != 0;
+  if (gimple_code (t) != GIMPLE_CALL)
+    return false;
+  return (gimple_call_flags (t) & ECF_NORETURN) != 0;
 }
 
 /* Mark statement T as modified.  */
 static inline void
-mark_stmt_modified (tree t)
+mark_stmt_modified (gimple t)
 {
-  stmt_ann_t ann;
-  if (TREE_CODE (t) == PHI_NODE)
+  if (gimple_code (t) == GIMPLE_PHI)
     return;
 
-  ann = stmt_ann (t);
-  if (ann == NULL)
-    ann = create_stmt_ann (t);
-  else if (noreturn_call_p (t) && cfun->gimple_df)
-    VEC_safe_push (tree, gc, MODIFIED_NORETURN_CALLS (cfun), t);
-  ann->modified = 1;
+  if (noreturn_call_p (t) && cfun->gimple_df)
+    VEC_safe_push (gimple, gc, MODIFIED_NORETURN_CALLS (cfun), t);
+  set_gimple_modified (t, true);
 }
 
 /* Mark statement T as modified, and update it.  */
 static inline void
-update_stmt (tree t)
+update_stmt (gimple t)
 {
-  if (TREE_CODE (t) == PHI_NODE)
+  /* Not needed, since GIMPLE_PHI's do not have ops.
+  if (gimple_code (t) == GIMPLE_PHI)
     return;
-  mark_stmt_modified (t);
-  update_stmt_operands (t);
+  */
+
+  if (gimple_has_ops (t))
+    {
+      mark_stmt_modified (t);
+      update_stmt_operands (t);
+    }
 }
 
 static inline void
-update_stmt_if_modified (tree t)
+update_stmt_if_modified (gimple t)
 {
   if (stmt_modified_p (t))
     update_stmt_operands (t);
@@ -370,14 +361,21 @@ update_stmt_if_modified (tree t)
 
 /* Return true if T is marked as modified, false otherwise.  */
 static inline bool
-stmt_modified_p (tree t)
+stmt_modified_p (gimple t)
 {
-  stmt_ann_t ann = stmt_ann (t);
+  return gimple_modified (t);
 
+  /* FIXME tuples:
+
+     We previously had the code below, but we no longer have
+     annotations per se, so we must now initialize the modify flag in
+     the operand scanner to true.  */
+#if 0
   /* Note that if the statement doesn't yet have an annotation, we consider it
      modified.  This will force the next call to update_stmt_operands to scan 
      the statement.  */
   return ann ? ann->modified : true;
+#endif
 }
 
 /* Delink an immediate_uses node from its chain.  */
@@ -437,7 +435,7 @@ set_ssa_use_from_ptr (use_operand_p use,
 /* Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring 
    in STMT.  */
 static inline void
-link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, tree stmt)
+link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, gimple stmt)
 {
   if (stmt)
     link_imm_use (linknode, def);
@@ -466,7 +464,8 @@ relink_imm_use (ssa_use_operand_t *node,
 /* Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring 
    in STMT.  */
 static inline void
-relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old, tree stmt)
+relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old,
+		     gimple stmt)
 {
   if (stmt)
     relink_imm_use (linknode, old);
@@ -542,7 +541,7 @@ has_single_use (const_tree var)
 /* If VAR has only a single immediate use, return true, and set USE_P and STMT
    to the use pointer and stmt of occurrence.  */
 static inline bool
-single_imm_use (const_tree var, use_operand_p *use_p, tree *stmt)
+single_imm_use (const_tree var, use_operand_p *use_p, gimple *stmt)
 {
   const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
   if (ptr != ptr->next && ptr == ptr->next->next)
@@ -552,7 +551,7 @@ single_imm_use (const_tree var, use_oper
       return true;
     }
   *use_p = NULL_USE_OPERAND_P;
-  *stmt = NULL_TREE;
+  *stmt = NULL;
   return false;
 }
 
@@ -599,6 +598,26 @@ get_phi_arg_def_ptr (tree phi, int i)
 }
 
 
+/* Convenience functions for GIMPLE_PHI.  */
+
+/* Convenience function analogous to PHI_ARG_DEF.  */
+
+static inline tree
+gimple_phi_arg_def (gimple gs, unsigned int index)
+{
+  struct phi_arg_d *pd = gimple_phi_arg (gs, index);
+  return get_use_from_ptr (&pd->imm_use);
+}
+
+/* Convenience function analogous to PHI_ARG_EDGE.  */
+
+static inline edge
+gimple_phi_arg_edge (gimple gs, unsigned int i)
+{
+  return EDGE_PRED (gimple_bb (gs), i);
+}
+
+
 /* Return the bitmap of addresses taken by STMT, or NULL if it takes
    no addresses.  */
 static inline bitmap
@@ -610,13 +629,13 @@ addresses_taken (tree stmt)
 
 /* Return the PHI nodes for basic block BB, or NULL if there are no
    PHI nodes.  */
-static inline tree
+static inline gimple_seq
 phi_nodes (basic_block bb)
 {
   gcc_assert (!(bb->flags & BB_RTL));
-  if (!bb->il.tree)
+  if (!bb->il.gimple)
     return NULL;
-  return bb->il.tree->phi_nodes;
+  return bb->il.gimple->phi_nodes;
 }
 
 /* Return pointer to the list of PHI nodes for basic block BB.  */
@@ -625,20 +644,20 @@ static inline tree *
 phi_nodes_ptr (basic_block bb)
 {
   gcc_assert (!(bb->flags & BB_RTL));
-  return &bb->il.tree->phi_nodes;
+  return &bb->il.gimple->phi_nodes;
 }
 
-/* Set list of phi nodes of a basic block BB to L.  */
+/* Phi nodes of a basic block BB to L.  */
 
 static inline void
-set_phi_nodes (basic_block bb, tree l)
+set_phi_nodes (basic_block bb, gimple_seq seq)
 {
-  tree phi;
+  gimple_stmt_iterator *i;
 
   gcc_assert (!(bb->flags & BB_RTL));
-  bb->il.tree->phi_nodes = l;
-  for (phi = l; phi; phi = PHI_CHAIN (phi))
-    set_bb_for_stmt (phi, bb);
+  bb->il.gimple->phi_nodes = seq;
+  for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (i))
+    set_bb_for_stmt (gsi_stmt (i), bb);
 }
 
 /* Return the phi argument which contains the specified use.  */
@@ -710,22 +729,22 @@ phi_ssa_name_p (const_tree t)
 
 /*  -----------------------------------------------------------------------  */
 
-/* Returns the list of statements in BB.  */
+/* Returns the sequence of statements in BB.  */
 
-static inline tree
-bb_stmt_list (basic_block bb)
+static inline gimple_seq
+bb_seq (basic_block bb)
 {
   gcc_assert (!(bb->flags & BB_RTL));
-  return bb->il.tree->stmt_list;
+  return bb->il.gimple->seq;
 }
 
-/* Sets the list of statements in BB to LIST.  */
+/* Sets the sequence of statements in BB to SEQ.  */
 
 static inline void
-set_bb_stmt_list (basic_block bb, tree list)
+set_bb_seq (basic_block bb, gimple_seq seq)
 {
   gcc_assert (!(bb->flags & BB_RTL));
-  bb->il.tree->stmt_list = list;
+  bb->il.gimple->seq = seq;
 }
 
 /* Return a block_stmt_iterator that points to beginning of basic
@@ -736,11 +755,11 @@ bsi_start (basic_block bb)
   block_stmt_iterator bsi;
   if (bb->index < NUM_FIXED_BLOCKS)
     {
-      bsi.tsi.ptr = NULL;
-      bsi.tsi.container = NULL;
+      bsi.gsi->stmt = NULL;
+      bsi.gsi->seq = NULL;
     }
   else
-    bsi.tsi = tsi_start (bb_stmt_list (bb));
+    bsi.gsi = gsi_start (bb_seq (bb));
   bsi.bb = bb;
   return bsi;
 }
@@ -753,7 +772,7 @@ bsi_after_labels (basic_block bb)
 {
   block_stmt_iterator bsi = bsi_start (bb);
 
-  while (!bsi_end_p (bsi) && TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
+  while (!bsi_end_p (bsi) && gimple_code (bsi_stmt (bsi)) == GIMPLE_LABEL)
     bsi_next (&bsi);
 
   return bsi;
@@ -768,11 +787,11 @@ bsi_last (basic_block bb)
 
   if (bb->index < NUM_FIXED_BLOCKS)
     {
-      bsi.tsi.ptr = NULL;
-      bsi.tsi.container = NULL;
+      bsi.gsi->stmt = NULL;
+      bsi.gsi->seq = NULL;
     }
   else
-    bsi.tsi = tsi_last (bb_stmt_list (bb));
+    bsi.gsi = gsi_last (bb_seq (bb));
   bsi.bb = bb;
   return bsi;
 }
@@ -782,7 +801,7 @@ bsi_last (basic_block bb)
 static inline bool
 bsi_end_p (block_stmt_iterator i)
 {
-  return tsi_end_p (i.tsi);
+  return gsi_end_p (i.gsi);
 }
 
 /* Modify block statement iterator I so that it is at the next
@@ -790,7 +809,7 @@ bsi_end_p (block_stmt_iterator i)
 static inline void
 bsi_next (block_stmt_iterator *i)
 {
-  tsi_next (&i->tsi);
+  gsi_next (i->gsi);
 }
 
 /* Modify block statement iterator I so that it is at the previous
@@ -798,15 +817,15 @@ bsi_next (block_stmt_iterator *i)
 static inline void
 bsi_prev (block_stmt_iterator *i)
 {
-  tsi_prev (&i->tsi);
+  gsi_prev (i->gsi);
 }
 
 /* Return the statement that block statement iterator I is currently
    at.  */
-static inline tree
+static inline gimple
 bsi_stmt (block_stmt_iterator i)
 {
-  return tsi_stmt (i.tsi);
+  return gsi_stmt (i.gsi);
 }
 
 /* Return a pointer to the statement that block statement iterator I
@@ -814,13 +833,16 @@ bsi_stmt (block_stmt_iterator i)
 static inline tree *
 bsi_stmt_ptr (block_stmt_iterator i)
 {
+  /* FIXME tuples!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   return tsi_stmt_ptr (i.tsi);
+  */
+  return NULL;
 }
 
 /* Returns the loop of the statement STMT.  */
 
 static inline struct loop *
-loop_containing_stmt (tree stmt)
+loop_containing_stmt (gimple stmt)
 {
   basic_block bb = bb_for_stmt (stmt);
   if (!bb)
@@ -1256,7 +1278,7 @@ num_ssa_operands (tree stmt, int flags)
 
 /* Delink all immediate_use information for STMT.  */
 static inline void
-delink_stmt_imm_use (tree stmt)
+delink_stmt_imm_use (gimple stmt)
 {
    ssa_op_iter iter;
    use_operand_p use_p;
@@ -1465,7 +1487,7 @@ link_use_stmts_after (use_operand_p head
 }
 
 /* Initialize IMM to traverse over uses of VAR.  Return the first statement.  */
-static inline tree
+static inline gimple
 first_imm_use_stmt (imm_use_iterator *imm, tree var)
 {
   gcc_assert (TREE_CODE (var) == SSA_NAME);
@@ -1479,11 +1501,11 @@ first_imm_use_stmt (imm_use_iterator *im
      stmt and use, which indicates a marker node.  */
   imm->iter_node.prev = NULL_USE_OPERAND_P;
   imm->iter_node.next = NULL_USE_OPERAND_P;
-  imm->iter_node.stmt = NULL_TREE;
+  imm->iter_node.stmt = NULL;
   imm->iter_node.use = NULL_USE_OPERAND_P;
 
   if (end_imm_use_stmt_p (imm))
-    return NULL_TREE;
+    return NULL;
 
   link_use_stmts_after (imm->imm_use, imm);
 
@@ -1492,7 +1514,7 @@ first_imm_use_stmt (imm_use_iterator *im
 
 /* Bump IMM to the next stmt which has a use of var.  */
 
-static inline tree
+static inline gimple
 next_imm_use_stmt (imm_use_iterator *imm)
 {
   imm->imm_use = imm->iter_node.next;
Index: gimplify.c
===================================================================
--- gimplify.c	(revision 127694)
+++ gimplify.c	(working copy)
@@ -6800,24 +6800,22 @@ force_gimple_operand_bsi (block_stmt_ite
   struct gimple_sequence stmts;
 
   expr = force_gimple_operand (expr, &stmts, simple_p, var);
-#if 0
-/* FIXME tuples */
-  if (stmts)
+
+  if (!gimple_seq_empty_p (&stmts))
     {
       if (gimple_in_ssa_p (cfun))
 	{
-	  tree_stmt_iterator tsi;
+	  gimple_stmt_iterator *gsi;
 
-	  for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
-	    mark_symbols_for_renaming (tsi_stmt (tsi));
+	  for (gsi = gsi_start (&stmts); !gsi_end_p (gsi); gsi_next (gsi))
+	    mark_symbols_for_renaming (gsi_stmt (gsi));
 	}
 
       if (before)
-	bsi_insert_before (bsi, stmts, m);
+	bsi_insert_seq_before (bsi, &stmts, m);
       else
-	bsi_insert_after (bsi, stmts, m);
+	bsi_insert_seq_after (bsi, &stmts, m);
     }
-#endif
 
   return expr;
 }
Index: coretypes.h
===================================================================
--- coretypes.h	(revision 127694)
+++ coretypes.h	(working copy)
@@ -50,6 +50,7 @@ typedef union tree_node *tree;
 union gimple_statement_d;
 typedef union gimple_statement_d *gimple;
 typedef const union tree_node *const_tree;
+typedef const union gimple_statement_d *const_gimple;
 union section;
 typedef union section section;
 struct gimple_sequence;
Index: tree-ssa-phiopt.c
===================================================================
--- tree-ssa-phiopt.c	(revision 127694)
+++ tree-ssa-phiopt.c	(working copy)
@@ -305,7 +305,7 @@ empty_block_p (basic_block bb)
   bsi = bsi_start (bb);
   while (!bsi_end_p (bsi)
 	  && (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
-	      || IS_EMPTY_STMT (bsi_stmt (bsi))))
+	      || gimple_nop_p (bsi_stmt (bsi))))
     bsi_next (&bsi);
 
   if (!bsi_end_p (bsi))
@@ -397,7 +397,10 @@ conditional_replacement (basic_block con
      variable to optimize this case as it would likely create
      non-gimple code when the condition was converted to the
      result's type.  */
+  /* FIXME tuples
   cond = COND_EXPR_COND (last_stmt (cond_bb));
+  */
+  cond = NULL; /* FIXME tuples */
   result = PHI_RESULT (phi);
   if (TREE_CODE (cond) != SSA_NAME
       && !useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (cond)))
@@ -554,7 +557,10 @@ value_replacement (basic_block cond_bb, 
   if (!empty_block_p (middle_bb))
     return false;
 
+  /* FIXME tuples
   cond = COND_EXPR_COND (last_stmt (cond_bb));
+  */
+  cond = NULL; /* FIXME tuples */
 
   /* This transformation is only valid for equality comparisons.  */
   if (TREE_CODE (cond) != NE_EXPR && TREE_CODE (cond) != EQ_EXPR)
@@ -634,7 +640,10 @@ minmax_replacement (basic_block cond_bb,
   if (HONOR_NANS (TYPE_MODE (type)))
     return false;
 
+  /* FIXME tuples
   cond = COND_EXPR_COND (last_stmt (cond_bb));
+  */
+  cond = NULL; /* FIXME tuples */
   cmp = TREE_CODE (cond);
   result = PHI_RESULT (phi);
 
@@ -914,7 +923,10 @@ abs_replacement (basic_block cond_bb, ba
       && !(lhs == arg1 && rhs == arg0))
     return false;
 
+  /* FIXME tuples
   cond = COND_EXPR_COND (last_stmt (cond_bb));
+  */
+  cond = NULL; /* FIXME tuples */
   result = PHI_RESULT (phi);
 
   /* Only relationals comparing arg[01] against zero are interesting.  */
Index: except.h
===================================================================
--- except.h	(revision 127694)
+++ except.h	(working copy)
@@ -110,10 +110,10 @@ extern bool eh_region_outer_p (struct fu
 extern int eh_region_outermost (struct function *, int, int);
 
 /* 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 void add_stmt_to_eh_region_fn (struct function *, gimple, int);
+extern bool remove_stmt_from_eh_region_fn (struct function *, gimple);
+extern int lookup_stmt_eh_region_fn (struct function *, gimple);
+extern int lookup_stmt_eh_region (gimple);
 extern bool verify_eh_edges (tree);
 
 /* If non-NULL, this is a function that returns an expression to be
@@ -169,7 +169,7 @@ extern tree (*lang_eh_runtime_type) (tre
 
 struct throw_stmt_node GTY(())
 {
-  tree stmt;
+  gimple stmt;
   int region_nr;
 };
 
Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 127694)
+++ cfgexpand.c	(working copy)
@@ -1252,8 +1252,9 @@ static struct pointer_map_t *lab_rtx_for
 static rtx
 label_rtx_for_bb (basic_block bb)
 {
-  tree_stmt_iterator tsi;
-  tree lab, lab_stmt;
+  tree_stmt_iterator *gsi;
+  tree lab;
+  gimple lab_stmt;
   void **elt;
 
   if (bb->flags & BB_RTL)
@@ -1265,13 +1266,13 @@ label_rtx_for_bb (basic_block bb)
 
   /* Find the tree label if it is present.  */
      
-  for (tsi = tsi_start (bb_stmt_list (bb)); !tsi_end_p (tsi); tsi_next (&tsi))
+  for (gsi = gsi_start (bb_seq (bb)); !gsi_end_p (gsi); gsi_next (gsi))
     {
-      lab_stmt = tsi_stmt (tsi);
-      if (TREE_CODE (lab_stmt) != LABEL_EXPR)
+      lab_stmt = gsi_stmt (gsi);
+      if (gimple_code (lab_stmt) != GIMPLE_LABEL)
 	break;
 
-      lab = LABEL_EXPR_LABEL (lab_stmt);
+      lab = gimple_label_label (lab_stmt);
       if (DECL_NONLOCAL (lab))
 	break;
 
@@ -1319,8 +1320,8 @@ expand_gimple_cond_expr (basic_block bb,
       jumpif (pred, label_rtx_for_bb (true_edge->dest));
       add_reg_br_prob_note (last, true_edge->probability);
       maybe_dump_rtl_for_tree_stmt (stmt, last);
-      if (true_edge->goto_locus)
-  	set_curr_insn_source_location (*true_edge->goto_locus);
+      if (HAS_LOCATION (true_edge->goto_locus))
+  	set_curr_insn_source_location (true_edge->goto_locus);
       false_edge->flags |= EDGE_FALLTHRU;
       return NULL;
     }
@@ -1329,8 +1330,8 @@ expand_gimple_cond_expr (basic_block bb,
       jumpifnot (pred, label_rtx_for_bb (false_edge->dest));
       add_reg_br_prob_note (last, false_edge->probability);
       maybe_dump_rtl_for_tree_stmt (stmt, last);
-      if (false_edge->goto_locus)
-  	set_curr_insn_source_location (*false_edge->goto_locus);
+      if (HAS_LOCATION (false_edge->goto_locus))
+  	set_curr_insn_source_location (false_edge->goto_locus);
       true_edge->flags |= EDGE_FALLTHRU;
       return NULL;
     }
@@ -1360,8 +1361,8 @@ expand_gimple_cond_expr (basic_block bb,
 
   maybe_dump_rtl_for_tree_stmt (stmt, last2);
 
-  if (false_edge->goto_locus)
-    set_curr_insn_source_location (*false_edge->goto_locus);
+  if (HAS_LOCATION (false_edge->goto_locus))
+    set_curr_insn_source_location (false_edge->goto_locus);
 
   return new_bb;
 }
@@ -1479,7 +1480,7 @@ static basic_block
 expand_gimple_basic_block (basic_block bb)
 {
   tree_stmt_iterator tsi;
-  tree stmts = bb_stmt_list (bb);
+  tree stmts = bb_seq (bb);
   tree stmt = NULL;
   rtx note, last;
   edge e;
@@ -1493,7 +1494,7 @@ expand_gimple_basic_block (basic_block b
 	       bb->index);
     }
 
-  bb->il.tree = NULL;
+  bb->il.gimple = NULL;
   init_rtl_bb_info (bb);
   bb->flags |= BB_RTL;
 
@@ -1627,8 +1628,8 @@ expand_gimple_basic_block (basic_block b
   if (e && e->dest != bb->next_bb)
     {
       emit_jump (label_rtx_for_bb (e->dest));
-      if (e->goto_locus)
-        set_curr_insn_source_location (*e->goto_locus);
+      if (HAS_LOCATION (e->goto_locus))
+        set_curr_insn_source_location (e->goto_locus);
       e->flags &= ~EDGE_FALLTHRU;
     }
 
Index: tree-cfgcleanup.c
===================================================================
--- tree-cfgcleanup.c	(revision 127694)
+++ tree-cfgcleanup.c	(working copy)
@@ -490,9 +490,9 @@ split_bbs_on_noreturn_calls (void)
 
   /* Detect cases where a mid-block call is now known not to return.  */
   if (cfun->gimple_df)
-    while (VEC_length (tree, MODIFIED_NORETURN_CALLS (cfun)))
+    while (VEC_length (gimple, MODIFIED_NORETURN_CALLS (cfun)))
       {
-	stmt = VEC_pop (tree, MODIFIED_NORETURN_CALLS (cfun));
+	stmt = VEC_pop (gimple, MODIFIED_NORETURN_CALLS (cfun));
 	bb = bb_for_stmt (stmt);
 	if (bb == NULL
 	    || last_stmt (bb) == stmt
Index: tree-ssa-pre.c
===================================================================
--- tree-ssa-pre.c	(revision 127694)
+++ tree-ssa-pre.c	(working copy)
@@ -3192,6 +3192,8 @@ insert_fake_stores (void)
 static void
 realify_fake_stores (void)
 {
+  /* FIXME tuples */
+#if 0
   unsigned int i;
   tree stmt;
 
@@ -3222,6 +3224,7 @@ realify_fake_stores (void)
       else
 	release_defs (stmt);
     }
+#endif
 }
 
 /* Given an SSA_NAME, see if SCCVN has a value number for it, and if
Index: tree-ssa-forwprop.c
===================================================================
--- tree-ssa-forwprop.c	(revision 127694)
+++ tree-ssa-forwprop.c	(working copy)
@@ -1256,7 +1256,7 @@ propagate_with_phi (basic_block bb, tree
 	    && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == INDIRECT_REF
 	    && TREE_OPERAND (GIMPLE_STMT_OPERAND (use_stmt, 1), 0) == ptr
 	    /* We cannot replace a load that may throw or is volatile.  */
-	    && !tree_can_throw_internal (use_stmt)))
+	    && !stmt_can_throw_internal (use_stmt)))
 	continue;
 
       /* Check if we can move the loads.  The def stmts of all virtual uses
Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 127694)
+++ tree-inline.c	(working copy)
@@ -1021,7 +1021,7 @@ copy_edges_for_bb (basic_block bb, int c
          into a COMPONENT_REF which doesn't.  If the copy
          can throw, the original could also throw.  */
 
-      if (tree_can_throw_internal (copy_stmt))
+      if (stmt_can_throw_internal (copy_stmt))
 	{
 	  if (!bsi_end_p (bsi))
 	    /* Note that bb's predecessor edges aren't necessarily
@@ -1113,7 +1113,7 @@ initialize_cfun (tree new_fndecl, tree c
     frequency_scale = count_scale;
 
   /* Register specific tree functions.  */
-  tree_register_cfg_hooks ();
+  gimple_register_cfg_hooks ();
   *new_cfun = *DECL_STRUCT_FUNCTION (callee_fndecl);
   new_cfun->funcdef_no = get_next_funcdef_no ();
   VALUE_HISTOGRAMS (new_cfun) = NULL;
@@ -1178,7 +1178,7 @@ copy_cfg_body (copy_body_data * id, gcov
     frequency_scale = count_scale;
 
   /* Register specific tree functions.  */
-  tree_register_cfg_hooks ();
+  gimple_register_cfg_hooks ();
 
   /* Must have a CFG here at this point.  */
   gcc_assert (ENTRY_BLOCK_PTR_FOR_FUNCTION
@@ -2668,7 +2668,7 @@ gimple_expand_calls_inline (basic_block 
   block_stmt_iterator bsi;
 
   /* Register specific tree functions.  */
-  tree_register_cfg_hooks ();
+  gimple_register_cfg_hooks ();
   for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
     {
       tree *expr_p = bsi_stmt_ptr (bsi);
@@ -2739,7 +2739,7 @@ make_nonlocal_label_edges (void)
       for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
 	{
 	  tree stmt = bsi_stmt (bsi);
-	  if (tree_can_make_abnormal_goto (stmt))
+	  if (stmt_can_make_abnormal_goto (stmt))
 	    {
 	      if (stmt == bsi_stmt (bsi_last (bb)))
 		{
Index: tree-optimize.c
===================================================================
--- tree-optimize.c	(revision 127694)
+++ tree-optimize.c	(working copy)
@@ -362,7 +362,7 @@ tree_lowering_passes (tree fn)
 
   current_function_decl = fn;
   push_cfun (DECL_STRUCT_FUNCTION (fn));
-  tree_register_cfg_hooks ();
+  gimple_register_cfg_hooks ();
   bitmap_obstack_initialize (NULL);
   execute_pass_list (all_lowering_passes);
   if (optimize && cgraph_global_info_ready)
@@ -406,7 +406,7 @@ tree_rest_of_compilation (tree fndecl)
      not safe to try to expand expressions involving them.  */
   cfun->x_dont_save_pending_sizes_p = 1;
   
-  tree_register_cfg_hooks ();
+  gimple_register_cfg_hooks ();
 
   bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL generation*/
   /* Perform all tree transforms and optimizations.  */
Index: tree-flow.h
===================================================================
--- tree-flow.h	(revision 127694)
+++ tree-flow.h	(working copy)
@@ -122,12 +122,12 @@ struct gimple_df GTY(())
   /* Array of all variables referenced in the function.  */
   htab_t GTY((param_is (struct int_tree_map))) referenced_vars;
 
-  /* A list of all the noreturn calls passed to modify_stmt.
+  /* A vector of all the noreturn calls passed to modify_stmt.
      cleanup_control_flow uses it to detect cases where a mid-block
      indirect call has been turned into a noreturn call.  When this
      happens, all the instructions after the call are no longer
      reachable and must be deleted as dead.  */
-  VEC(tree,gc) *modified_noreturn_calls;
+  VEC(gimple,gc) *modified_noreturn_calls;
 
   /* Array of all SSA_NAMEs used in the function.  */
   VEC(tree,gc) *ssa_names;
@@ -528,13 +528,13 @@ static inline stmt_ann_t stmt_ann (tree)
 static inline bool has_stmt_ann (tree);
 static inline stmt_ann_t get_stmt_ann (tree);
 static inline enum tree_ann_type ann_type (tree_ann_t);
-static inline basic_block bb_for_stmt (tree);
-extern void set_bb_for_stmt (tree, basic_block);
-static inline bool noreturn_call_p (tree);
-static inline void update_stmt (tree);
-static inline bool stmt_modified_p (tree);
+static inline basic_block bb_for_stmt (gimple);
+extern void set_bb_for_stmt (gimple, basic_block);
+static inline bool noreturn_call_p (gimple);
+static inline void update_stmt (gimple);
+static inline bool stmt_modified_p (gimple);
 static inline bitmap may_aliases (const_tree);
-static inline int get_lineno (tree);
+static inline int get_lineno (gimple);
 static inline bitmap addresses_taken (tree);
 
 /*---------------------------------------------------------------------------
@@ -549,8 +549,8 @@ struct edge_prediction GTY((chain_next (
 };
 
 /* Accessors for basic block annotations.  */
-static inline tree phi_nodes (basic_block);
-static inline void set_phi_nodes (basic_block, tree);
+static inline gimple_seq phi_nodes (basic_block);
+static inline void set_phi_nodes (basic_block, gimple_seq);
 
 /*---------------------------------------------------------------------------
 			      Global declarations
@@ -624,18 +624,18 @@ extern bool referenced_var_check_and_ins
 ---------------------------------------------------------------------------*/
 
 typedef struct {
-  tree_stmt_iterator tsi;
+  gimple_stmt_iterator *gsi;
   basic_block bb;
 } block_stmt_iterator;
 
 static inline block_stmt_iterator bsi_start (basic_block);
 static inline block_stmt_iterator bsi_last (basic_block);
 static inline block_stmt_iterator bsi_after_labels (basic_block);
-block_stmt_iterator bsi_for_stmt (tree);
+block_stmt_iterator bsi_for_stmt (gimple);
 static inline bool bsi_end_p (block_stmt_iterator);
 static inline void bsi_next (block_stmt_iterator *);
 static inline void bsi_prev (block_stmt_iterator *);
-static inline tree bsi_stmt (block_stmt_iterator);
+static inline gimple bsi_stmt (block_stmt_iterator);
 static inline tree * bsi_stmt_ptr (block_stmt_iterator);
 
 extern void bsi_remove (block_stmt_iterator *, bool);
@@ -649,17 +649,19 @@ enum bsi_iterator_update
      mean exactly the same as their TSI_* counterparts.  */
   BSI_NEW_STMT,
   BSI_SAME_STMT,
-  BSI_CHAIN_START,
-  BSI_CHAIN_END,
   BSI_CONTINUE_LINKING
 };
 
-extern void bsi_insert_before (block_stmt_iterator *, tree,
+extern void bsi_insert_before (block_stmt_iterator *, gimple,
 			       enum bsi_iterator_update);
-extern void bsi_insert_after (block_stmt_iterator *, tree,
+extern void bsi_insert_after (block_stmt_iterator *, gimple,
 			      enum bsi_iterator_update);
+extern void bsi_insert_seq_before (block_stmt_iterator *, gimple_seq,
+				   enum bsi_iterator_update);
+extern void bsi_insert_seq_after (block_stmt_iterator *, gimple_seq,
+				  enum bsi_iterator_update);
 
-extern void bsi_replace (const block_stmt_iterator *, tree, bool);
+extern void bsi_replace (const block_stmt_iterator *, gimple, bool);
 
 /*---------------------------------------------------------------------------
 			      OpenMP Region Tree
@@ -718,12 +720,12 @@ 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 is_ctrl_stmt (const_tree);
-extern bool is_ctrl_altering_stmt (tree);
-extern bool computed_goto_p (const_tree);
-extern bool simple_goto_p (const_tree);
-extern bool tree_can_make_abnormal_goto (const_tree);
+extern bool stmt_ends_bb_p (gimple);
+extern bool is_ctrl_stmt (const_gimple);
+extern bool is_ctrl_altering_stmt (gimple);
+extern bool computed_goto_p (const_gimple);
+extern bool simple_goto_p (const_gimple);
+extern bool stmt_can_make_abnormal_goto (const_gimple);
 extern basic_block single_noncomplex_succ (basic_block bb);
 extern void tree_dump_bb (basic_block, FILE *, int);
 extern void debug_tree_bb (basic_block);
@@ -736,9 +738,9 @@ extern void debug_loop_ir (void);
 extern void print_loop_ir (FILE *);
 extern void cleanup_dead_labels (void);
 extern void group_case_labels (void);
-extern tree first_stmt (basic_block);
-extern tree last_stmt (basic_block);
-extern tree last_and_only_stmt (basic_block);
+extern gimple first_stmt (basic_block);
+extern gimple last_stmt (basic_block);
+extern gimple last_and_only_stmt (basic_block);
 extern edge find_taken_edge (basic_block, tree);
 extern basic_block label_to_block_fn (struct function *, tree);
 #define label_to_block(t) (label_to_block_fn (cfun, t))
@@ -1065,15 +1067,14 @@ static inline void set_is_used (tree);
 static inline bool unmodifiable_var_p (const_tree);
 
 /* In tree-eh.c  */
-extern void make_eh_edges (tree);
+extern void make_eh_edges (gimple);
 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_external (tree);
-extern int lookup_stmt_eh_region (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);
+extern bool stmt_can_throw_internal (gimple);
+extern int lookup_stmt_eh_region (gimple);
+extern void add_stmt_to_eh_region (gimple, int);
+extern bool remove_stmt_from_eh_region (gimple);
+extern bool maybe_clean_or_replace_eh_stmt (gimple, gimple);
 
 /* In tree-ssa-pre.c  */
 void add_to_value (tree, tree);
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 127694)
+++ Makefile.in	(working copy)
@@ -2061,7 +2061,7 @@ tree-cfg.o : tree-cfg.c $(TREE_FLOW_H) $
    $(DIAGNOSTIC_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
    $(TREE_DUMP_H) except.h langhooks.h $(CFGLOOP_H) tree-pass.h \
    $(CFGLAYOUT_H) $(BASIC_BLOCK_H) hard-reg-set.h toplev.h \
-   tree-ssa-propagate.h
+   tree-ssa-propagate.h $(GIMPLE_H)
 tree-cfgcleanup.o : tree-cfgcleanup.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
    $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) $(FLAGS_H) output.h \
    $(DIAGNOSTIC_H) toplev.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
@@ -3068,6 +3068,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/co
   $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/cfglayout.h \
   $(srcdir)/sdbout.c $(srcdir)/stor-layout.c \
   $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
+  $(srcdir)/gimple.h $(srcdir)/gimple.c \
   $(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h $(srcdir)/tree-scalar-evolution.c \
   $(srcdir)/tree-ssanames.c $(srcdir)/tree-eh.c $(srcdir)/tree-ssa-address.c \
   $(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \
@@ -3080,7 +3081,6 @@ GTFILES = $(srcdir)/input.h $(srcdir)/co
   $(srcdir)/tree-ssa-structalias.c \
   $(srcdir)/omp-low.c $(srcdir)/varpool.c \
   $(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \
-  $(srcdir)/gimple.h $(srcdir)/gimple.c \
   @all_gtfiles@
 
 GTFILES_H = $(subst /,-, $(subst $(srcdir)/,gt-, $(subst .c,.h, \
Index: basic-block.h
===================================================================
--- basic-block.h	(revision 127694)
+++ basic-block.h	(working copy)
@@ -130,7 +130,7 @@ struct edge_def GTY(())
   PTR GTY ((skip (""))) aux;
 
   /* Location of any goto implicit in the edge, during tree-ssa.  */
-  source_locus goto_locus;
+  location_t goto_locus;
 
   int flags;			/* see EDGE_* below  */
   int probability;		/* biased by REG_BR_PROB_BASE */
@@ -231,7 +231,7 @@ struct basic_block_def GTY((chain_next (
   struct basic_block_def *next_bb;
 
   union basic_block_il_dependent {
-      struct tree_bb_info * GTY ((tag ("0"))) tree;
+      struct gimple_bb_info * GTY ((tag ("0"))) gimple;
       struct rtl_bb_info * GTY ((tag ("1"))) rtl;
     } GTY ((desc ("((%1.flags & BB_RTL) != 0)"))) il;
 
@@ -266,13 +266,15 @@ struct rtl_bb_info GTY(())
   int visited;
 };
 
-struct tree_bb_info GTY(())
+struct gimple_bb_info GTY(())
 {
-  /* Pointers to the first and last trees of the block.  */
-  tree stmt_list;
+  /* FIXME tuples: Arghh, these should be struct gimple_sequence, not
+     pointers.  */
+  /* Statements in a block.  */
+  gimple_seq seq;
 
-  /* Chain of PHI nodes for this block.  */
-  tree phi_nodes;
+  /* PHI nodes for this block.  */
+  gimple_seq phi_nodes;
 };
 
 typedef struct basic_block_def *basic_block;
@@ -383,7 +385,7 @@ struct control_flow_graph GTY(())
   int x_last_basic_block;
 
   /* Mapping of labels to their associated blocks.  At present
-     only used for the tree CFG.  */
+     only used for the gimple CFG.  */
   VEC(basic_block,gc) *x_label_to_block_map;
 
   enum profile_status {
Index: tree-cfg.c
===================================================================
--- tree-cfg.c	(revision 127694)
+++ tree-cfg.c	(working copy)
@@ -46,6 +46,7 @@ along with GCC; see the file COPYING3.  
 #include "tree-ssa-propagate.h"
 #include "value-prof.h"
 #include "pointer-set.h"
+#include "gimple.h"
 
 /* This file contains functions for building the Control Flow Graph (CFG)
    for a function tree.  */
@@ -83,7 +84,7 @@ static bool found_computed_goto;
 
 /* Basic blocks and flowgraphs.  */
 static basic_block create_bb (void *, void *, basic_block);
-static void make_blocks (tree);
+static void make_blocks (gimple_seq);
 static void factor_computed_gotos (void);
 
 /* Edges.  */
@@ -96,11 +97,11 @@ static edge tree_try_redirect_by_replaci
 static unsigned int split_critical_edges (void);
 
 /* Various helpers.  */
-static inline bool stmt_starts_bb_p (const_tree, const_tree);
+static inline bool stmt_starts_bb_p (const_gimple, const_gimple);
 static int tree_verify_flow_info (void);
 static void tree_make_forwarder_block (edge);
 static void tree_cfg2vcg (FILE *);
-static inline void change_bb_for_stmt (tree t, basic_block bb);
+static inline void change_bb_for_stmt (gimple, basic_block);
 
 /* Flowgraph optimization and cleanup.  */
 static void tree_merge_blocks (basic_block, basic_block);
@@ -138,21 +139,21 @@ init_empty_tree_cfg (void)
 			      Create basic blocks
 ---------------------------------------------------------------------------*/
 
-/* Entry point to the CFG builder for trees.  TP points to the list of
+/* Entry point to the CFG builder for trees.  SEQ to the sequence of
    statements to be added to the flowgraph.  */
 
 static void
-build_tree_cfg (tree *tp)
+build_gimple_cfg (gimple_seq seq)
 {
-  /* Register specific tree functions.  */
-  tree_register_cfg_hooks ();
+  /* Register specific gimple functions.  */
+  gimple_register_cfg_hooks ();
 
   memset ((void *) &cfg_stats, 0, sizeof (cfg_stats));
 
   init_empty_tree_cfg ();
 
   found_computed_goto = 0;
-  make_blocks (*tp);
+  make_blocks (seq);
 
   /* Computed gotos are hell to deal with, especially if there are
      lots of them with a large number of destinations.  So we factor
@@ -207,7 +208,7 @@ build_tree_cfg (tree *tp)
 static unsigned int
 execute_build_cfg (void)
 {
-  build_tree_cfg (&DECL_SAVED_TREE (current_function_decl));
+  build_gimple_cfg (gimple_body (current_function_decl));
   set_gimple_body (current_function_decl, NULL);
   return 0;
 }
@@ -241,8 +242,8 @@ factor_computed_gotos (void)
   basic_block bb;
   tree factored_label_decl = NULL;
   tree var = NULL;
-  tree factored_computed_goto_label = NULL;
-  tree factored_computed_goto = NULL;
+  gimple factored_computed_goto_label = NULL;
+  gimple factored_computed_goto = NULL;
 
   /* We know there are one or more computed gotos in this function.
      Examine the last statement in each basic block to see if the block
@@ -251,7 +252,7 @@ factor_computed_gotos (void)
   FOR_EACH_BB (bb)
     {
       block_stmt_iterator bsi = bsi_last (bb);
-      tree last;
+      gimple last;
 
       if (bsi_end_p (bsi))
 	continue;
@@ -265,7 +266,7 @@ factor_computed_gotos (void)
       /* If the last statement is a computed goto, factor it.  */
       if (computed_goto_p (last))
 	{
-	  tree assignment;
+	  gimple assignment;
 
 	  /* The first time we find a computed goto we need to create
 	     the factored goto block and the variable each original
@@ -285,54 +286,53 @@ factor_computed_gotos (void)
 		 factored computed goto.  */
 	      factored_label_decl = create_artificial_label ();
 	      factored_computed_goto_label
-		= build1 (LABEL_EXPR, void_type_node, factored_label_decl);
+		= build_gimple_label (factored_label_decl);
 	      bsi_insert_after (&new_bsi, factored_computed_goto_label,
 				BSI_NEW_STMT);
 
 	      /* Build our new computed goto.  */
-	      factored_computed_goto = build1 (GOTO_EXPR, void_type_node, var);
+	      factored_computed_goto = build_gimple_goto (var);
 	      bsi_insert_after (&new_bsi, factored_computed_goto,
 				BSI_NEW_STMT);
 	    }
 
 	  /* Copy the original computed goto's destination into VAR.  */
-	  assignment = build_gimple_modify_stmt (var,
-						 GOTO_DESTINATION (last));
+	  assignment = build_gimple_assign (var, gimple_goto_dest (last));
 	  bsi_insert_before (&bsi, assignment, BSI_SAME_STMT);
 
 	  /* And re-vector the computed goto to the new destination.  */
-	  GOTO_DESTINATION (last) = factored_label_decl;
+	  gimple_goto_set_dest (last, factored_label_decl);
 	}
     }
 }
 
 
-/* Build a flowgraph for the statement_list STMT_LIST.  */
+/* Build a flowgraph for the sequence of stmts SEQ.  */
 
 static void
-make_blocks (tree stmt_list)
+make_blocks (gimple_seq seq)
 {
-  tree_stmt_iterator i = tsi_start (stmt_list);
-  tree stmt = NULL;
+  gimple_stmt_iterator *i = gsi_start (seq);
+  gimple stmt = NULL;
   bool start_new_block = true;
-  bool first_stmt_of_list = true;
+  bool first_stmt_of_seq = true;
   basic_block bb = ENTRY_BLOCK_PTR;
 
-  while (!tsi_end_p (i))
+  while (!gsi_end_p (i))
     {
-      tree prev_stmt;
+      gimple prev_stmt;
 
       prev_stmt = stmt;
-      stmt = tsi_stmt (i);
+      stmt = gsi_stmt (i);
 
       /* If the statement starts a new basic block or if we have determined
 	 in a previous pass that we need to create a new block for STMT, do
 	 so now.  */
       if (start_new_block || stmt_starts_bb_p (stmt, prev_stmt))
 	{
-	  if (!first_stmt_of_list)
-	    stmt_list = tsi_split_statement_list_before (&i);
-	  bb = create_basic_block (stmt_list, NULL, bb);
+	  if (!first_stmt_of_seq)
+	    seq = gsi_split_seq_before (i);
+	  bb = create_basic_block (seq, NULL, bb);
 	  start_new_block = false;
 	}
 
@@ -348,8 +348,8 @@ make_blocks (tree stmt_list)
       if (stmt_ends_bb_p (stmt))
 	start_new_block = true;
 
-      tsi_next (&i);
-      first_stmt_of_list = false;
+      gsi_next (i);
+      first_stmt_of_seq = false;
     }
 }
 
@@ -370,8 +370,8 @@ create_bb (void *h, void *e, basic_block
 
   bb->index = last_basic_block;
   bb->flags = BB_NEW;
-  bb->il.tree = GGC_CNEW (struct tree_bb_info);
-  set_bb_stmt_list (bb, h ? (tree) h : alloc_stmt_list ());
+  bb->il.gimple = GGC_CNEW (struct gimple_bb_info);
+  set_bb_seq (bb, (gimple_seq) h);
 
   /* Add the new block to the linked list of blocks.  */
   link_block (bb, after);
@@ -406,11 +406,13 @@ fold_cond_expr_cond (void)
 
   FOR_EACH_BB (bb)
     {
-      tree stmt = last_stmt (bb);
+      gimple stmt = last_stmt (bb);
 
       if (stmt
-	  && TREE_CODE (stmt) == COND_EXPR)
+	  && gimple_code (stmt) == GIMPLE_COND)
 	{
+#if 0
+	  /* FIXME tuples */
 	  tree cond;
 	  bool zerop, onep;
 
@@ -426,6 +428,7 @@ fold_cond_expr_cond (void)
 	    COND_EXPR_COND (stmt) = boolean_false_node;
 	  else if (onep)
 	    COND_EXPR_COND (stmt) = boolean_true_node;
+#endif
 	}
     }
 }
@@ -445,40 +448,42 @@ make_edges (void)
   /* Traverse the basic block array placing edges.  */
   FOR_EACH_BB (bb)
     {
-      tree last = last_stmt (bb);
+      gimple last = last_stmt (bb);
       bool fallthru;
 
       if (last)
 	{
-	  enum tree_code code = TREE_CODE (last);
+	  enum gimple_code code = gimple_code (last);
 	  switch (code)
 	    {
-	    case GOTO_EXPR:
+	    case GIMPLE_GOTO:
 	      make_goto_expr_edges (bb);
 	      fallthru = false;
 	      break;
-	    case RETURN_EXPR:
+	    case GIMPLE_RETURN:
 	      make_edge (bb, EXIT_BLOCK_PTR, 0);
 	      fallthru = false;
 	      break;
-	    case COND_EXPR:
+	    case GIMPLE_COND:
 	      make_cond_expr_edges (bb);
 	      fallthru = false;
 	      break;
-	    case SWITCH_EXPR:
+	    case GIMPLE_SWITCH:
 	      make_switch_expr_edges (bb);
 	      fallthru = false;
 	      break;
-	    case RESX_EXPR:
+	    case GIMPLE_RESX:
 	      make_eh_edges (last);
 	      fallthru = false;
 	      break;
 
+	      /* FIXME tuples: fix all these cases.  */
+
 	    case CALL_EXPR:
 	      /* If this function receives a nonlocal goto, then we need to
 		 make edges from this call site to all the nonlocal goto
 		 handlers.  */
-	      if (tree_can_make_abnormal_goto (last))
+	      if (stmt_can_make_abnormal_goto (last))
 		make_abnormal_goto_edges (bb, true);
 
 	      /* If this statement has reachable exception handlers, then
@@ -486,19 +491,16 @@ make_edges (void)
 	      make_eh_edges (last);
 
 	      /* Some calls are known not to return.  */
-	      fallthru = !(call_expr_flags (last) & ECF_NORETURN);
+	      fallthru = !(gimple_call_flags (last) & ECF_NORETURN);
 	      break;
 
-	    case MODIFY_EXPR:
-	      gcc_unreachable ();
-
 	    case GIMPLE_MODIFY_STMT:
 	      if (is_ctrl_altering_stmt (last))
 		{
 		  /* A GIMPLE_MODIFY_STMT may have a CALL_EXPR on its RHS and
 		     the CALL_EXPR may have an abnormal edge.  Search the RHS
 		     for this case and create any required edges.  */
-		  if (tree_can_make_abnormal_goto (last))
+		  if (stmt_can_make_abnormal_goto (last))
 		    make_abnormal_goto_edges (bb, true);  
 
 		  make_eh_edges (last);
@@ -603,45 +605,44 @@ make_edges (void)
 }
 
 
-/* Create the edges for a COND_EXPR starting at block BB.
-   At this point, both clauses must contain only simple gotos.  */
+/* Create the edges for a GIMPLE_COND starting at block BB.  */
 
 static void
 make_cond_expr_edges (basic_block bb)
 {
-  tree entry = last_stmt (bb);
+  gimple entry = last_stmt (bb);
   basic_block then_bb, else_bb;
   tree then_label, else_label;
   edge e;
 
   gcc_assert (entry);
-  gcc_assert (TREE_CODE (entry) == COND_EXPR);
+  gcc_assert (gimple_code (entry) == GIMPLE_COND);
 
   /* Entry basic blocks for each component.  */
-  then_label = GOTO_DESTINATION (COND_EXPR_THEN (entry));
-  else_label = GOTO_DESTINATION (COND_EXPR_ELSE (entry));
+  then_label = gimple_cond_true_label (entry);
+  else_label = gimple_cond_false_label (entry);
   then_bb = label_to_block (then_label);
   else_bb = label_to_block (else_label);
 
   e = make_edge (bb, then_bb, EDGE_TRUE_VALUE);
 #ifdef USE_MAPPED_LOCATION
-  e->goto_locus = EXPR_LOCATION (COND_EXPR_THEN (entry));
+  e->goto_locus = EXPR_LOCATION (then_label);
 #else
-  e->goto_locus = EXPR_LOCUS (COND_EXPR_THEN (entry));
+  e->goto_locus = *EXPR_LOCUS (then_label);
 #endif
   e = make_edge (bb, else_bb, EDGE_FALSE_VALUE);
   if (e)
     {
 #ifdef USE_MAPPED_LOCATION
-      e->goto_locus = EXPR_LOCATION (COND_EXPR_ELSE (entry));
+      e->goto_locus = EXPR_LOCATION (else_label);
 #else
-      e->goto_locus = EXPR_LOCUS (COND_EXPR_ELSE (entry));
+      e->goto_locus = *EXPR_LOCUS (else_label);
 #endif
     }
 
-  /* We do not need the gotos anymore.  */
-  COND_EXPR_THEN (entry) = NULL_TREE;
-  COND_EXPR_ELSE (entry) = NULL_TREE;
+  /* We do not need the branches anymore.  */
+  gimple_cond_set_true_label (entry, NULL);
+  gimple_cond_set_false_label (entry, NULL);
 }
 
 
@@ -739,23 +740,19 @@ get_cases_for_edge (edge e, tree t)
   return (tree) *pointer_map_contains (edge_to_cases, e);
 }
 
-/* Create the edges for a SWITCH_EXPR starting at block BB.
-   At this point, the switch body has been lowered and the
-   SWITCH_LABELS filled in, so this is in effect a multi-way branch.  */
+/* Create the edges for a GIMPLE_SWITCH starting at block BB.  */
 
 static void
 make_switch_expr_edges (basic_block bb)
 {
-  tree entry = last_stmt (bb);
+  gimple entry = last_stmt (bb);
   size_t i, n;
-  tree vec;
 
-  vec = SWITCH_LABELS (entry);
-  n = TREE_VEC_LENGTH (vec);
+  n = gimple_switch_num_labels (entry);
 
   for (i = 0; i < n; ++i)
     {
-      tree lab = CASE_LABEL (TREE_VEC_ELT (vec, i));
+      tree lab = CASE_LABEL (gimple_switch_label (entry, i));
       basic_block label_bb = label_to_block (lab);
       make_edge (bb, label_bb, 0);
     }
@@ -776,9 +773,9 @@ label_to_block_fn (struct function *ifun
     {
       block_stmt_iterator bsi =
 	bsi_start (BASIC_BLOCK (NUM_FIXED_BLOCKS));
-      tree stmt;
+      gimple stmt;
 
-      stmt = build1 (LABEL_EXPR, void_type_node, dest);
+      stmt = build_gimple_label (dest);
       bsi_insert_before (&bsi, stmt, BSI_NEW_STMT);
       uid = LABEL_DECL_UID (dest);
     }
@@ -800,12 +797,13 @@ make_abnormal_goto_edges (basic_block bb
   FOR_EACH_BB (target_bb)
     for (bsi = bsi_start (target_bb); !bsi_end_p (bsi); bsi_next (&bsi))
       {
-	tree target = bsi_stmt (bsi);
+	gimple label_stmt = bsi_stmt (bsi);
+	tree target;
 
-	if (TREE_CODE (target) != LABEL_EXPR)
+	if (gimple_code (label_stmt) != GIMPLE_LABEL)
 	  break;
 
-	target = LABEL_EXPR_LABEL (target);
+	target = gimple_label_label (label_stmt);
 
 	/* Make an edge to every label block that has been marked as a
 	   potential target for a computed goto or a non-local goto.  */
@@ -824,18 +822,14 @@ static void
 make_goto_expr_edges (basic_block bb)
 {
   block_stmt_iterator last = bsi_last (bb);
-  tree goto_t = bsi_stmt (last);
+  gimple goto_t = bsi_stmt (last);
 
   /* A simple GOTO creates normal edges.  */
   if (simple_goto_p (goto_t))
     {
-      tree dest = GOTO_DESTINATION (goto_t);
+      tree dest = gimple_goto_dest (goto_t);
       edge e = make_edge (bb, label_to_block (dest), EDGE_FALLTHRU);
-#ifdef USE_MAPPED_LOCATION
-      e->goto_locus = EXPR_LOCATION (goto_t);
-#else
-      e->goto_locus = EXPR_LOCUS (goto_t);
-#endif
+      e->goto_locus = gimple_locus (goto_t);
       bsi_remove (&last, true);
       return;
     }
@@ -926,12 +920,13 @@ cleanup_dead_labels (void)
 
       for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
 	{
-	  tree label, stmt = bsi_stmt (i);
+	  tree label;
+	  gimple stmt = bsi_stmt (i);
 
-	  if (TREE_CODE (stmt) != LABEL_EXPR)
+	  if (gimple_code (stmt) != GIMPLE_LABEL)
 	    break;
 
-	  label = LABEL_EXPR_LABEL (stmt);
+	  label = gimple_label_label (stmt);
 
 	  /* If we have not yet seen a label for the current block,
 	     remember this one and see if there are more labels.  */
@@ -957,52 +952,47 @@ cleanup_dead_labels (void)
      First do so for each block ending in a control statement.  */
   FOR_EACH_BB (bb)
     {
-      tree stmt = last_stmt (bb);
+      gimple stmt = last_stmt (bb);
       if (!stmt)
 	continue;
 
-      switch (TREE_CODE (stmt))
+      switch (gimple_code (stmt))
 	{
-	case COND_EXPR:
+	case GIMPLE_COND:
 	  {
-	    tree true_branch, false_branch;
-
-	    true_branch = COND_EXPR_THEN (stmt);
-	    false_branch = COND_EXPR_ELSE (stmt);
+	    tree true_label, false_label;
 
-	    if (true_branch)
-	      GOTO_DESTINATION (true_branch)
-		      = main_block_label (GOTO_DESTINATION (true_branch));
-	    if (false_branch)
-	      GOTO_DESTINATION (false_branch)
-		      = main_block_label (GOTO_DESTINATION (false_branch));
+	    true_label = gimple_cond_true_label (stmt);
+	    false_label = gimple_cond_false_label (stmt);
 
+	    if (true_label)
+	      gimple_cond_set_true_label (stmt, main_block_label (true_label));
+	    if (false_label)
+	      gimple_cond_set_false_label (stmt,
+					   main_block_label (false_label));
 	    break;
 	  }
 
 	case SWITCH_EXPR:
 	  {
-	    size_t i;
-	    tree vec = SWITCH_LABELS (stmt);
-	    size_t n = TREE_VEC_LENGTH (vec);
+	    unsigned int i, n = gimple_switch_num_labels (stmt);
 
 	    /* Replace all destination labels.  */
 	    for (i = 0; i < n; ++i)
 	      {
-		tree elt = TREE_VEC_ELT (vec, i);
-		tree label = main_block_label (CASE_LABEL (elt));
-		CASE_LABEL (elt) = label;
+		tree label = main_block_label (gimple_switch_label (stmt, i));
+		gimple_switch_set_label (stmt, i, label);
 	      }
 	    break;
 	  }
 
-	/* We have to handle GOTO_EXPRs until they're removed, and we don't
+	/* We have to handle gotos until they're removed, and we don't
 	   remove them until after we've created the CFG edges.  */
-	case GOTO_EXPR:
+	case GIMPLE_GOTO:
           if (! computed_goto_p (stmt))
 	    {
-	      GOTO_DESTINATION (stmt)
-		= main_block_label (GOTO_DESTINATION (stmt));
+	      gimple_goto_set_dest (stmt,
+				    main_block_label (gimple_goto_dest (stmt)));
 	      break;
 	    }
 
@@ -1030,12 +1020,13 @@ cleanup_dead_labels (void)
 
       for (i = bsi_start (bb); !bsi_end_p (i); )
 	{
-	  tree label, stmt = bsi_stmt (i);
+	  tree label;
+	  gimple stmt = bsi_stmt (i);
 
-	  if (TREE_CODE (stmt) != LABEL_EXPR)
+	  if (gimple_code (stmt) != GIMPLE_LABEL)
 	    break;
 
-	  label = LABEL_EXPR_LABEL (stmt);
+	  label = gimple_label_label (stmt);
 
 	  if (label == label_for_this_bb
 	      || ! DECL_ARTIFICIAL (label)
@@ -1062,27 +1053,26 @@ group_case_labels (void)
 
   FOR_EACH_BB (bb)
     {
-      tree stmt = last_stmt (bb);
-      if (stmt && TREE_CODE (stmt) == SWITCH_EXPR)
+      gimple stmt = last_stmt (bb);
+      if (stmt && gimple_code (stmt) == GIMPLE_SWITCH)
 	{
-	  tree labels = SWITCH_LABELS (stmt);
-	  int old_size = TREE_VEC_LENGTH (labels);
+	  int old_size = gimple_switch_num_labels (stmt);
 	  int i, j, new_size = old_size;
-	  tree default_case = TREE_VEC_ELT (labels, old_size - 1);
+	  tree default_case = gimple_switch_default_label (stmt);
 	  tree default_label;
 
-	  /* The default label is always the last case in a switch
+	  /* The default label is always the first case in a switch
 	     statement after gimplification.  */
 	  default_label = CASE_LABEL (default_case);
 
 	  /* Look for possible opportunities to merge cases.
-	     Ignore the last element of the label vector because it
-	     must be the default case.  */
-          i = 0;
-	  while (i < old_size - 1)
+	     Ignore the first element of the label vector because it
+	     is be the default case.  */
+          i = 1;
+	  while (i < old_size)
 	    {
 	      tree base_case, base_label, base_high;
-	      base_case = TREE_VEC_ELT (labels, i);
+	      base_case = gimple_switch_label (stmt, i);
 
 	      gcc_assert (base_case);
 	      base_label = CASE_LABEL (base_case);
@@ -1091,7 +1081,7 @@ group_case_labels (void)
 		 default case.  */
 	      if (base_label == default_label)
 		{
-		  TREE_VEC_ELT (labels, i) = NULL_TREE;
+		  gimple_switch_set_label (stmt, i, NULL_TREE);
 		  i++;
 		  new_size--;
 		  continue;
@@ -1103,9 +1093,9 @@ group_case_labels (void)
 	      /* Try to merge case labels.  Break out when we reach the end
 		 of the label vector or when we cannot merge the next case
 		 label with the current one.  */
-	      while (i < old_size - 1)
+	      while (i < old_size)
 		{
-		  tree merge_case = TREE_VEC_ELT (labels, i);
+		  tree merge_case = gimple_switch_label (stmt, i);
 	          tree merge_label = CASE_LABEL (merge_case);
 		  tree t = int_const_binop (PLUS_EXPR, base_high,
 					    integer_one_node, 1);
@@ -1118,7 +1108,7 @@ group_case_labels (void)
 		      base_high = CASE_HIGH (merge_case) ?
 			CASE_HIGH (merge_case) : CASE_LOW (merge_case);
 		      CASE_HIGH (base_case) = base_high;
-		      TREE_VEC_ELT (labels, i) = NULL_TREE;
+		      gimple_switch_set_label (stmt, i, NULL_TREE);
 		      new_size--;
 		      i++;
 		    }
@@ -1131,11 +1121,15 @@ group_case_labels (void)
 	     length of the vector.  */
 	  for (i = 0, j = 0; i < new_size; i++)
 	    {
-	      while (! TREE_VEC_ELT (labels, j))
+	      while (! gimple_switch_label (stmt, j))
 		j++;
-	      TREE_VEC_ELT (labels, i) = TREE_VEC_ELT (labels, j++);
+	      gimple_switch_set_label (stmt, i,
+				       gimple_switch_label (stmt, j++));
 	    }
-	  TREE_VEC_LENGTH (labels) = new_size;
+	  /* FIXME tuples: Should we reallocate a new switch, or just
+	     set the number of labels and put up with the few words
+	     lost, until we GC the entire GIMPLE_SWITCH out?  */
+	  gimple_switch_set_num_labels (stmt, new_size);
 	}
     }
 }
@@ -1145,9 +1139,9 @@ group_case_labels (void)
 static bool
 tree_can_merge_blocks_p (basic_block a, basic_block b)
 {
-  tree stmt;
+  gimple stmt;
   block_stmt_iterator bsi;
-  tree phi;
+  gimple_seq phis;
 
   if (!single_succ_p (a))
     return false;
@@ -1171,33 +1165,40 @@ tree_can_merge_blocks_p (basic_block a, 
     return false;
 
   /* Do not allow a block with only a non-local label to be merged.  */
-  if (stmt && TREE_CODE (stmt) == LABEL_EXPR
-      && DECL_NONLOCAL (LABEL_EXPR_LABEL (stmt)))
+  if (stmt && gimple_code (stmt) == GIMPLE_LABEL
+      && DECL_NONLOCAL (gimple_label_label (stmt)))
     return false;
 
   /* It must be possible to eliminate all phi nodes in B.  If ssa form
      is not up-to-date, we cannot eliminate any phis; however, if only
      some symbols as whole are marked for renaming, this is not a problem,
      as phi nodes for those symbols are irrelevant in updating anyway.  */
-  phi = phi_nodes (b);
-  if (phi)
+  phis = phi_nodes (b);
+  if (!gimple_seq_empty_p (phis))
     {
+      gimple_stmt_iterator *i;
+
       if (name_mappings_registered_p ())
 	return false;
 
-      for (; phi; phi = PHI_CHAIN (phi))
-	if (!is_gimple_reg (PHI_RESULT (phi))
-	    && !may_propagate_copy (PHI_RESULT (phi), PHI_ARG_DEF (phi, 0)))
-	  return false;
+      for (i = gsi_start (phis); gsi_end_p (i); gsi_next (i))
+	{
+	  gimple phi = gsi_stmt (i);
+
+	  if (!is_gimple_reg (gimple_phi_result (phi))
+	      && !may_propagate_copy (gimple_phi_result (phi),
+				      gimple_phi_arg_def (phi, 0)))
+	    return false;
+	}
     }
 
   /* Do not remove user labels.  */
   for (bsi = bsi_start (b); !bsi_end_p (bsi); bsi_next (&bsi))
     {
       stmt = bsi_stmt (bsi);
-      if (TREE_CODE (stmt) != LABEL_EXPR)
+      if (gimple_code (stmt) != GIMPLE_LABEL)
 	break;
-      if (!DECL_ARTIFICIAL (LABEL_EXPR_LABEL (stmt)))
+      if (!DECL_ARTIFICIAL (gimple_label_label (stmt)))
 	return false;
     }
 
@@ -1216,21 +1217,21 @@ replace_uses_by (tree name, tree val)
 {
   imm_use_iterator imm_iter;
   use_operand_p use;
-  tree stmt;
+  gimple stmt;
   edge e;
 
   FOR_EACH_IMM_USE_STMT (stmt, imm_iter, name)
     {
-      if (TREE_CODE (stmt) != PHI_NODE)
+      if (gimple_code (stmt) != GIMPLE_PHI)
 	push_stmt_changes (&stmt);
 
       FOR_EACH_IMM_USE_ON_STMT (use, imm_iter)
         {
 	  replace_exp (use, val);
 
-	  if (TREE_CODE (stmt) == PHI_NODE)
+	  if (gimple_code (stmt) == GIMPLE_PHI)
 	    {
-	      e = PHI_ARG_EDGE (stmt, PHI_ARG_INDEX_FROM_USE (use));
+	      e = gimple_phi_arg_edge (stmt, PHI_ARG_INDEX_FROM_USE (use));
 	      if (e->flags & EDGE_ABNORMAL)
 		{
 		  /* This can only occur for virtual operands, since
@@ -1242,7 +1243,7 @@ replace_uses_by (tree name, tree val)
 	    }
 	}
 
-      if (TREE_CODE (stmt) != PHI_NODE)
+      if (gimple_code (stmt) != GIMPLE_PHI)
 	{
 	  tree rhs;
 
@@ -1282,8 +1283,8 @@ static void
 tree_merge_blocks (basic_block a, basic_block b)
 {
   block_stmt_iterator bsi;
-  tree_stmt_iterator last;
-  tree phi;
+  gimple_stmt_iterator *last, *gsi;
+  gimple_seq phis;
 
   if (dump_file)
     fprintf (dump_file, "Merging blocks %d and %d\n", a->index, b->index);
@@ -1291,10 +1292,11 @@ tree_merge_blocks (basic_block a, basic_
   /* Remove all single-valued PHI nodes from block B of the form
      V_i = PHI <V_j> by propagating V_j to all the uses of V_i.  */
   bsi = bsi_last (a);
-  for (phi = phi_nodes (b); phi; phi = phi_nodes (b))
+  for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (gsi))
     {
-      tree def = PHI_RESULT (phi), use = PHI_ARG_DEF (phi, 0);
-      tree copy;
+      gimple phi = gsi_stmt (gsi);
+      tree def = gimple_phi_result (phi), use = gimple_phi_arg_def (phi, 0);
+      gimple copy;
       bool may_replace_uses = may_propagate_copy (def, use);
 
       /* In case we maintain loop closed ssa form, do not propagate arguments
@@ -1314,7 +1316,7 @@ tree_merge_blocks (basic_block a, basic_
 	     with ordering of phi nodes.  This is because A is the single
 	     predecessor of B, therefore results of the phi nodes cannot
 	     appear as arguments of the phi nodes.  */
-	  copy = build_gimple_modify_stmt (def, use);
+	  copy = build_gimple_assign (def, use);
 	  bsi_insert_after (&bsi, copy, BSI_NEW_STMT);
 	  SSA_NAME_DEF_STMT (def) = copy;
           remove_phi_node (phi, NULL, false);
@@ -1335,9 +1337,9 @@ tree_merge_blocks (basic_block a, basic_
   /* Remove labels from B and set bb_for_stmt to A for other statements.  */
   for (bsi = bsi_start (b); !bsi_end_p (bsi);)
     {
-      if (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR)
+      if (gimple_code (bsi_stmt (bsi)) == GIMPLE_LABEL)
 	{
-	  tree label = bsi_stmt (bsi);
+	  gimple label = bsi_stmt (bsi);
 
 	  bsi_remove (&bsi, false);
 	  /* Now that we can thread computed gotos, we might have
@@ -1346,7 +1348,7 @@ tree_merge_blocks (basic_block a, basic_
 	     used in other ways (think about the runtime checking for
 	     Fortran assigned gotos).  So we can not just delete the
 	     label.  Instead we move the label to the start of block A.  */
-	  if (FORCED_LABEL (LABEL_EXPR_LABEL (label)))
+	  if (FORCED_LABEL (gimple_label_label (label)))
 	    {
 	      block_stmt_iterator dest_bsi = bsi_start (a);
 	      bsi_insert_before (&dest_bsi, label, BSI_NEW_STMT);
@@ -1360,9 +1362,9 @@ tree_merge_blocks (basic_block a, basic_
     }
 
   /* Merge the chains.  */
-  last = tsi_last (bb_stmt_list (a));
-  tsi_link_after (&last, bb_stmt_list (b), TSI_NEW_STMT);
-  set_bb_stmt_list (b, NULL_TREE);
+  last = gsi_last (bb_seq (a));
+  gsi_link_after (&last, bb_seq (b), GSI_NEW_STMT);
+  set_bb_seq (b, NULL);
 
   if (cfgcleanup_altered_bbs)
     bitmap_set_bit (cfgcleanup_altered_bbs, a->index);
@@ -2002,7 +2004,7 @@ remove_bb (basic_block bb)
     }
 
   /* Remove all the instructions in the block.  */
-  if (bb_stmt_list (bb) != NULL_TREE)
+  if (bb_seq (bb) != NULL)
     {
       for (i = bsi_start (bb); !bsi_end_p (i);)
 	{
@@ -2072,7 +2074,7 @@ remove_bb (basic_block bb)
 #endif
 
   remove_phi_nodes_and_edges_for_unreachable_block (bb);
-  bb->il.tree = NULL;
+  bb->il.gimple = NULL;
 }
 
 
@@ -2446,13 +2448,13 @@ tree_cfg2vcg (FILE *file)
 /* Return true if T represents a stmt that always transfers control.  */
 
 bool
-is_ctrl_stmt (const_tree t)
+is_ctrl_stmt (const_gimple t)
 {
-  return (TREE_CODE (t) == COND_EXPR
-	  || TREE_CODE (t) == SWITCH_EXPR
-	  || TREE_CODE (t) == GOTO_EXPR
-	  || TREE_CODE (t) == RETURN_EXPR
-	  || TREE_CODE (t) == RESX_EXPR);
+  return gimple_code (t) == GIMPLE_COND
+    || gimple_code (t) == GIMPLE_SWITCH
+    || gimple_code (t) == GIMPLE_GOTO
+    || gimple_code (t) == GIMPLE_RETURN
+    || gimple_code (t) == GIMPLE_RESX;
 }
 
 
@@ -2460,21 +2462,18 @@ 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 (gimple t)
 {
-  tree call;
-
   gcc_assert (t);
-  call = get_call_expr_in (t);
-  if (call)
+  if (gimple_code (t) == GIMPLE_CALL)
     {
-      /* A non-pure/const CALL_EXPR alters flow control if the current
+      /* A non-pure/const call alters flow control if the current
 	 function has nonlocal labels.  */
-      if (TREE_SIDE_EFFECTS (call) && current_function_has_nonlocal_label)
+      if (/*TREE_SIDE_EFFECTS (call) && */current_function_has_nonlocal_label)
 	return true;
 
-      /* A CALL_EXPR also alters control flow if it does not return.  */
-      if (call_expr_flags (call) & ECF_NORETURN)
+      /* A call also alters control flow if it does not return.  */
+      if (gimple_call_flags (t) & ECF_NORETURN)
 	return true;
     }
 
@@ -2483,27 +2482,28 @@ is_ctrl_altering_stmt (tree t)
     return true;
 
   /* If a statement can throw, it alters control flow.  */
-  return tree_can_throw_internal (t);
+  return stmt_can_throw_internal (t);
 }
 
 
 /* Return true if T is a computed goto.  */
+/* FIXME tuples: This is unused elsewhere.  It should be a static.  */
 
 bool
-computed_goto_p (const_tree t)
+computed_goto_p (const_gimple t)
 {
-  return (TREE_CODE (t) == GOTO_EXPR
-	  && TREE_CODE (GOTO_DESTINATION (t)) != LABEL_DECL);
+  return (gimple_code (t) == GIMPLE_GOTO
+	  && TREE_CODE (gimple_goto_dest (t)) != LABEL_DECL);
 }
 
 
 /* Return true if T is a simple local goto.  */
 
 bool
-simple_goto_p (const_tree t)
+simple_goto_p (const_gimple t)
 {
-  return (TREE_CODE (t) == GOTO_EXPR
-	  && TREE_CODE (GOTO_DESTINATION (t)) == LABEL_DECL);
+  return (gimple_code (t) == GIMPLE_GOTO
+	  && TREE_CODE (gimple_goto_dest (t)) == LABEL_DECL);
 }
 
 
@@ -2511,46 +2511,43 @@ simple_goto_p (const_tree t)
    Transfers of control flow associated with EH are excluded.  */
 
 bool
-tree_can_make_abnormal_goto (const_tree t)
+stmt_can_make_abnormal_goto (const_gimple t)
 {
   if (computed_goto_p (t))
     return true;
-  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 TREE_SIDE_EFFECTS (t) && current_function_has_nonlocal_label;
+  if (gimple_code (t) == GIMPLE_CALL)
+    return /* FIXME tuples: TREE_SIDE_EFFECTS (t) && */
+      current_function_has_nonlocal_label;
   return false;
 }
 
 
-/* Return true if T should start a new basic block.  PREV_T is the
-   statement preceding T.  It is used when T is a label or a case label.
-   Labels should only start a new basic block if their previous statement
-   wasn't a label.  Otherwise, sequence of labels would generate
-   unnecessary basic blocks that only contain a single label.  */
+/* Return true if STMT should start a new basic block.  PREV_STMT is
+   the statement preceding STMT.  It is used when STMT is a label or a
+   case label.  Labels should only start a new basic block if their
+   previous statement wasn't a label.  Otherwise, sequence of labels
+   would generate unnecessary basic blocks that only contain a single
+   label.  */
 
 static inline bool
-stmt_starts_bb_p (const_tree t, const_tree prev_t)
+stmt_starts_bb_p (const_gimple stmt, const_gimple prev_stmt)
 {
-  if (t == NULL_TREE)
+  if (stmt == NULL)
     return false;
 
-  /* LABEL_EXPRs start a new basic block only if the preceding
-     statement wasn't a label of the same type.  This prevents the
-     creation of consecutive blocks that have nothing but a single
-     label.  */
-  if (TREE_CODE (t) == LABEL_EXPR)
+  /* Labels start a new basic block only if the preceding statement
+     wasn't a label of the same type.  This prevents the creation of
+     consecutive blocks that have nothing but a single label.  */
+  if (gimple_code (stmt) == GIMPLE_LABEL)
     {
       /* Nonlocal and computed GOTO targets always start a new block.  */
-      if (DECL_NONLOCAL (LABEL_EXPR_LABEL (t))
-	  || FORCED_LABEL (LABEL_EXPR_LABEL (t)))
+      if (DECL_NONLOCAL (gimple_label_label (stmt))
+	  || FORCED_LABEL (gimple_label_label (stmt)))
 	return true;
 
-      if (prev_t && TREE_CODE (prev_t) == LABEL_EXPR)
+      if (prev_stmt && gimple_code (prev_stmt) == GIMPLE_LABEL)
 	{
-	  if (DECL_NONLOCAL (LABEL_EXPR_LABEL (prev_t)))
+	  if (DECL_NONLOCAL (gimple_label_label (prev_stmt)))
 	    return true;
 
 	  cfg_stats.num_merged_labels++;
@@ -2567,7 +2564,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 (gimple t)
 {
   return is_ctrl_stmt (t) || is_ctrl_altering_stmt (t);
 }
@@ -2594,7 +2591,7 @@ delete_tree_cfg_annotations (void)
 
 /* Return the first statement in basic block BB.  */
 
-tree
+gimple
 first_stmt (basic_block bb)
 {
   block_stmt_iterator i = bsi_start (bb);
@@ -2604,7 +2601,7 @@ first_stmt (basic_block bb)
 
 /* Return the last statement in basic block BB.  */
 
-tree
+gimple
 last_stmt (basic_block bb)
 {
   block_stmt_iterator b = bsi_last (bb);
@@ -2616,14 +2613,14 @@ last_stmt (basic_block bb)
    if the block is totally empty, or if it contains more than one
    statement.  */
 
-tree
+gimple
 last_and_only_stmt (basic_block bb)
 {
   block_stmt_iterator i = bsi_last (bb);
-  tree last, prev;
+  gimple last, prev;
 
   if (bsi_end_p (i))
-    return NULL_TREE;
+    return NULL;
 
   last = bsi_stmt (i);
   bsi_prev (&i);
@@ -2638,79 +2635,69 @@ last_and_only_stmt (basic_block bb)
      Thus the only thing that should appear here in a block containing
      one executable statement is a label.  */
   prev = bsi_stmt (i);
-  if (TREE_CODE (prev) == LABEL_EXPR)
+  if (gimple_code (prev) == GIMPLE_LABEL)
     return last;
   else
-    return NULL_TREE;
+    return NULL;
 }
 
 
 /* Mark BB as the basic block holding statement T.  */
 
 void
-set_bb_for_stmt (tree t, basic_block bb)
+set_bb_for_stmt (gimple stmt, basic_block bb)
 {
-  if (TREE_CODE (t) == PHI_NODE)
-    PHI_BB (t) = bb;
-  else if (TREE_CODE (t) == STATEMENT_LIST)
-    {
-      tree_stmt_iterator i;
-      for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
-	set_bb_for_stmt (tsi_stmt (i), bb);
-    }
-  else
+  set_gimple_bb (stmt, bb);
+
+  /* If the statement is a label, add the label to block-to-labels map
+     so that we can speed up edge creation for GIMPLE_GOTOs.  */
+  if (gimple_code (stmt) == GIMPLE_LABEL)
     {
-      stmt_ann_t ann = get_stmt_ann (t);
-      ann->bb = bb;
+      tree t;
+      int uid;
 
-      /* If the statement is a label, add the label to block-to-labels map
-        so that we can speed up edge creation for GOTO_EXPRs.  */
-      if (TREE_CODE (t) == LABEL_EXPR)
-	{
-	  int uid;
-
-	  t = LABEL_EXPR_LABEL (t);
-	  uid = LABEL_DECL_UID (t);
-	  if (uid == -1)
+      t = gimple_label_label (stmt);
+      uid = LABEL_DECL_UID (t);
+      if (uid == -1)
+	{
+	  unsigned old_len = VEC_length (basic_block, label_to_block_map);
+	  LABEL_DECL_UID (t) = uid = cfun->last_label_uid++;
+	  if (old_len <= (unsigned) uid)
 	    {
-	      unsigned old_len = VEC_length (basic_block, label_to_block_map);
-	      LABEL_DECL_UID (t) = uid = cfun->last_label_uid++;
-	      if (old_len <= (unsigned) uid)
-		{
-		  unsigned new_len = 3 * uid / 2;
+	      unsigned new_len = 3 * uid / 2;
 
-		  VEC_safe_grow_cleared (basic_block, gc, label_to_block_map,
-					 new_len);
-		}
+	      VEC_safe_grow_cleared (basic_block, gc, label_to_block_map,
+				     new_len);
 	    }
-	  else
-	    /* We're moving an existing label.  Make sure that we've
-		removed it from the old block.  */
-	    gcc_assert (!bb
-			|| !VEC_index (basic_block, label_to_block_map, uid));
-	  VEC_replace (basic_block, label_to_block_map, uid, bb);
 	}
+      else
+	/* We're moving an existing label.  Make sure that we've
+	   removed it from the old block.  */
+	gcc_assert (!bb
+		    || !VEC_index (basic_block, label_to_block_map, uid));
+      VEC_replace (basic_block, label_to_block_map, uid, bb);
     }
 }
 
+
 /* Faster version of set_bb_for_stmt that assume that statement is being moved
    from one basic block to another.  
    For BB splitting we can run into quadratic case, so performance is quite
    important and knowing that the tables are big enough, change_bb_for_stmt
    can inline as leaf function.  */
 static inline void
-change_bb_for_stmt (tree t, basic_block bb)
+change_bb_for_stmt (gimple t, basic_block bb)
 {
-  get_stmt_ann (t)->bb = bb;
-  if (TREE_CODE (t) == LABEL_EXPR)
+  set_gimple_bb (t, bb);
+  if (gimple_code (t) == GIMPLE_LABEL)
     VEC_replace (basic_block, label_to_block_map,
-		 LABEL_DECL_UID (LABEL_EXPR_LABEL (t)), bb);
+		 LABEL_DECL_UID (gimple_label_label (t)), bb);
 }
 
 /* Finds iterator for STMT.  */
 
 extern block_stmt_iterator
-bsi_for_stmt (tree stmt)
+bsi_for_stmt (gimple stmt)
 {
   block_stmt_iterator bsi;
 
@@ -2721,49 +2708,68 @@ bsi_for_stmt (tree stmt)
   gcc_unreachable ();
 }
 
-/* Mark statement T as modified, and update it.  */
+
+/* Mark the statement T as modified, and update it.  */
 static inline void
-update_modified_stmts (tree t)
+update_modified_stmt (gimple t)
 {
+  /* FIXME tuples: Perhaps we should cache the output from
+     ssa_operands_active, or make it inline ??  */
   if (!ssa_operands_active ())
     return;
-  if (TREE_CODE (t) == STATEMENT_LIST)
-    {
-      tree_stmt_iterator i;
-      tree stmt;
-      for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
-        {
-	  stmt = tsi_stmt (i);
-	  update_stmt_if_modified (stmt);
-	}
-    }
-  else
-    update_stmt_if_modified (t);
+  update_stmt_if_modified (t);
 }
 
-/* Insert statement (or statement list) T before the statement
-   pointed-to by iterator I.  M specifies how to update iterator I
-   after insertion (see enum bsi_iterator_update).  */
+
+/* Insert statement T before the statement pointed-to by iterator I.
+   M specifies how to update iterator I after insertion (see enum
+   bsi_iterator_update).  */
 
 void
-bsi_insert_before (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
+bsi_insert_before (block_stmt_iterator *i, gimple t, enum bsi_iterator_update m)
 {
   set_bb_for_stmt (t, i->bb);
-  update_modified_stmts (t);
-  tsi_link_before (&i->tsi, t, m);
+  update_modified_stmt (t);
+  gsi_link_before (i->gsi, t, m);
+}
+
+
+/* Like bsi_insert_before, but for all the statements in SEQ.  */
+
+void
+bsi_insert_seq_before (block_stmt_iterator *i, gimple_seq seq,
+		       enum bsi_iterator_update m)
+{
+  gimple_stmt_iterator *gsi;
+
+  for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (gsi))
+    bsi_insert_before (i, gsi_stmt (gsi), m);
 }
 
 
-/* Insert statement (or statement list) T after the statement
-   pointed-to by iterator I.  M specifies how to update iterator I
-   after insertion (see enum bsi_iterator_update).  */
+/* Insert statement T after the statement pointed-to by iterator I.  M
+   specifies how to update iterator I after insertion (see enum
+   bsi_iterator_update).  */
 
 void
-bsi_insert_after (block_stmt_iterator *i, tree t, enum bsi_iterator_update m)
+bsi_insert_after (block_stmt_iterator *i, gimple t, enum bsi_iterator_update m)
 {
   set_bb_for_stmt (t, i->bb);
-  update_modified_stmts (t);
-  tsi_link_after (&i->tsi, t, m);
+  update_modified_stmt (t);
+  gsi_link_after (i->gsi, t, m);
+}
+
+
+/* Like bsi_insert_after, but for all the statements in SEQ.  */
+
+void
+bsi_insert_seq_after (block_stmt_iterator *i, gimple_seq seq,
+		      enum bsi_iterator_update m)
+{
+  gimple_stmt_iterator *gsi;
+
+  for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (gsi))
+    bsi_insert_after (i, gsi_stmt (gsi), m);
 }
 
 
@@ -2780,10 +2786,10 @@ bsi_insert_after (block_stmt_iterator *i
 void
 bsi_remove (block_stmt_iterator *i, bool remove_eh_info)
 {
-  tree t = bsi_stmt (*i);
+  gimple t = bsi_stmt (*i);
   set_bb_for_stmt (t, NULL);
   delink_stmt_imm_use (t);
-  tsi_delink (&i->tsi);
+  gsi_delink (i->gsi);
   mark_stmt_modified (t);
   if (remove_eh_info)
     {
@@ -2840,14 +2846,14 @@ bsi_move_to_bb_end (block_stmt_iterator 
    information of the original statement is moved to the new statement.  */
 
 void
-bsi_replace (const block_stmt_iterator *bsi, tree stmt, bool update_eh_info)
+bsi_replace (const block_stmt_iterator *bsi, gimple stmt, bool update_eh_info)
 {
   int eh_region;
-  tree orig_stmt = bsi_stmt (*bsi);
+  gimple orig_stmt = bsi_stmt (*bsi);
 
   if (stmt == orig_stmt)
     return;
-  SET_EXPR_LOCUS (stmt, EXPR_LOCUS (orig_stmt));
+  set_gimple_locus (stmt, *EXPR_LOCUS (orig_stmt));
   set_bb_for_stmt (stmt, bsi->bb);
 
   /* Preserve EH region information from the original statement, if
@@ -2867,7 +2873,7 @@ bsi_replace (const block_stmt_iterator *
   delink_stmt_imm_use (orig_stmt);
   *bsi_stmt_ptr (*bsi) = stmt;
   mark_stmt_modified (stmt);
-  update_modified_stmts (stmt);
+  update_modified_stmt (stmt);
 }
 
 
@@ -4119,7 +4125,7 @@ verify_stmt (tree stmt, bool last_in_blo
 	  error ("statement marked for throw, but doesn%'t");
 	  goto fail;
 	}
-      if (!last_in_block && tree_can_throw_internal (stmt))
+      if (!last_in_block && stmt_can_throw_internal (stmt))
 	{
 	  error ("statement marked for throw in middle of block");
 	  goto fail;
@@ -4347,13 +4353,13 @@ tree_verify_flow_info (void)
   edge e;
   edge_iterator ei;
 
-  if (ENTRY_BLOCK_PTR->il.tree)
+  if (ENTRY_BLOCK_PTR->il.gimple)
     {
       error ("ENTRY_BLOCK has IL associated with it");
       err = 1;
     }
 
-  if (EXIT_BLOCK_PTR->il.tree)
+  if (EXIT_BLOCK_PTR->il.gimple)
     {
       error ("EXIT_BLOCK has IL associated with it");
       err = 1;
@@ -4881,10 +4887,10 @@ tree_redirect_edge_and_branch_force (edg
    labels).  If STMT is NULL, BB is split just after the labels.  */
 
 static basic_block
-tree_split_block (basic_block bb, void *stmt)
+gimple_split_block (basic_block bb, void *stmt)
 {
   block_stmt_iterator bsi;
-  tree_stmt_iterator tsi_tgt;
+  gimple_stmt_iterator *gsi_tgt;
   tree act, list;
   basic_block new_bb;
   edge e;
@@ -4925,11 +4931,11 @@ tree_split_block (basic_block bb, void *
      brings ugly quadratic memory consumption in the inliner.  
      (We are still quadratic since we need to update stmt BB pointers,
      sadly.)  */
-  list = tsi_split_statement_list_before (&bsi.tsi);
-  set_bb_stmt_list (new_bb, list);
-  for (tsi_tgt = tsi_start (list);
-       !tsi_end_p (tsi_tgt); tsi_next (&tsi_tgt))
-    change_bb_for_stmt (tsi_stmt (tsi_tgt), new_bb);
+  list = gsi_split_seq_before (&bsi.gsi);
+  set_bb_seq (new_bb, list);
+  for (gsi_tgt = gsi_start (list);
+       !gsi_end_p (gsi_tgt); gsi_next (&gsi_tgt))
+    change_bb_for_stmt (gsi_stmt (gsi_tgt), new_bb);
 
   return new_bb;
 }
@@ -6097,7 +6103,7 @@ tree_purge_dead_abnormal_call_edges (bas
       edge_iterator ei;
       edge e;
 
-      if (!(stmt && tree_can_make_abnormal_goto (stmt)))
+      if (!(stmt && stmt_can_make_abnormal_goto (stmt)))
 	for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
 	  {
 	    if (e->flags & EDGE_ABNORMAL)
@@ -6263,7 +6269,7 @@ tree_purge_dead_eh_edges (basic_block bb
   edge_iterator ei;
   tree stmt = last_stmt (bb);
 
-  if (stmt && tree_can_throw_internal (stmt))
+  if (stmt && stmt_can_throw_internal (stmt))
     return false;
 
   for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
@@ -6380,8 +6386,8 @@ tree_lv_add_condition_to_bb (basic_block
   e0->flags |= EDGE_FALSE_VALUE;
 }
 
-struct cfg_hooks tree_cfg_hooks = {
-  "tree",
+struct cfg_hooks gimple_cfg_hooks = {
+  "gimple",
   tree_verify_flow_info,
   tree_dump_bb,			/* dump_bb  */
   create_bb,			/* create_basic_block  */
@@ -6389,7 +6395,7 @@ struct cfg_hooks tree_cfg_hooks = {
   tree_redirect_edge_and_branch_force,/* redirect_edge_and_branch_force  */
   tree_can_remove_branch_p,	/* can_remove_branch_p  */
   remove_bb,			/* delete_basic_block  */
-  tree_split_block,		/* split_block  */
+  gimple_split_block,		/* split_block  */
   tree_move_block_after,	/* move_block_after  */
   tree_can_merge_blocks_p,	/* can_merge_blocks_p  */
   tree_merge_blocks,		/* merge_blocks  */
Index: tree-ssa-operands.c
===================================================================
--- tree-ssa-operands.c	(revision 127694)
+++ tree-ssa-operands.c	(working copy)
@@ -2322,24 +2322,18 @@ free_ssa_operands (stmt_operands_p ops)
 /* Get the operands of statement STMT.  */
 
 void
-update_stmt_operands (tree stmt)
+update_stmt_operands (gimple stmt)
 {
-  stmt_ann_t ann = get_stmt_ann (stmt);
-
   /* If update_stmt_operands is called before SSA is initialized, do
      nothing.  */
   if (!ssa_operands_active ())
     return;
 
-  /* The optimizers cannot handle statements that are nothing but a
-     _DECL.  This indicates a bug in the gimplifier.  */
-  gcc_assert (!SSA_VAR_P (stmt));
-
   timevar_push (TV_TREE_OPS);
 
-  gcc_assert (ann->modified);
+  gcc_assert (gimple_modified (stmt));
   build_ssa_operands (stmt);
-  ann->modified = 0;
+  set_gimple_modified (stmt, true);
 
   timevar_pop (TV_TREE_OPS);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]