summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bespillslots.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2016-02-15 02:04:32 +0100
committerMatthias Braun <matze@braunis.de>2016-04-04 00:20:12 +0200
commitb6787e36eb0d99eb28f4fb478932e0c9ed094e90 (patch)
tree6ebad7cccab3ec6cf31ed7ce87ac3b9139f5d04f /ir/be/bespillslots.c
parentf2b6fca42c0970aa27fcdc5657968995b818a477 (diff)
be: Rewrite stack frame handling
This is a bigger rewrite of stack frame handling in the backend: - Do the stack frame type layout late, after all the spill slots have been created. This way we can avoid (and remove) the brittle frame_alloc_area(). - Standardize the meaning of stack entity offsets. After stack frame type layout they are relative to the stack pointer position at the beginning of the function. It is all in one type now, no splitting into "arg", "between" and "stack_frame" type anymore. - Generalize the stack pointer simulation code to work with a single callback. Represent stack state as current offset and align_padding number. Now that callbacks can access and modify them both we do not need custom code in the sparc backend anymore. - Remove alignment specification on IncSP, only keep a ignore_align flag used for the last IncSP that has to remove all existing sp adjustments and may end up on a misaligned SP on ia32/amd64. - Align stack by default on ia32+amd64 backends.
Diffstat (limited to 'ir/be/bespillslots.c')
-rw-r--r--ir/be/bespillslots.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/ir/be/bespillslots.c b/ir/be/bespillslots.c
index 7f4ab15..7281c3a 100644
--- a/ir/be/bespillslots.c
+++ b/ir/be/bespillslots.c
@@ -418,17 +418,6 @@ static memperm_t *get_memperm(be_fec_env_t *env, ir_node *block)
return res;
}
-static ir_entity* create_stack_entity(be_fec_env_t *env, spill_slot_t *slot)
-{
- ir_graph *irg = env->irg;
- ir_type *frame = get_irg_frame_type(irg);
- ir_entity *res = frame_alloc_area(frame, slot->size, slot->align,
- env->at_begin);
- slot->entity = res;
-
- return res;
-}
-
/**
* Enlarges a spillslot (if necessary) so that it can carry a value of size
* @p othersize and alignment @p otheralign.
@@ -493,6 +482,7 @@ static void assign_spillslots(be_fec_env_t *env)
}
}
+ ir_type *const frame = get_irg_frame_type(env->irg);
for (size_t s = 0; s < spillcount; ++s) {
const spill_t *spill = spills[s];
ir_node *node = spill->spill;
@@ -500,7 +490,7 @@ static void assign_spillslots(be_fec_env_t *env)
spill_slot_t *slot = &spillslots[slotid];
if (slot->entity == NULL)
- create_stack_entity(env, slot);
+ slot->entity = new_spillslot(frame, slot->size, slot->align);
if (is_Phi(node)) {
ir_node *block = get_nodes_block(node);
@@ -518,7 +508,8 @@ static void assign_spillslots(be_fec_env_t *env)
memperm_entry_t *entry;
spill_slot_t *argslot = &spillslots[argslotid];
if (argslot->entity == NULL)
- create_stack_entity(env, argslot);
+ argslot->entity = new_spillslot(frame, argslot->size,
+ argslot->align);
memperm = get_memperm(env, predblock);