Commit d981e88d authored by Michael Beck's avatar Michael Beck
Browse files

be_SubSP node added

parent fdaffc69
......@@ -123,6 +123,7 @@ ir_op *op_be_Call;
ir_op *op_be_Return;
ir_op *op_be_IncSP;
ir_op *op_be_AddSP;
ir_op *op_be_SubSP;
ir_op *op_be_SetSP;
ir_op *op_be_RegParams;
ir_op *op_be_StackParam;
......@@ -203,6 +204,7 @@ void be_node_init(void) {
op_be_Call = new_ir_op(beo_base + beo_Call, "be_Call", op_pin_state_pinned, F, oparity_variable, 0, sizeof(be_call_attr_t), &be_node_op_ops);
op_be_Return = new_ir_op(beo_base + beo_Return, "be_Return", op_pin_state_pinned, X, oparity_variable, 0, sizeof(be_return_attr_t), &be_node_op_ops);
op_be_AddSP = new_ir_op(beo_base + beo_AddSP, "be_AddSP", op_pin_state_pinned, N, oparity_unary, 0, sizeof(be_node_attr_t), &be_node_op_ops);
op_be_SubSP = new_ir_op(beo_base + beo_SubSP, "be_SubSP", op_pin_state_pinned, N, oparity_unary, 0, sizeof(be_node_attr_t), &be_node_op_ops);
op_be_SetSP = new_ir_op(beo_base + beo_SetSP, "be_SetSP", op_pin_state_pinned, N, oparity_binary, 0, sizeof(be_stack_attr_t), &be_node_op_ops);
op_be_IncSP = new_ir_op(beo_base + beo_IncSP, "be_IncSP", op_pin_state_pinned, N, oparity_binary, 0, sizeof(be_stack_attr_t), &be_node_op_ops);
op_be_RegParams = new_ir_op(beo_base + beo_RegParams, "be_RegParams", op_pin_state_pinned, N, oparity_zero, 0, sizeof(be_node_attr_t), &be_node_op_ops);
......@@ -222,6 +224,7 @@ void be_node_init(void) {
set_op_tag(op_be_Call, &be_node_tag);
set_op_tag(op_be_Return, &be_node_tag);
set_op_tag(op_be_AddSP, &be_node_tag);
set_op_tag(op_be_SubSP, &be_node_tag);
set_op_tag(op_be_SetSP, &be_node_tag);
set_op_tag(op_be_IncSP, &be_node_tag);
set_op_tag(op_be_RegParams, &be_node_tag);
......@@ -586,6 +589,29 @@ ir_node *be_new_AddSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_
return irn;
}
ir_node *be_new_SubSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *sz)
{
be_node_attr_t *a;
ir_node *irn;
ir_node *in[be_pos_SubSP_last];
in[be_pos_SubSP_old_sp] = old_sp;
in[be_pos_SubSP_size] = sz;
irn = new_ir_node(NULL, irg, bl, op_be_SubSP, mode_T, be_pos_SubSP_last, in);
a = init_node_attr(irn, be_pos_SubSP_last);
be_node_set_flags(irn, OUT_POS(pn_be_SubSP_res), arch_irn_flags_ignore | arch_irn_flags_modify_sp);
/* Set output constraint to stack register. */
be_set_constr_single_reg(irn, be_pos_SubSP_old_sp, sp);
be_node_set_reg_class(irn, be_pos_SubSP_size, arch_register_get_class(sp));
be_set_constr_single_reg(irn, OUT_POS(pn_be_SubSP_res), sp);
a->reg_data[pn_be_SubSP_res].reg = sp;
return irn;
}
ir_node *be_new_SetSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *op, ir_node *mem)
{
be_node_attr_t *a;
......
......@@ -39,6 +39,7 @@ extern ir_op *op_be_Call;
extern ir_op *op_be_Return;
extern ir_op *op_be_IncSP;
extern ir_op *op_be_AddSP;
extern ir_op *op_be_SubSP;
extern ir_op *op_be_SetSP;
extern ir_op *op_be_RegParams;
extern ir_op *op_be_StackParam;
......@@ -59,6 +60,7 @@ typedef enum {
beo_Call,
beo_Return,
beo_AddSP,
beo_SubSP,
beo_IncSP,
beo_SetSP,
beo_RegParams,
......@@ -181,6 +183,35 @@ enum {
*/
ir_node *be_new_AddSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *sz);
/**
* Position numbers for the be_SubSP inputs
*/
enum {
be_pos_SubSP_old_sp = 0,
be_pos_SubSP_size = 1,
be_pos_SubSP_last = 2
};
enum {
pn_be_SubSP_res = 0,
pn_be_SubSP_M = 1,
pn_be_SubSP_last = 2
};
/**
* Make a new SubSP node.
* A SubSP node expresses a decrease of the stack pointer in the direction the stack
* grows. In contrast to IncSP, the amount of bytes the stack pointer is grown, is not
* given by a constant but an ordinary Firm node.
* @param sp The stack pointer register.
* @param irg The graph.
* @param bl The block.
* @param old_sp The node representing the old stack pointer value.
* @param sz The node expressing the size by which the stack pointer shall be grown.
* @return A new DecSP node.
*/
ir_node *be_new_SubSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *sz);
ir_node *be_new_SetSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *operand, ir_node *mem);
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment