fixed some bugs
[libfirm] / ir / be / belower.c
index 02e9d02..8064401 100644 (file)
@@ -257,7 +257,7 @@ static void lower_perm_node(ir_node *irn, void *walk_env) {
        ir_node         *arg1, *arg2, *res1, *res2;
        ir_node         *cpyxchg = NULL;
 
-       arch_env = env->chord_env->main_env->arch_env;
+       arch_env = env->chord_env->birg->main_env->arch_env;
        do_copy  = env->do_copy;
        mod      = env->dbg_module;
        block    = get_nodes_block(irn);
@@ -463,49 +463,6 @@ static void lower_perm_node(ir_node *irn, void *walk_env) {
 
 
 
-/**
- * Calls the backend code generator functions to lower Spill and
- * Reload nodes into Store and Load. The backend is fully responsible
- * for creating the new nodes and setting their input correct.
- * Note: The caller of this has to make sure that irn is a Spill
- *       or Reload!
- *
- * @param irn      The Spill/Reload node
- * @param walk_env The walker environment
- */
-static void lower_spill_reload(ir_node *irn, void *walk_env) {
-       lower_env_t           *env  = walk_env;
-       arch_code_generator_t *cg   = env->chord_env->main_env->cg;
-       const arch_env_t      *aenv = env->chord_env->main_env->arch_env;
-       ir_node               *res  = NULL;
-       ir_node               *sched_point;
-
-       if (be_is_Spill(irn) && cg->impl->lower_spill) {
-               res = cg->impl->lower_spill(cg, irn);
-       }
-       else if (be_is_Reload(irn) && cg->impl->lower_reload) {
-               res = cg->impl->lower_reload(cg, irn);
-               if (res && res != irn) {
-                       /* copy the result register from the reload to the load */
-                       arch_set_irn_register(aenv, res, arch_get_irn_register(aenv, irn));
-               }
-       }
-
-       if (res && res != irn) {
-               sched_point = sched_prev(irn);
-               sched_remove(irn);
-               exchange(irn, res);
-               sched_add_after(sched_point, res);
-       }
-       else {
-               DBG((env->dbg_module, LEVEL_1, "node %+F not lowered\n", irn));
-       }
-
-       return;
-}
-
-
-
 /**
  * Calls the corresponding lowering function for the node.
  *
@@ -514,15 +471,12 @@ static void lower_spill_reload(ir_node *irn, void *walk_env) {
  */
 static void lower_nodes_after_ra_walker(ir_node *irn, void *walk_env) {
        lower_env_t      *env      = walk_env;
-       const arch_env_t *arch_env = env->chord_env->main_env->arch_env;
+       const arch_env_t *arch_env = env->chord_env->birg->main_env->arch_env;
 
        if (!is_Block(irn) && !is_Proj(irn)) {
                if (is_Perm(arch_env, irn)) {
                        lower_perm_node(irn, walk_env);
                }
-               else if (be_is_Spill(irn) || be_is_Reload(irn)) {
-                       lower_spill_reload(irn, walk_env);
-               }
        }
 
        return;