summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bestack.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2011-04-01 10:17:03 +0200
committerMatthias Braun <matze@braunis.de>2011-04-08 14:57:25 +0200
commit939b0af78227f2d14a4362a1b5518fd9e05b1053 (patch)
tree08716fdf5242f46f6bdbbd28bf0c5d099e1345bb /ir/be/bestack.c
parent7ddfd63ef9928a20b1f83134f6f627a0c0bb3ecd (diff)
Another rewrite of prolog/epilog handling: Delay their creation until after register allocation
Diffstat (limited to 'ir/be/bestack.c')
-rw-r--r--ir/be/bestack.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/ir/be/bestack.c b/ir/be/bestack.c
index 90b8407..8c39163 100644
--- a/ir/be/bestack.c
+++ b/ir/be/bestack.c
@@ -185,34 +185,24 @@ static int process_stack_bias(ir_node *bl, int real_bias)
if (be_is_IncSP(irn)) {
ofs = be_get_IncSP_offset(irn);
/* fill in real stack frame size */
- if (ofs == BE_STACK_FRAME_SIZE_EXPAND) {
- ir_type *frame_type = get_irg_frame_type(irg);
- ofs = (int) get_type_size_bytes(frame_type);
- be_set_IncSP_offset(irn, ofs);
- } else if (ofs == BE_STACK_FRAME_SIZE_SHRINK) {
- ir_type *frame_type = get_irg_frame_type(irg);
- ofs = - (int)get_type_size_bytes(frame_type);
- be_set_IncSP_offset(irn, ofs);
+ if (be_get_IncSP_align(irn)) {
+ /* patch IncSP to produce an aligned stack pointer */
+ ir_type *between_type = layout->between_type;
+ int between_size = get_type_size_bytes(between_type);
+ int alignment = 1 << arch_env->stack_alignment;
+ int delta = (real_bias + ofs + between_size) & (alignment - 1);
+ assert(ofs >= 0);
+ if (delta > 0) {
+ be_set_IncSP_offset(irn, ofs + alignment - delta);
+ real_bias += alignment - delta;
+ }
} else {
- if (be_get_IncSP_align(irn)) {
- /* patch IncSP to produce an aligned stack pointer */
- ir_type *between_type = layout->between_type;
- int between_size = get_type_size_bytes(between_type);
- int alignment = 1 << arch_env->stack_alignment;
- int delta = (real_bias + ofs + between_size) & (alignment - 1);
- assert(ofs >= 0);
- if (delta > 0) {
- be_set_IncSP_offset(irn, ofs + alignment - delta);
- real_bias += alignment - delta;
- }
- } else {
- /* adjust so real_bias corresponds with wanted_bias */
- int delta = wanted_bias - real_bias;
- assert(delta <= 0);
- if (delta != 0) {
- be_set_IncSP_offset(irn, ofs + delta);
- real_bias += delta;
- }
+ /* adjust so real_bias corresponds with wanted_bias */
+ int delta = wanted_bias - real_bias;
+ assert(delta <= 0);
+ if (delta != 0) {
+ be_set_IncSP_offset(irn, ofs + delta);
+ real_bias += delta;
}
}
real_bias += ofs;