*/
static be_abi_call_t *be_abi_call_new(const arch_register_class_t *cls_addr)
{
- be_abi_call_t *call = xmalloc(sizeof(call[0]));
- memset(call, 0, sizeof(call[0]));
+ be_abi_call_t *call = XMALLOCZ(be_abi_call_t);
call->flags.val = 0;
call->params = new_set(cmp_call_arg, 16);
DBG((dbg, LEVEL_1, "introducing abi on %+F\n", irg));
+ /* Must fetch memory here, otherwise the start Barrier gets the wrong
+ * memory, which leads to loops in the DAG. */
+ old_mem = get_irg_initial_mem(irg);
+
/* set the links of all frame entities to NULL, we use it
to detect if an entity is already linked in the value_param_list */
tp = get_method_value_param_type(method_type);
obstack_free(&env->obst, rm);
/* create a new initial memory proj */
- old_mem = get_irg_initial_mem(irg);
assert(is_Proj(old_mem));
new_mem_proj = new_r_Proj(irg, get_nodes_block(old_mem),
new_r_Unknown(irg, mode_T), mode_M,
mode = get_irn_mode(pred);
unknown = new_r_Unknown(irg, mode);
pic_base = arch_code_generator_get_pic_base(env->birg->cg);
- add = new_r_Add(irg, block, pic_base, pred, mode);
-
- /* make sure the walker doesn't visit this add again */
- mark_irn_visited(add);
/* all ok now for locally constructed stuff */
if (can_address_relative(entity)) {
+ ir_node *add = new_r_Add(irg, block, pic_base, pred, mode);
+
+ /* make sure the walker doesn't visit this add again */
+ mark_irn_visited(add);
set_irn_n(node, i, add);
continue;
}
pic_symbol = get_pic_symbol(be, entity);
pic_symconst = new_rd_SymConst_addr_ent(dbgi, irg, mode_P_code,
pic_symbol, NULL);
- set_Add_right(add, pic_symconst);
+ add = new_r_Add(irg, block, pic_base, pic_symconst, mode);
+ mark_irn_visited(add);
/* we need an extra indirection for global data outside our current
module. The loads are always safe and can therefore float
be_abi_irg_t *be_abi_introduce(be_irg_t *birg)
{
- be_abi_irg_t *env = xmalloc(sizeof(env[0]));
+ be_abi_irg_t *env = XMALLOC(be_abi_irg_t);
ir_node *old_frame = get_irg_frame(birg->irg);
ir_graph *irg = birg->irg;