+ /*
+ * Register the node handler of the back end infrastructure.
+ * This irn handler takes care of the platform independent
+ * spill, reload and perm nodes.
+ */
+ arch_env_push_irn_handler(env->arch_env, &be_node_irn_handler);
+ env->phi_handler = be_phi_handler_new(env->arch_env);
+ arch_env_push_irn_handler(env->arch_env, env->phi_handler);
+
+ return env;
+}
+
+static void be_done_env(be_main_env_t *env)
+{
+ env->arch_env->isa->impl->done(env->arch_env->isa);
+ be_phi_handler_free(env->phi_handler);
+ obstack_free(&env->obst, NULL);
+}
+
+static void dump(int mask, ir_graph *irg, const char *suffix,
+ void (*dumper)(ir_graph *, const char *))
+{
+ if(dump_flags & mask)
+ be_dump(irg, suffix, dumper);
+}
+
+/**
+ * Prepare a backend graph for code generation.
+ */
+static void prepare_graph(be_irg_t *birg)
+{
+ ir_graph *irg = birg->irg;
+
+ /* Normalize proj nodes. */
+ normalize_proj_nodes(irg);
+
+ /* Make just one return node. */
+ normalize_one_return(irg);
+
+ /* Remove critical edges */
+ remove_critical_cf_edges(irg);
+
+ /* Compute the dominance information. */
+ free_dom(irg);
+ compute_doms(irg);
+
+ /* Ensure, that the ir_edges are computed. */
+ edges_activate(irg);
+
+ /* check, if the dominance property is fulfilled. */
+ be_check_dominance(irg);
+
+ /* reset the phi handler. */
+ be_phi_handler_reset(birg->main_env->phi_handler);
+}
+
+/**
+ * The Firm backend main loop.
+ * Do architecture specific lowering for all graphs
+ * and call the architecture specific code generator.
+ */
+static void be_main_loop(FILE *file_handle)