{
ir_node *irn;
ir_node *in[n_be_AddSP_last];
- const arch_register_class_t *cls;
ir_graph *irg;
be_node_attr_t *attr;
be_set_constr_single_reg_out(irn, pn_be_AddSP_sp, sp,
arch_register_req_type_produces_sp);
- cls = arch_register_get_class(sp);
-
return irn;
}
if (additional_types == 0) {
req = reg->single_req;
} else {
- ir_graph *irg = get_irn_irg(node);
struct obstack *obst = be_get_be_obst(irg);
req = be_create_reg_req(obst, reg, additional_types);
}
NULL, /* perform_memory_operand */
};
+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_irn_get_n_outs(start);
+ int i;
+
+ /* do a naive linear search... */
+ for (i = 0; i < (int)n_outs; ++i) {
+ const arch_register_req_t *out_req
+ = arch_get_out_register_req(start, i);
+ if (! (out_req->type & arch_register_req_type_limited))
+ continue;
+ if (out_req->cls != arch_register_get_class(reg))
+ continue;
+ if (!rbitset_is_set(out_req->limited, reg->index))
+ continue;
+ return i;
+ }
+ panic("Tried querying undefined register '%s' at Start", reg->name);
+}
+
+ir_node *be_get_initial_reg_value(ir_graph *irg, const arch_register_t *reg)
+{
+ int i = get_start_reg_index(irg, reg);
+ ir_node *start = get_irg_start(irg);
+ ir_mode *mode = arch_register_class_mode(arch_register_get_class(reg));
+ const ir_edge_t *edge;
+
+ foreach_out_edge(start, edge) {
+ ir_node *proj = get_edge_src_irn(edge);
+ if (!is_Proj(proj)) // maybe End/Anchor
+ continue;
+ if (get_Proj_proj(proj) == i) {
+ return proj;
+ }
+ }
+ 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_in_register_req(ret, i);
+ if (! (req->type & arch_register_req_type_limited))
+ continue;
+ if (req->cls != arch_register_get_class(reg))
+ continue;
+ if (!rbitset_is_set(req->limited, reg->index))
+ continue;
+ return i;
+ }
+ panic("Tried querying undefined register '%s' at Return", reg->name);
+}
+
static arch_irn_class_t dummy_classify(const ir_node *node)
{
(void) node;
}
if (be_is_IncSP(irn)) {
const be_incsp_attr_t *attr = (const be_incsp_attr_t*)get_irn_generic_attr_const(irn);
- if (attr->offset == BE_STACK_FRAME_SIZE_EXPAND) {
- fprintf(f, " [Setup Stackframe] ");
- } else if (attr->offset == BE_STACK_FRAME_SIZE_SHRINK) {
- fprintf(f, " [Destroy Stackframe] ");
- } else {
- fprintf(f, " [%d] ", attr->offset);
- }
+ fprintf(f, " [%d] ", attr->offset);
}
break;
case dump_node_info_txt:
case beo_IncSP: {
const be_incsp_attr_t *a = (const be_incsp_attr_t*)get_irn_generic_attr_const(irn);
fprintf(f, "align: %d\n", a->align);
- if (a->offset == BE_STACK_FRAME_SIZE_EXPAND)
- fprintf(f, "offset: FRAME_SIZE\n");
- else if (a->offset == BE_STACK_FRAME_SIZE_SHRINK)
- fprintf(f, "offset: -FRAME SIZE\n");
- else
- fprintf(f, "offset: %d\n", a->offset);
+ fprintf(f, "offset: %d\n", a->offset);
break;
}
case beo_Call: {
op_be_Keep = new_ir_op(beo_Keep, "be_Keep", op_pin_state_exc_pinned, irop_flag_keep, oparity_dynamic, 0, sizeof(be_node_attr_t), &be_node_op_ops);
op_be_CopyKeep = new_ir_op(beo_CopyKeep, "be_CopyKeep", op_pin_state_exc_pinned, irop_flag_keep, oparity_variable, 0, sizeof(be_node_attr_t), &be_node_op_ops);
op_be_Call = new_ir_op(beo_Call, "be_Call", op_pin_state_exc_pinned, irop_flag_fragile|irop_flag_uses_memory, oparity_variable, 0, sizeof(be_call_attr_t), &be_node_op_ops);
+ ir_op_set_fragile_indices(op_be_Call, n_be_Call_mem, pn_be_Call_X_regular, pn_be_Call_X_except);
op_be_Return = new_ir_op(beo_Return, "be_Return", op_pin_state_exc_pinned, irop_flag_cfopcode, oparity_dynamic, 0, sizeof(be_return_attr_t), &be_node_op_ops);
op_be_AddSP = new_ir_op(beo_AddSP, "be_AddSP", op_pin_state_exc_pinned, irop_flag_none, oparity_unary, 0, sizeof(be_node_attr_t), &be_node_op_ops);
op_be_SubSP = new_ir_op(beo_SubSP, "be_SubSP", op_pin_state_exc_pinned, irop_flag_none, oparity_unary, 0, sizeof(be_node_attr_t), &be_node_op_ops);