X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fmips%2Fmips_emitter.c;h=de1d27a722e21ee4c8ef50b5e2ffd290bfd56f9a;hb=026ec52ac914eee06e7afb961fb754735fb4ad9f;hp=e7fcae0728248e9f0f41271d9fa591c42feffdda;hpb=c28fcf22c08f71b02ccd8edb2e091c1b6c22e540;p=libfirm diff --git a/ir/be/mips/mips_emitter.c b/ir/be/mips/mips_emitter.c index e7fcae072..de1d27a72 100644 --- a/ir/be/mips/mips_emitter.c +++ b/ir/be/mips/mips_emitter.c @@ -23,9 +23,7 @@ * @author Matthias Braun, Mehdi * @version $Id$ */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include @@ -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; } } @@ -311,8 +305,6 @@ void mips_emit_IncSP(const ir_node *node) int offset = be_get_IncSP_offset(node); if(offset == 0) { - be_emit_cstring("\t/* omitted IncSP with 0 */"); - be_emit_finish_line_gas(node); return; } @@ -556,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; @@ -806,20 +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); - dump_ir_block_graph_sched(irg, "-kaputtelist"); - - for (i = 0, n = mips_get_sched_n_blocks(cg); i < n; ++i) { - ir_node *block = mips_get_sched_block(cg, i); + n = ARR_LEN(mips_cg->block_schedule); + for (i = 0; i < n; ++i) { + ir_node *block = mips_cg->block_schedule[i]; mips_gen_block(block); }