Commit c2f2e1c5 authored by Manuel Mohr's avatar Manuel Mohr
Browse files

Treat be_MemPerm node as having a frame entity and offset.

parent 9f66e3f5
......@@ -91,6 +91,7 @@ typedef struct {
be_node_attr_t base;
ir_entity **in_entities;
ir_entity **out_entities;
int offset;
} be_memperm_attr_t;
static unsigned be_opcode_start;
......@@ -395,6 +396,7 @@ ir_node *be_new_MemPerm(ir_node *const block, int n, ir_node *const *const in)
attr = (be_memperm_attr_t*)get_irn_generic_attr(irn);
attr->in_entities = OALLOCNZ(get_irg_obstack(irg), ir_entity*, n);
attr->out_entities = OALLOCNZ(get_irg_obstack(irg), ir_entity*, n);
attr->offset = 0;
return irn;
}
......@@ -757,6 +759,8 @@ ir_entity *be_get_frame_entity(const ir_node *irn)
if (be_has_frame_entity(irn)) {
const be_frame_attr_t *a = (const be_frame_attr_t*)get_irn_generic_attr_const(irn);
return a->ent;
} else if (be_is_MemPerm(irn)) {
return be_get_MemPerm_in_entity(irn, 0);
}
return NULL;
}
......@@ -767,6 +771,8 @@ int be_get_frame_offset(const ir_node *irn)
if (be_has_frame_entity(irn)) {
const be_frame_attr_t *a = (const be_frame_attr_t*)get_irn_generic_attr_const(irn);
return a->offset;
} else if (be_is_MemPerm(irn)) {
return be_get_MemPerm_offset(irn);
}
return 0;
}
......@@ -811,6 +817,22 @@ ir_entity* be_get_MemPerm_out_entity(const ir_node* irn, int n)
return attr->out_entities[n];
}
void be_set_MemPerm_offset(ir_node *irn, int offset)
{
be_memperm_attr_t *attr = (be_memperm_attr_t*)get_irn_generic_attr(irn);
assert(be_is_MemPerm(irn));
attr->offset = offset;
}
int be_get_MemPerm_offset(const ir_node *irn)
{
const be_memperm_attr_t *attr = (const be_memperm_attr_t*)get_irn_generic_attr_const(irn);
assert(be_is_MemPerm(irn));
return attr->offset;
}
int be_get_MemPerm_entity_arity(const ir_node *irn)
{
return get_irn_arity(irn) - 1;
......@@ -933,12 +955,14 @@ void be_node_set_frame_entity(ir_node *irn, ir_entity *ent)
static void be_node_set_frame_offset(ir_node *irn, int offset)
{
be_frame_attr_t *a;
if (be_is_MemPerm(irn)) {
be_set_MemPerm_offset(irn, offset);
return;
}
if (!be_has_frame_entity(irn))
return;
a = (be_frame_attr_t*)get_irn_generic_attr(irn);
be_frame_attr_t *a = (be_frame_attr_t*)get_irn_generic_attr(irn);
a->offset = offset;
}
......
......@@ -404,6 +404,9 @@ ir_entity *be_get_MemPerm_in_entity(const ir_node *irn, int n);
void be_set_MemPerm_out_entity(const ir_node *irn, int n, ir_entity* ent);
ir_entity *be_get_MemPerm_out_entity(const ir_node *irn, int n);
void be_set_MemPerm_offset(ir_node *irn, int offset);
int be_get_MemPerm_offset(const ir_node *irn);
int be_get_MemPerm_entity_arity(const ir_node *irn);
/**
......
Markdown is supported
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