ir_node *start; /**< The be_Start params node. */
pmap *regs; /**< A map of all callee-save and ignore regs to
their Projs to the RegParams node. */
-
int start_block_bias; /**< The stack bias at the end of the start block. */
pmap *keep_map; /**< mapping blocks to keep nodes. */
/** Flag: if set, try to omit the frame pointer in all routines. */
static int be_omit_fp = 1;
+static ir_node *be_abi_reg_map_get(pmap *map, const arch_register_t *reg)
+{
+ return (ir_node*)pmap_get(map, reg);
+}
+
+static void be_abi_reg_map_set(pmap *map, const arch_register_t* reg,
+ ir_node *node)
+{
+ pmap_insert(map, reg, node);
+}
+
/*
_ ____ ___ ____ _ _ _ _
/ \ | __ )_ _| / ___|__ _| | | |__ __ _ ___| | _____
/* Insert a store for primitive arguments. */
if (is_atomic_type(param_type)) {
- ir_node *mem_input = do_seq ? curr_mem : new_r_NoMem(irg);
+ ir_node *nomem = get_irg_no_mem(irg);
+ ir_node *mem_input = do_seq ? curr_mem : nomem;
ir_node *store = new_rd_Store(dbgi, bl, mem_input, addr, param, cons_none);
mem = new_r_Proj(store, mode_M, pn_Store_M);
} else {
for (s = 0; s < ARR_LEN(states); ++s) {
const arch_register_t *reg = states[s];
const arch_register_class_t *cls = arch_register_get_class(reg);
-#if 0
- ir_node *regnode = be_abi_reg_map_get(env->regs, reg);
- ir_fprintf(stderr, "Adding %+F\n", regnode);
-#endif
ir_node *regnode = new_r_Unknown(irg, arch_register_class_mode(cls));
in[n_ins++] = regnode;
}
if (is_atomic_type(param_type) && get_irn_n_edges(args[i]) > 0) {
ir_mode *mode = get_type_mode(param_type);
ir_mode *load_mode = arg->load_mode;
+ ir_node *nomem = get_irg_no_mem(irg);
- ir_node *load = new_r_Load(start_bl, new_r_NoMem(irg), addr, load_mode, cons_floats);
+ ir_node *load = new_r_Load(start_bl, nomem, addr, load_mode, cons_floats);
repl = new_r_Proj(load, load_mode, pn_Load_res);
if (mode != load_mode) {
/* we need an extra indirection for global data outside our current
module. The loads are always safe and can therefore float
and need no memory input */
- load = new_r_Load(block, new_r_NoMem(irg), add, mode, cons_floats);
+ load = new_r_Load(block, get_irg_no_mem(irg), add, mode, cons_floats);
load_res = new_r_Proj(load, mode, pn_Load_res);
set_irn_n(node, i, load_res);
}
}
-be_abi_irg_t *be_abi_introduce(ir_graph *irg)
+void be_abi_introduce(ir_graph *irg)
{
be_abi_irg_t *env = XMALLOCZ(be_abi_irg_t);
ir_node *old_frame = get_irg_frame(irg);
exchange(dummy, env->init_sp);
exchange(old_frame, get_irg_frame(irg));
- return env;
+ pmap_destroy(env->regs);
+ env->regs = NULL;
}
void be_abi_free(ir_graph *irg)
if (env->call != NULL)
be_abi_call_free(env->call);
- if (env->regs != NULL)
- pmap_destroy(env->regs);
+ assert(env->regs == NULL);
free(env);
be_set_irg_abi(irg, NULL);
}
-/**
- * called after nodes have been transformed so some node references can be
- * replaced with new nodes
- */
-void be_abi_transform_fixup(ir_graph *irg)
-{
- be_abi_irg_t *abi = be_get_irg_abi(irg);
- pmap *new_regs;
- pmap_entry *entry;
- if (abi == NULL || abi->regs == NULL)
- return;
-
- new_regs = pmap_create();
- foreach_pmap(abi->regs, entry) {
- ir_node *value = (ir_node*)entry->value;
- ir_node *transformed = be_transform_node(value);
- pmap_insert(new_regs, entry->key, transformed);
- }
- pmap_destroy(abi->regs);
- abi->regs = new_regs;
-}
-
void be_put_allocatable_regs(const ir_graph *irg,
const arch_register_class_t *cls, bitset_t *bs)
{
}
}
-ir_node *be_abi_get_callee_save_irn(ir_graph *irg, const arch_register_t *reg)
-{
- const be_abi_irg_t *abi = be_get_irg_abi(irg);
- assert(reg->type & arch_register_type_callee_save);
- assert(pmap_contains(abi->regs, (void *) reg));
- return (ir_node*)pmap_get(abi->regs, (void *) reg);
-}
-
-ir_node *be_abi_get_ignore_irn(ir_graph *irg, const arch_register_t *reg)
-{
- const be_abi_irg_t *abi = be_get_irg_abi(irg);
- assert(pmap_contains(abi->regs, (void *) reg));
- return (ir_node*)pmap_get(abi->regs, (void *) reg);
-}
-
-BE_REGISTER_MODULE_CONSTRUCTOR(be_init_abi);
+BE_REGISTER_MODULE_CONSTRUCTOR(be_init_abi)
void be_init_abi(void)
{
FIRM_DBG_REGISTER(dbg, "firm.be.abi");