Commit d200970e authored by Matthias Braun's avatar Matthias Braun
Browse files

arm: Attempt to fix memperm

parent aa373839
......@@ -542,27 +542,27 @@ static void emit_be_MemPerm(const ir_node *node)
int const memperm_offset = be_get_MemPerm_offset(node);
int sp_change = memperm_offset;
int sp_offset = memperm_offset;
for (int i = 0; i < memperm_arity; ++i) {
/* spill register */
arm_emitf(node, "str r%d, [sp, #-4]!", i);
sp_change += 4;
sp_offset -= 4;
/* load from entity */
ir_entity *entity = be_get_MemPerm_in_entity(node, i);
int offset = get_entity_offset(entity) + sp_change;
int offset = get_entity_offset(entity) + sp_offset;
arm_emitf(node, "ldr r%d, [sp, #%d]", i, offset);
}
for (int i = memperm_arity; i-- > 0; ) {
/* store to new entity */
ir_entity *entity = be_get_MemPerm_out_entity(node, i);
int offset = get_entity_offset(entity) + sp_change;
int offset = get_entity_offset(entity) + sp_offset;
arm_emitf(node, "str r%d, [sp, #%d]", i, offset);
/* restore register */
arm_emitf(node, "ldr r%d, [sp], #4", i);
sp_change -= 4;
sp_offset += 4;
}
assert(sp_change == memperm_offset);
assert(sp_offset == memperm_offset);
}
static void emit_arm_Jmp(const ir_node *node)
......
......@@ -96,6 +96,12 @@ static void introduce_prolog_epilog(ir_graph *irg)
static void arm_determine_frameoffset(ir_node *node, int sp_offset)
{
if (be_is_MemPerm(node)) {
ir_graph *irg = get_irn_irg(node);
if (arm_get_irg_data(irg)->omit_fp)
be_set_MemPerm_offset(node, sp_offset);
return;
}
if (!is_arm_irn(node))
return;
const arm_attr_t *attr = get_arm_attr_const(node);
......@@ -114,10 +120,6 @@ static void arm_determine_frameoffset(ir_node *node, int sp_offset)
load_store_attr->offset += get_entity_offset(entity);
load_store_attr->offset += sp_offset;
}
} else if (be_is_MemPerm(node)) {
ir_graph *irg = get_irn_irg(node);
if (arm_get_irg_data(irg)->omit_fp)
be_set_MemPerm_offset(node, sp_offset);
}
}
......
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