* @author Matthias Braun, Mehdi
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include <limits.h>
#include "error.h"
#include "../besched.h"
-#include "../benode_t.h"
+#include "../benode.h"
#include "../beutil.h"
#include "../begnuas.h"
#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.
*/
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;
/* 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);
+ reg = arch_irn_get_register(node, pos);
} else {
const ir_edge_t *edge;
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;
}
}
id = get_entity_ident(get_SymConst_entity(node));
return get_id_str(id);
default:
- assert(0);
+ panic("Unsupported SymConst kind");
}
return NULL;
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;
}
if(offset > 0xffff || offset < -0xffff) {
- panic("stackframe > 2^16 bytes not supported yet\n");
+ panic("stackframe > 2^16 bytes not supported yet");
}
if(offset > 0) {
*/
static void mips_emit_block_label(const ir_node *block)
{
- if (has_Block_label(block)) {
- be_emit_string(be_gas_block_label_prefix());
- be_emit_irprintf("%lu", get_Block_label(block));
+ if (has_Block_entity(block)) {
+ ir_entity *entity = get_Block_entity(block);
+ be_gas_emit_entity(entity);
} else {
be_emit_cstring(BLOCK_PREFIX);
be_emit_irprintf("%ld", get_irn_node_nr(block));
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;
register_emitter(op_be_Keep, mips_emit_nothing);
register_emitter(op_be_Barrier, mips_emit_nothing);
register_emitter(op_be_Return, mips_emit_Return);
- register_emitter(op_be_RegParams, mips_emit_nothing);
+ register_emitter(op_be_Start, mips_emit_nothing);
register_emitter(op_be_Spill, mips_emit_this_shouldnt_happen);
register_emitter(op_be_Reload, mips_emit_this_shouldnt_happen);
register_emitter(op_be_Perm, mips_emit_Perm);
- register_emitter(op_Start, mips_emit_nothing);
register_emitter(op_Proj, mips_emit_nothing);
register_emitter(op_SymConst, mips_emit_this_shouldnt_happen);
register_emitter(op_Const, mips_emit_this_shouldnt_happen);
{
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);
}