summaryrefslogtreecommitdiffhomepage
path: root/ir/tr
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/tr
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/tr')
-rw-r--r--ir/tr/type.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/ir/tr/type.c b/ir/tr/type.c
index 1ef596f..2431ded 100644
--- a/ir/tr/type.c
+++ b/ir/tr/type.c
@@ -1094,58 +1094,6 @@ void default_layout_compound_type(ir_type *type)
set_type_state(type, layout_fixed);
}
-ir_entity *frame_alloc_area(ir_type *frame_type, int size, unsigned alignment,
- int at_start)
-{
- static unsigned area_cnt = 0;
-
- assert(is_frame_type(frame_type));
- assert(get_type_state(frame_type) == layout_fixed);
- assert(get_type_alignment(frame_type) > 0);
- set_type_state(frame_type, layout_undefined);
-
- if (irp->byte_type == NULL)
- irp->byte_type = new_type_primitive(mode_Bu);
-
- ident *const name = new_id_fmt("area%u", area_cnt++);
-
- ir_type *tp = new_type_array(irp->byte_type);
- set_array_size_int(tp, size);
- set_type_alignment(tp, alignment);
- set_type_size(tp, size);
-
- unsigned frame_size = get_type_size(frame_type);
- unsigned frame_align = get_type_alignment(frame_type);
- int offset;
- if (at_start) {
- unsigned delta = round_up2(size, frame_align);
- /* fix all offsets so far */
- for (size_t i = 0, n = get_compound_n_members(frame_type); i < n; ++i) {
- ir_entity *ent = get_compound_member(frame_type, i);
-
- set_entity_offset(ent, get_entity_offset(ent) + delta);
- }
- /* calculate offset and new type size */
- offset = 0;
- frame_size += delta;
- } else {
- /* calculate offset and new type size */
- offset = (frame_size + alignment - 1) & ~(alignment - 1);
- frame_size = offset + size;
- }
-
- ir_entity *area = new_entity(frame_type, name, tp);
- set_entity_visibility(area, ir_visibility_private);
- set_entity_offset(area, offset);
- set_type_size(frame_type, frame_size);
- if (alignment > frame_align) {
- set_type_alignment(frame_type, alignment);
- }
-
- set_type_state(frame_type, layout_fixed);
- return area;
-}
-
void ir_print_type(char *buffer, size_t buffer_size, const ir_type *type)
{
type_dbg_info *tdbgi = get_type_dbg_info(type);