+ be_copy_opt_init();
+ copystat_init();
+ phi_class_init();
+}
+
+static be_main_env_t *be_init_env(be_main_env_t *env)
+{
+ obstack_init(&env->obst);
+ env->dbg = firm_dbg_register("be.main");
+
+ env->arch_env = obstack_alloc(&env->obst, sizeof(env->arch_env[0]));
+ arch_env_init(env->arch_env, isa_if);
+
+ /* Register the irn handler of the architecture */
+ if (arch_isa_get_irn_handler(env->arch_env->isa))
+ arch_env_add_irn_handler(env->arch_env, arch_isa_get_irn_handler(env->arch_env->isa));
+
+ /*
+ * Register the node handler of the back end infrastructure.
+ * This irn handler takes care of the platform independent
+ * spill, reload and perm nodes.
+ */
+ env->node_factory = obstack_alloc(&env->obst, sizeof(*env->node_factory));
+ be_node_factory_init(env->node_factory, env->arch_env->isa);
+ arch_env_add_irn_handler(env->arch_env, be_node_get_irn_handler(env->node_factory));
+
+ return env;
+}
+
+static void be_done_env(be_main_env_t *env)
+{
+ env->arch_env->isa->impl->done(env->arch_env->isa);
+ obstack_free(&env->obst, NULL);