/** The be_Stack attribute type. */
typedef struct {
be_node_attr_t node_attr;
- int offset; /**< The offset by which the stack shall be increased/decreased. */
- be_stack_dir_t dir; /**< The direction in which the stack shall be modified (expand or shrink). */
+ int offset; /**< The offset by which the stack shall be expanded/shrinked. */
} be_stack_attr_t;
/** The be_Frame attribute type. */
return get_irn_n(irn, be_pos_Reload_frame);
}
+ir_node *be_get_Spill_val(const ir_node *irn)
+{
+ assert(be_is_Spill(irn));
+ return get_irn_n(irn, be_pos_Spill_val);
+}
+
+ir_node *be_get_Spill_frame(const ir_node *irn)
+{
+ assert(be_is_Spill(irn));
+ return get_irn_n(irn, be_pos_Spill_frame);
+}
+
ir_node *be_new_Perm(const arch_register_class_t *cls, ir_graph *irg, ir_node *bl, int n, ir_node *in[])
{
int i;
return a->num_ret_vals;
}
-ir_node *be_new_IncSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *mem, unsigned offset, be_stack_dir_t dir)
+ir_node *be_new_IncSP(const arch_register_t *sp, ir_graph *irg, ir_node *bl, ir_node *old_sp, ir_node *mem, int offset)
{
be_stack_attr_t *a;
ir_node *irn;
in[1] = mem;
irn = new_ir_node(NULL, irg, bl, op_be_IncSP, sp->reg_class->mode, 2, in);
a = init_node_attr(irn, 1);
- a->dir = dir;
a->offset = offset;
be_node_set_flags(irn, -1, arch_irn_flags_ignore | arch_irn_flags_modify_sp);
}
}
-entity *be_get_frame_entity(const ir_node *irn)
+entity* be_get_frame_entity(const ir_node *irn)
{
if(be_has_frame_entity(irn)) {
be_frame_attr_t *a = get_irn_attr(irn);
return NULL;
}
-void be_set_frame_entity(const ir_node *irn, entity* ent)
-{
- be_frame_attr_t *a;
-
- assert(be_has_frame_entity(irn));
-
- a = get_irn_attr(irn);
- a->ent = ent;
-}
-
void be_set_MemPerm_in_entity(const ir_node *irn, int n, entity *ent)
{
be_memperm_attr_t *attr = get_irn_attr(irn);
return get_irn_n(irn, 1);
}
-void be_set_IncSP_offset(ir_node *irn, unsigned offset)
+void be_set_IncSP_offset(ir_node *irn, int offset)
{
be_stack_attr_t *a = get_irn_attr(irn);
assert(be_is_IncSP(irn));
a->offset = offset;
}
-unsigned be_get_IncSP_offset(const ir_node *irn)
+int be_get_IncSP_offset(const ir_node *irn)
{
be_stack_attr_t *a = get_irn_attr(irn);
assert(be_is_IncSP(irn));
return a->offset;
}
-void be_set_IncSP_direction(ir_node *irn, be_stack_dir_t dir)
-{
- be_stack_attr_t *a = get_irn_attr(irn);
- assert(be_is_IncSP(irn));
- a->dir = dir;
-}
-
-be_stack_dir_t be_get_IncSP_direction(const ir_node *irn)
-{
- be_stack_attr_t *a = get_irn_attr(irn);
- assert(be_is_IncSP(irn));
- return a->dir;
-}
-
ir_node *be_spill(const arch_env_t *arch_env, ir_node *irn)
{
ir_node *bl = get_nodes_block(irn);
XXX(StackParam, stackparam);
#undef XXX
default:
- return 0;
+ return arch_irn_class_normal;
}
return 0;
return be_get_frame_entity(irn);
}
-static void be_node_set_frame_entity(const void *self, const ir_node *irn, entity *ent)
+static void be_node_set_frame_entity(const void *self, ir_node *irn, entity *ent)
{
- be_set_frame_entity(irn, ent);
+ be_frame_attr_t *a;
+
+ assert(be_has_frame_entity(irn));
+
+ a = get_irn_attr(irn);
+ a->ent = ent;
}
static void be_node_set_frame_offset(const void *self, ir_node *irn, int offset)
}
}
+static int be_node_get_sp_bias(const void *self, const ir_node *irn)
+{
+ int result = 0;
+
+ if(be_is_IncSP(irn)) {
+ result = be_get_IncSP_offset(irn);
+ }
+
+ return result;
+}
+
/*
___ ____ _ _ _ _ _ _
|_ _| _ \| \ | | | | | | __ _ _ __ __| | | ___ _ __
be_node_get_frame_entity,
be_node_set_frame_entity,
be_node_set_frame_offset,
+ be_node_get_sp_bias,
NULL, /* get_inverse */
NULL, /* get_op_estimated_cost */
NULL, /* possible_memory_operand */
return NULL;
}
-static void phi_set_frame_entity(const void *_self, const ir_node *irn, entity *ent)
+static void phi_set_frame_entity(const void *_self, ir_node *irn, entity *ent)
{
}
{
}
+static int phi_get_sp_bias(const void* self, const ir_node *irn)
+{
+ return 0;
+}
+
static const arch_irn_ops_if_t phi_irn_ops = {
phi_get_irn_reg_req,
phi_set_irn_reg,
phi_get_frame_entity,
phi_set_frame_entity,
phi_set_frame_offset,
+ phi_get_sp_bias,
NULL, /* get_inverse */
NULL, /* get_op_estimated_cost */
NULL, /* possible_memory_operand */
case beo_IncSP:
{
be_stack_attr_t *a = (be_stack_attr_t *) at;
- if (a->offset == BE_STACK_FRAME_SIZE)
+ 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: %u\n", a->offset);
- fprintf(f, "direction: %s\n", a->dir == be_stack_dir_expand ? "expand" : "shrink");
}
break;
case beo_Call: