Remove arch_get_allocatable_regs().
[libfirm] / ir / be / mips / mips_emitter.c
index 8c80ed6..de1d27a 100644 (file)
@@ -23,9 +23,7 @@
  * @author  Matthias Braun, Mehdi
  * @version $Id$
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <limits.h>
 
@@ -58,10 +56,6 @@ DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
 #define SNPRINTF_BUF_LEN 128
 
-static const mips_isa_t      *isa;
-static const arch_env_t      *arch_env;
-static const mips_code_gen_t *cg;
-
 /**
  * Returns the register at in position pos.
  */
@@ -76,7 +70,7 @@ static const arch_register_t *get_in_reg(const ir_node *node, int pos)
           in register we need. */
        op = get_irn_n(node, pos);
 
-       reg = arch_get_irn_register(arch_env, op);
+       reg = arch_get_irn_register(op);
 
        assert(reg && "no in register found");
        return reg;
@@ -96,7 +90,7 @@ static const arch_register_t *get_out_reg(const ir_node *node, int pos)
        /*           Proj with the corresponding projnum for the register */
 
        if (get_irn_mode(node) != mode_T) {
-               reg = arch_get_irn_register(arch_env, node);
+               reg = arch_get_irn_register(node);
        } else if (is_mips_irn(node)) {
                reg = get_mips_out_reg(node, pos);
        } else {
@@ -106,7 +100,7 @@ static const arch_register_t *get_out_reg(const ir_node *node, int pos)
                        proj = get_edge_src_irn(edge);
                        assert(is_Proj(proj) && "non-Proj from mode_T node");
                        if (get_Proj_proj(proj) == pos) {
-                               reg = arch_get_irn_register(arch_env, proj);
+                               reg = arch_get_irn_register(proj);
                                break;
                        }
                }
@@ -554,11 +548,11 @@ void emit_mips_jump_table(const ir_node *irn)
        const mips_attr_t *attr = get_mips_attr_const(irn);
 
        /* fill the table structure */
-       tbl.label        = xmalloc(SNPRINTF_BUF_LEN);
+       tbl.label        = XMALLOCN(char, SNPRINTF_BUF_LEN);
        tbl.label        = get_unique_label(tbl.label, SNPRINTF_BUF_LEN, "JMPTBL_");
        tbl.defBlock     = NULL;
        tbl.num_branches = get_irn_n_edges(irn);
-       tbl.branches     = xcalloc(tbl.num_branches, sizeof(tbl.branches[0]));
+       tbl.branches     = XMALLOCNZ(branch_t, tbl.num_branches);
        tbl.min_value    = INT_MAX;
        tbl.max_value    = INT_MIN;
 
@@ -804,19 +798,15 @@ void mips_gen_routine(mips_code_gen_t *mips_cg, ir_graph *irg)
 {
        int i, n;
 
-       cg       = mips_cg;
-       isa      = (const mips_isa_t*) cg->arch_env;
-       arch_env = cg->arch_env;
-
        mips_register_emitters();
 
        irg_block_walk_graph(irg, mips_gen_labels, NULL, NULL);
 
        mips_emit_func_prolog(irg);
 
-       n = ARR_LEN(cg->block_schedule);
+       n = ARR_LEN(mips_cg->block_schedule);
        for (i = 0; i < n; ++i) {
-               ir_node *block = cg->block_schedule[i];
+               ir_node *block = mips_cg->block_schedule[i];
                mips_gen_block(block);
        }