+
+/* Run old register allocator. Return TRUE if we must exit
+ rest_of_compilation upon return. */
+static unsigned int
+rest_of_handle_global_alloc (void)
+{
+ bool failure;
+
+ /* If optimizing, allocate remaining pseudo-regs. Do the reload
+ pass fixing up any insns that are invalid. */
+ if (optimize && dbg_cnt (global_alloc_at_func))
+ failure = global_alloc ();
+ else
+ {
+ compute_regsets (&eliminable_regset, &no_global_alloc_regs);
+ build_insn_chain (get_insns ());
+ df_set_flags (DF_NO_INSN_RESCAN);
+ failure = reload (get_insns (), 0);
+ }
+
+ if (dump_enabled_p (pass_global_alloc.static_pass_number))
+ {
+ timevar_push (TV_DUMP);
+ dump_global_regs (dump_file);
+ timevar_pop (TV_DUMP);
+ }
+
+ /* FIXME: This appears on the surface to be wrong thing to be doing.
+ So much of the compiler is designed to check reload_completed to
+ see if it is running after reload that seems doomed to failure.
+ We should be returning a value that says that we have found
+ errors so that nothing but the cleanup passes are run
+ afterwards. */
+ gcc_assert (reload_completed || failure);
+ reload_completed = !failure;
+
+ /* The world has changed so much that at this point we might as well
+ just rescan everything. Not that df_rescan_all_insns is not
+ going to help here because it does not touch the artificial uses
+ and defs. */
+ df_finish_pass (true);
+ if (optimize > 1)
+ df_live_add_problem ();
+ df_scan_alloc (NULL);
+ df_scan_blocks ();
+
+ if (optimize)
+ df_analyze ();
+
+ regstat_free_n_sets_and_refs ();
+ regstat_free_ri ();
+ return 0;
+}
+
+struct tree_opt_pass pass_global_alloc =
+{
+ "greg", /* name */
+ NULL, /* gate */
+ rest_of_handle_global_alloc, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_GLOBAL_ALLOC, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func | TODO_verify_rtl_sharing
+ | TODO_ggc_collect, /* todo_flags_finish */
+ 'g' /* letter */
+};
+