/*
- * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved.
- *
* This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
+ * Copyright (C) 2012 University of Karlsruhe.
*/
/**
}
info->in_reqs = in_reqs;
- info->out_infos = NEW_ARR_D(reg_out_info_t, obst, n_outputs);
- memset(info->out_infos, 0, n_outputs * sizeof(info->out_infos[0]));
+ info->out_infos = NEW_ARR_DZ(reg_out_info_t, obst, n_outputs);
for (int i = 0; i < n_outputs; ++i) {
info->out_infos[i].req = arch_no_register_req;
}
be_node_set_reg_class_in(res, n_be_Spill_frame, cls_frame);
be_node_set_reg_class_in(res, n_be_Spill_val, cls);
arch_set_irn_register_req_out(res, 0, arch_no_register_req);
+ arch_add_irn_flags(res, arch_irn_flags_spill);
return res;
}
be_node_set_reg_class_in(irn, 0, sp->reg_class);
attr = (be_memperm_attr_t*)get_irn_generic_attr(irn);
- attr->in_entities = OALLOCNZ(irg->obst, ir_entity*, n);
- attr->out_entities = OALLOCNZ(irg->obst, ir_entity*, n);
+ attr->in_entities = OALLOCNZ(get_irg_obstack(irg), ir_entity*, n);
+ attr->out_entities = OALLOCNZ(get_irg_obstack(irg), ir_entity*, n);
return irn;
}
add_register_req_in(keep, cls->class_req);
}
-ir_node *be_new_Call(dbg_info *dbg, ir_graph *irg, ir_node *bl, ir_node *mem,
+ir_node *be_new_Call(dbg_info *dbg, ir_node *bl, ir_node *mem,
const arch_register_req_t *sp_req, ir_node *sp,
const arch_register_req_t *ptr_req, ir_node *ptr,
int n_outs, int n, ir_node *in[], ir_type *call_tp)
{
be_call_attr_t *a;
int real_n = n_be_Call_first_arg + n;
- ir_node *irn;
ir_node **real_in;
NEW_ARR_A(ir_node *, real_in, real_n);
real_in[n_be_Call_ptr] = ptr;
memcpy(&real_in[n_be_Call_first_arg], in, n * sizeof(in[0]));
- irn = new_ir_node(dbg, irg, bl, op_be_Call, mode_T, real_n, real_in);
+ ir_graph *const irg = get_Block_irg(bl);
+ ir_node *const irn = new_ir_node(dbg, irg, bl, op_be_Call, mode_T, real_n, real_in);
init_node_attr(irn, real_n, n_outs);
a = (be_call_attr_t*)get_irn_generic_attr(irn);
a->ent = NULL;
return a->pop;
}
-ir_node *be_new_Return(dbg_info *dbg, ir_graph *irg, ir_node *block, int n_res,
- unsigned pop, int n, ir_node *in[])
+ir_node *be_new_Return(dbg_info *const dbg, ir_node *const block, int const n_res, unsigned const pop, int const n, ir_node **const in)
{
- be_return_attr_t *a;
- ir_node *res;
-
- res = new_ir_node(dbg, irg, block, op_be_Return, mode_X, n, in);
+ ir_graph *const irg = get_Block_irg(block);
+ ir_node *const res = new_ir_node(dbg, irg, block, op_be_Return, mode_X, n, in);
init_node_attr(res, n, 1);
be_set_constr_out(res, 0, arch_no_register_req);
- a = (be_return_attr_t*)get_irn_generic_attr(res);
+ be_return_attr_t *const a = (be_return_attr_t*)get_irn_generic_attr(res);
a->num_ret_vals = n_res;
a->pop = pop;
a->emit_pop = 0;
static int get_start_reg_index(ir_graph *irg, const arch_register_t *reg)
{
ir_node *start = get_irg_start(irg);
- unsigned n_outs = arch_get_irn_n_outs(start);
- int i;
/* do a naive linear search... */
- for (i = 0; i < (int)n_outs; ++i) {
+ be_foreach_out(start, i) {
arch_register_req_t const *const out_req = arch_get_irn_register_req_out(start, i);
if (!arch_register_req_is(out_req, limited))
continue;
return new_r_Proj(start, mode, i);
}
-int be_find_return_reg_input(ir_node *ret, const arch_register_t *reg)
-{
- int arity = get_irn_arity(ret);
- int i;
- /* do a naive linear search... */
- for (i = 0; i < arity; ++i) {
- const arch_register_req_t *req = arch_get_irn_register_req_in(ret, i);
- if (!arch_register_req_is(req, limited))
- continue;
- if (req->cls != reg->reg_class)
- continue;
- if (!rbitset_is_set(req->limited, reg->index))
- continue;
- return i;
- }
- panic("Tried querying undefined register '%s' at Return", reg->name);
-}
-
static ir_entity* dummy_get_frame_entity(const ir_node *node)
{
(void) node;
int i;
ir_node *phi = new_ir_node(NULL, irg, block, op_Phi, mode, n_ins, ins);
- phi->attr.phi.u.backedge = new_backedge_arr(irg->obst, n_ins);
+ phi->attr.phi.u.backedge = new_backedge_arr(get_irg_obstack(irg), n_ins);
info = be_get_info(phi);
- info->out_infos = NEW_ARR_D(reg_out_info_t, obst, 1);
- memset(info->out_infos, 0, 1 * sizeof(info->out_infos[0]));
- info->in_reqs = OALLOCN(obst, const arch_register_req_t*, n_ins);
+ info->out_infos = NEW_ARR_DZ(reg_out_info_t, obst, 1);
+ info->in_reqs = OALLOCN(obst, const arch_register_req_t*, n_ins);
info->out_infos[0].req = req;
for (i = 0; i < n_ins; ++i) {
void be_dump_phi_reg_reqs(FILE *F, const ir_node *node, dump_reason_t reason)
{
+ ir_graph *irg = get_irn_irg(node);
+ if (!irg_is_constrained(irg, IR_GRAPH_CONSTRAINT_BACKEND))
+ return;
+
switch (reason) {
case dump_node_opcode_txt:
fputs(get_op_name(get_irn_op(node)), F);
case dump_node_nodeattr_txt:
break;
case dump_node_info_txt:
- {
- backend_info_t *info = be_get_info(node);
- if (info != NULL && info->out_infos[0].req != NULL) {
- arch_dump_reqs_and_registers(F, node);
- }
+ arch_dump_reqs_and_registers(F, node);
break;
- }
default:
break;