diff --git a/ir_dump.c b/ir_dump.c index 5d7c989..820ce13 100644 --- a/ir_dump.c +++ b/ir_dump.c @@ -288,7 +288,7 @@ void ir_dump_live_ranges(ir_ctx *ctx, FILE *f) } } fprintf(f, ")"); - if (ival->stack_spill_pos) { + if (ival->stack_spill_pos != -1) { fprintf(f, " [SPILL=0x%x]", ival->stack_spill_pos); } } diff --git a/ir_ra.c b/ir_ra.c index ba69da7..a2db3c8 100644 --- a/ir_ra.c +++ b/ir_ra.c @@ -69,7 +69,7 @@ static void ir_add_local_var(ir_ctx *ctx, int v, uint8_t type) ival->reg = IR_REG_NONE; ival->flags = IR_LIVE_INTERVAL_VAR; ival->vreg = v; - ival->stack_spill_pos = 0; // not allocated + ival->stack_spill_pos = -1; // not allocated ival->range.start = 0; ival->range.end = ctx->insns_count; ival->range.next = NULL; @@ -93,7 +93,7 @@ static void ir_add_live_range(ir_ctx *ctx, int v, uint8_t type, ir_live_pos star ival->reg = IR_REG_NONE; ival->flags = 0; ival->vreg = v; - ival->stack_spill_pos = 0; // not allocated + ival->stack_spill_pos = -1; // not allocated ival->range.start = start; ival->range.end = end; ival->range.next = NULL; @@ -165,7 +165,7 @@ static void ir_add_fixed_live_range(ir_ctx *ctx, ir_reg reg, ir_live_pos start, ival->reg = reg; ival->flags = IR_LIVE_INTERVAL_FIXED; ival->vreg = v; - ival->stack_spill_pos = 0; // not allocated + ival->stack_spill_pos = -1; // not allocated ival->range.start = start; ival->range.end = end; ival->range.next = NULL; @@ -188,7 +188,7 @@ static void ir_add_tmp(ir_ctx *ctx, ir_ref ref, ir_tmp_reg tmp_reg) ival->reg = IR_REG_NONE; ival->flags = IR_LIVE_INTERVAL_TEMP | tmp_reg.num; ival->vreg = 0; - ival->stack_spill_pos = 0; // not allocated + ival->stack_spill_pos = -1; // not allocated ival->range.start = IR_START_LIVE_POS_FROM_REF(ref) + tmp_reg.start; ival->range.end = IR_START_LIVE_POS_FROM_REF(ref) + tmp_reg.end; ival->range.next = NULL; @@ -1091,7 +1091,8 @@ int ir_gen_dessa_moves(ir_ctx *ctx, int b, emit_copy_t emit_copy) * Christian Wimmer VEE'10 (2005), Figure 2. */ typedef struct _ir_lsra_data { - uint32_t stack_frame_size; + int32_t stack_frame_size; + int32_t unused_slot; } ir_lsra_data; #ifdef IR_DEBUG @@ -1324,7 +1325,7 @@ static ir_live_interval *ir_split_interval_at(ir_ctx *ctx, ir_live_interval *iva child->reg = IR_REG_NONE; child->flags = 0; child->vreg = ival->vreg; - child->stack_spill_pos = 0; // not allocated + child->stack_spill_pos = -1; // not allocated child->range.start = pos; child->range.end = p->end; child->range.next = p->next; @@ -1360,9 +1361,21 @@ static ir_live_interval *ir_split_interval_at(ir_ctx *ctx, ir_live_interval *iva static void ir_allocate_spill_slot(ir_ctx *ctx, ir_live_interval *ival, ir_lsra_data *data) { ival = ival->top; - if (ival->stack_spill_pos == 0) { - data->stack_frame_size += 8; // ir_type_size[insn->type]; // TODO: alignment - ival->stack_spill_pos = data->stack_frame_size; + if (ival->stack_spill_pos == -1) { + IR_ASSERT(ival->type != IR_VOID); + uint8_t size = ir_type_size[ival->type]; + if (size == 8) { + ival->stack_spill_pos = data->stack_frame_size; + data->stack_frame_size += 8; + } else if (data->unused_slot) { + ival->stack_spill_pos = data->unused_slot; + data->unused_slot = 0; + } else { + ival->stack_spill_pos = data->stack_frame_size; + data->stack_frame_size += 4; + data->unused_slot = data->stack_frame_size; + data->stack_frame_size += 4; + } } } @@ -1887,6 +1900,7 @@ static int ir_linear_scan(ir_ctx *ctx) ctx->data = &data; data.stack_frame_size = 0; + data.unused_slot = 0; for (j = 1; j <= ctx->vregs_count; j++) { ival = ctx->live_intervals[j]; @@ -1982,7 +1996,7 @@ static int ir_linear_scan(ir_ctx *ctx) ir_insn *var = &ctx->ir_base[insn->op2]; IR_ASSERT(var->op == IR_VAR); if (strcmp(ir_get_str(ctx, var->op2), "_spill_") == 0) { - if (ctx->live_intervals[ctx->vregs[insn->op2]]->stack_spill_pos) { + if (ctx->live_intervals[ctx->vregs[insn->op2]]->stack_spill_pos != -1) { ival->stack_spill_pos = ctx->live_intervals[ctx->vregs[insn->op2]]->stack_spill_pos; } else { @@ -1999,7 +2013,7 @@ static int ir_linear_scan(ir_ctx *ctx) ir_insn *var = &ctx->ir_base[insn->op2]; IR_ASSERT(var->op == IR_VAR); if (strcmp(ir_get_str(ctx, var->op2), "_spill_") == 0) { - if (ctx->live_intervals[ctx->vregs[insn->op2]]->stack_spill_pos) { + if (ctx->live_intervals[ctx->vregs[insn->op2]]->stack_spill_pos != -1) { ival->stack_spill_pos = ctx->live_intervals[ctx->vregs[insn->op2]]->stack_spill_pos; } else { @@ -2072,7 +2086,7 @@ static void assign_regs(ir_ctx *ctx) use_pos = ival->use_pos; while (use_pos) { reg = ival->reg; - if (ival->top->stack_spill_pos){ + if (ival->top->stack_spill_pos != -1) { // TODO: Insert spill loads and stotres in optimal positons (resolution) if (use_pos->op_num == 0) { diff --git a/ir_x86.dasc b/ir_x86.dasc index 29ddaae..f385fc8 100644 --- a/ir_x86.dasc +++ b/ir_x86.dasc @@ -404,6 +404,7 @@ typedef struct _ir_backend_data { int32_t stack_frame_size; + int32_t unused_slot; int32_t stack_frame_alignment; ir_regset used_preserved_regs; uint32_t dessa_from_block; @@ -1459,11 +1460,11 @@ static ir_reg ir_ref_spill_slot(ir_ctx *ctx, ir_ref ref) IR_ASSERT(ref >= 0); offset = ctx->live_intervals[ctx->vregs[ref]]->stack_spill_pos; - IR_ASSERT(offset != 0); + IR_ASSERT(offset != -1); if (ctx->flags & IR_USE_FRAME_POINTER) { - return offset - data->stack_frame_size - data->stack_frame_alignment - sizeof(void*); + return offset - data->stack_frame_size - data->stack_frame_alignment; } else { - return offset + data->stack_frame_alignment - sizeof(void*); + return offset + data->stack_frame_alignment; } } @@ -1520,12 +1521,12 @@ static void ir_emit_load(ir_ctx *ctx, ir_type type, ir_reg reg, ir_ref src) } } else { offset = ctx->live_intervals[ctx->vregs[src]]->stack_spill_pos; - IR_ASSERT(offset != 0); + IR_ASSERT(offset != -1); if (ctx->flags & IR_USE_FRAME_POINTER) { - offset = offset - data->stack_frame_size - data->stack_frame_alignment - sizeof(void*); + offset = offset - data->stack_frame_size - data->stack_frame_alignment; fp = IR_REG_RBP; } else { - offset = offset + data->stack_frame_alignment - sizeof(void*); + offset = offset + data->stack_frame_alignment; fp = IR_REG_RSP; } @@ -1546,12 +1547,12 @@ static void ir_emit_store(ir_ctx *ctx, ir_type type, ir_ref dst, ir_reg reg) IR_ASSERT(dst >= 0); offset = ctx->live_intervals[ctx->vregs[dst]]->stack_spill_pos; - IR_ASSERT(offset != 0); + IR_ASSERT(offset != -1); if (ctx->flags & IR_USE_FRAME_POINTER) { - offset = offset - data->stack_frame_size - data->stack_frame_alignment - sizeof(void*); + offset = offset - data->stack_frame_size - data->stack_frame_alignment; fp = IR_REG_RBP; } else { - offset = offset + data->stack_frame_alignment - sizeof(void*); + offset = offset + data->stack_frame_alignment; fp = IR_REG_RSP; } @@ -1571,6 +1572,7 @@ static bool ir_is_same_mem(ir_ctx *ctx, ir_ref r1, ir_ref r2) } o1 = ctx->live_intervals[ctx->vregs[r1]]->stack_spill_pos; o2 = ctx->live_intervals[ctx->vregs[r2]]->stack_spill_pos; + IR_ASSERT(o1 != -1 && o2 != -1); return o1 == o2 && o1; } @@ -3999,6 +4001,24 @@ static int ir_fix_dessa_tmps(ir_ctx *ctx, uint8_t type, ir_ref from, ir_ref to) return 1; } +static void ir_allocate_spill_slot(ir_ctx *ctx, ir_live_interval *ival, ir_backend_data *data) +{ + IR_ASSERT(ival->type != IR_VOID); + uint8_t size = ir_type_size[ival->type]; + if (size == 8) { + ival->stack_spill_pos = data->stack_frame_size; + data->stack_frame_size += 8; + } else if (data->unused_slot) { + ival->stack_spill_pos = data->unused_slot; + data->unused_slot = 0; + } else { + ival->stack_spill_pos = data->stack_frame_size; + data->stack_frame_size += 4; + data->unused_slot = data->stack_frame_size; + data->stack_frame_size += 4; + } +} + static void ir_allocate_unique_spill_slots(ir_ctx *ctx) { int b; @@ -4049,7 +4069,7 @@ static void ir_allocate_unique_spill_slots(ir_ctx *ctx) if (ir_get_use_flags(ctx, i, 0) & IR_USE_MUST_BE_IN_REG) { if (insn->op == IR_VLOAD && ctx->live_intervals[ctx->vregs[i]] - && ctx->live_intervals[ctx->vregs[i]]->stack_spill_pos) { + && ctx->live_intervals[ctx->vregs[i]]->stack_spill_pos != -1) { /* pass */ } else { ir_reg reg = ir_get_free_reg(insn->type, available); @@ -4063,13 +4083,13 @@ static void ir_allocate_unique_spill_slots(ir_ctx *ctx) ival->type = insn->type; ival->reg = IR_REG_NONE; ival->vreg = ctx->vregs[i]; - data->stack_frame_size += 8; // ir_type_size[insn->type]; // TODO: alignment - ival->stack_spill_pos = data->stack_frame_size; + ir_allocate_spill_slot(ctx, ival, data); ival->top = ival; if (insn->op == IR_VAR) { ir_use_list *use_list = &ctx->use_lists[i]; ir_reg i, n, *p, use; ir_insn *use_insn; + int32_t stack_spill_pos = ival->stack_spill_pos; n = use_list->count; for (i = 0, p = &ctx->use_edges[use_list->refs]; i < n; i++, p++) { @@ -4083,7 +4103,7 @@ static void ir_allocate_unique_spill_slots(ir_ctx *ctx) ival->type = insn->type; ival->reg = IR_REG_NONE; ival->vreg = ctx->vregs[use]; - ival->stack_spill_pos = data->stack_frame_size; + ival->stack_spill_pos = stack_spill_pos; ival->top = ival; } } else if (use_insn->op == IR_VSTORE) { @@ -4095,7 +4115,7 @@ static void ir_allocate_unique_spill_slots(ir_ctx *ctx) ival->type = insn->type; ival->reg = IR_REG_NONE; ival->vreg = ctx->vregs[insn->op3]; - ival->stack_spill_pos = data->stack_frame_size; + ival->stack_spill_pos = stack_spill_pos; ival->top = ival; } } @@ -4206,9 +4226,9 @@ static void ir_calc_stack_frame_size(ir_ctx *ctx, ir_backend_data *data) for (i = 1, p = ctx->live_intervals + i; i <= ctx->vregs_count; i++, p++) { ival = *p; if (ival) { - if (ival->stack_spill_pos) { - if (ival->stack_spill_pos > data->stack_frame_size) { - data->stack_frame_size = ival->stack_spill_pos; + if (ival->stack_spill_pos != -1) { + if (ival->stack_spill_pos + ir_type_size[ival->type] > data->stack_frame_size) { + data->stack_frame_size = ival->stack_spill_pos + ir_type_size[ival->type]; } } if (ival->reg >= 0) { @@ -4220,6 +4240,7 @@ static void ir_calc_stack_frame_size(ir_ctx *ctx, ir_backend_data *data) } } } + data->stack_frame_size = IR_ALIGNED_SIZE(data->stack_frame_size, 8); data->stack_frame_size += additional_size; if (ctx->flags & IR_HAS_CALLS) { @@ -4254,6 +4275,7 @@ void *ir_emit(ir_ctx *ctx, size_t *size) ctx->data = &data; data.stack_frame_size = 0; + data.unused_slot = 0; data.stack_frame_alignment = 0; data.used_preserved_regs = 0; data.rodata_label = 0; diff --git a/tests/debug/fig-O0.irt b/tests/debug/fig-O0.irt index a2664dc..14796f2 100644 --- a/tests/debug/fig-O0.irt +++ b/tests/debug/fig-O0.irt @@ -66,123 +66,123 @@ Fig -O0 } --EXPECT-- test: - subq $0x128, %rsp + subq $0x98, %rsp movl %edi, (%rsp) - movl %esi, 8(%rsp) - movl %edx, 0x10(%rsp) - movl %ecx, 0x18(%rsp) - movl %r9d, 0x20(%rsp) + movl %esi, 4(%rsp) + movl %edx, 8(%rsp) + movl %ecx, 0xc(%rsp) + movl %r9d, 0x10(%rsp) movl -8(%rsp), %eax - movl %eax, 0x28(%rsp) + movl %eax, 0x14(%rsp) movl -8(%rsp), %eax - movl %eax, 0x30(%rsp) + movl %eax, 0x18(%rsp) movl -8(%rsp), %eax - movl %eax, 0x38(%rsp) + movl %eax, 0x1c(%rsp) movl -8(%rsp), %eax - movl %eax, 0x40(%rsp) + movl %eax, 0x20(%rsp) movl (%rsp), %eax - movl %eax, 0x48(%rsp) + movl %eax, 0x24(%rsp) + movl 0xc(%rsp), %eax + movl %eax, 0x28(%rsp) + movl 0x10(%rsp), %eax + movl %eax, 0x2c(%rsp) + movl 0x14(%rsp), %eax + movl %eax, 0x30(%rsp) movl 0x18(%rsp), %eax - movl %eax, 0x50(%rsp) - movl 0x20(%rsp), %eax - movl %eax, 0x58(%rsp) + movl %eax, 0x34(%rsp) +.L1: + cmpl $0, 0x1c(%rsp) + je .L2 + movl 8(%rsp), %eax + imull 4(%rsp), %eax + movl %eax, 0x38(%rsp) + movl 0x38(%rsp), %eax + addl $4, %eax + movl %eax, 0x3c(%rsp) + movl 8(%rsp), %eax + movl %eax, 0x40(%rsp) + movl 0x40(%rsp), %eax + movl %eax, 0x54(%rsp) movl 0x28(%rsp), %eax + movl %eax, 0x58(%rsp) + movl 0x38(%rsp), %eax + movl %eax, 0x5c(%rsp) + movl 0x3c(%rsp), %eax movl %eax, 0x60(%rsp) movl 0x30(%rsp), %eax + movl %eax, 0x64(%rsp) + movl 0x34(%rsp), %eax movl %eax, 0x68(%rsp) -.L1: - cmpl $0, 0x38(%rsp) - je .L2 - movl 0x10(%rsp), %eax - imull 8(%rsp), %eax - movl %eax, 0x70(%rsp) - movl 0x70(%rsp), %eax - addl $4, %eax - movl %eax, 0x78(%rsp) - movl 0x10(%rsp), %eax - movl %eax, 0x80(%rsp) - movl 0x80(%rsp), %eax - movl %eax, 0xa8(%rsp) - movl 0x50(%rsp), %eax - movl %eax, 0xb0(%rsp) - movl 0x70(%rsp), %eax - movl %eax, 0xb8(%rsp) - movl 0x78(%rsp), %eax - movl %eax, 0xc0(%rsp) - movl 0x60(%rsp), %eax - movl %eax, 0xc8(%rsp) - movl 0x68(%rsp), %eax - movl %eax, 0xd0(%rsp) jmp .L3 .L2: - movl 0x10(%rsp), %eax - movl %eax, 0x88(%rsp) - movl 0x88(%rsp), %eax - imull 8(%rsp), %eax - movl %eax, 0x90(%rsp) - movl 0x48(%rsp), %eax - imull 8(%rsp), %eax - movl %eax, 0x98(%rsp) - movl 0x98(%rsp), %eax - addl $1, %eax - movl %eax, 0xa0(%rsp) - movl 0x48(%rsp), %eax - movl %eax, 0xa8(%rsp) - movl 0x88(%rsp), %eax - movl %eax, 0xb0(%rsp) - movl 0x90(%rsp), %eax - movl %eax, 0xb8(%rsp) - movl 0x58(%rsp), %eax - movl %eax, 0xc0(%rsp) - movl 0x98(%rsp), %eax - movl %eax, 0xc8(%rsp) - movl 0xa0(%rsp), %eax - movl %eax, 0xd0(%rsp) -.L3: - movl 0xa8(%rsp), %eax - imull 8(%rsp), %eax - movl %eax, 0xd8(%rsp) - movl 0xd8(%rsp), %eax - addl $1, %eax - movl %eax, 0xe0(%rsp) - cmpl $0, 0x40(%rsp) - je .L4 - movl 0xa8(%rsp), %eax + movl 8(%rsp), %eax + movl %eax, 0x44(%rsp) + movl 0x44(%rsp), %eax + imull 4(%rsp), %eax movl %eax, 0x48(%rsp) - movl 0xb0(%rsp), %eax + movl 0x24(%rsp), %eax + imull 4(%rsp), %eax + movl %eax, 0x4c(%rsp) + movl 0x4c(%rsp), %eax + addl $1, %eax movl %eax, 0x50(%rsp) - movl 0xc0(%rsp), %eax + movl 0x24(%rsp), %eax + movl %eax, 0x54(%rsp) + movl 0x44(%rsp), %eax movl %eax, 0x58(%rsp) - movl 0xc8(%rsp), %eax + movl 0x48(%rsp), %eax + movl %eax, 0x5c(%rsp) + movl 0x2c(%rsp), %eax movl %eax, 0x60(%rsp) - movl 0xd0(%rsp), %eax + movl 0x4c(%rsp), %eax + movl %eax, 0x64(%rsp) + movl 0x50(%rsp), %eax movl %eax, 0x68(%rsp) +.L3: + movl 0x54(%rsp), %eax + imull 4(%rsp), %eax + movl %eax, 0x6c(%rsp) + movl 0x6c(%rsp), %eax + addl $1, %eax + movl %eax, 0x70(%rsp) + cmpl $0, 0x20(%rsp) + je .L4 + movl 0x54(%rsp), %eax + movl %eax, 0x24(%rsp) + movl 0x58(%rsp), %eax + movl %eax, 0x28(%rsp) + movl 0x60(%rsp), %eax + movl %eax, 0x2c(%rsp) + movl 0x64(%rsp), %eax + movl %eax, 0x30(%rsp) + movl 0x68(%rsp), %eax + movl %eax, 0x34(%rsp) jmp .L1 .L4: - movl 0xa8(%rsp), %eax + movl 0x54(%rsp), %eax + addl 4(%rsp), %eax + movl %eax, 0x74(%rsp) + movl 0x74(%rsp), %eax addl 8(%rsp), %eax - movl %eax, 0xe8(%rsp) - movl 0xe8(%rsp), %eax - addl 0x10(%rsp), %eax - movl %eax, 0xf0(%rsp) - movl 0xf0(%rsp), %eax - addl 0xb0(%rsp), %eax - movl %eax, 0xf8(%rsp) - movl 0xf8(%rsp), %eax - addl 0xb8(%rsp), %eax - movl %eax, 0x100(%rsp) - movl 0x100(%rsp), %eax - addl 0xc0(%rsp), %eax - movl %eax, 0x108(%rsp) - movl 0x108(%rsp), %eax - addl 0xc8(%rsp), %eax - movl %eax, 0x110(%rsp) - movl 0x110(%rsp), %eax - addl 0xd0(%rsp), %eax - movl %eax, 0x118(%rsp) - movl 0x118(%rsp), %eax - addl 0xe0(%rsp), %eax - movl %eax, 0x120(%rsp) - movl 0x120(%rsp), %eax - addq $0x128, %rsp + movl %eax, 0x78(%rsp) + movl 0x78(%rsp), %eax + addl 0x58(%rsp), %eax + movl %eax, 0x7c(%rsp) + movl 0x7c(%rsp), %eax + addl 0x5c(%rsp), %eax + movl %eax, 0x80(%rsp) + movl 0x80(%rsp), %eax + addl 0x60(%rsp), %eax + movl %eax, 0x84(%rsp) + movl 0x84(%rsp), %eax + addl 0x64(%rsp), %eax + movl %eax, 0x88(%rsp) + movl 0x88(%rsp), %eax + addl 0x68(%rsp), %eax + movl %eax, 0x8c(%rsp) + movl 0x8c(%rsp), %eax + addl 0x70(%rsp), %eax + movl %eax, 0x90(%rsp) + movl 0x90(%rsp), %eax + addq $0x98, %rsp retq diff --git a/tests/debug/test-O0.irt b/tests/debug/test-O0.irt index d52c77c..f73733a 100644 --- a/tests/debug/test-O0.irt +++ b/tests/debug/test-O0.irt @@ -53,7 +53,7 @@ Mandelbrot Test (-O0) } --EXPECT-- test: - subq $0x78, %rsp + subq $0x70, %rsp movsd %xmm0, (%rsp) movsd %xmm1, 8(%rsp) movsd 8(%rsp), %xmm0 @@ -67,50 +67,50 @@ test: .L1: movl 0x28(%rsp), %eax addl $1, %eax - movl %eax, 0x30(%rsp) + movl %eax, 0x2c(%rsp) movsd 0x20(%rsp), %xmm0 mulsd 0x18(%rsp), %xmm0 - movsd %xmm0, 0x38(%rsp) + movsd %xmm0, 0x30(%rsp) movsd 0x20(%rsp), %xmm0 mulsd %xmm0, %xmm0 - movsd %xmm0, 0x40(%rsp) + movsd %xmm0, 0x38(%rsp) movsd 0x18(%rsp), %xmm0 mulsd %xmm0, %xmm0 - movsd %xmm0, 0x48(%rsp) - movsd 0x40(%rsp), %xmm0 - subsd 0x48(%rsp), %xmm0 - movsd %xmm0, 0x50(%rsp) - movsd 0x50(%rsp), %xmm0 - addsd 0x10(%rsp), %xmm0 - movsd %xmm0, 0x58(%rsp) + movsd %xmm0, 0x40(%rsp) movsd 0x38(%rsp), %xmm0 - addsd %xmm0, %xmm0 - movsd %xmm0, 0x60(%rsp) - movsd 0x60(%rsp), %xmm0 - addsd (%rsp), %xmm0 - movsd %xmm0, 0x68(%rsp) + subsd 0x40(%rsp), %xmm0 + movsd %xmm0, 0x48(%rsp) movsd 0x48(%rsp), %xmm0 - addsd 0x40(%rsp), %xmm0 - movsd %xmm0, 0x70(%rsp) - movsd 0x70(%rsp), %xmm0 + addsd 0x10(%rsp), %xmm0 + movsd %xmm0, 0x50(%rsp) + movsd 0x30(%rsp), %xmm0 + addsd %xmm0, %xmm0 + movsd %xmm0, 0x58(%rsp) + movsd 0x58(%rsp), %xmm0 + addsd (%rsp), %xmm0 + movsd %xmm0, 0x60(%rsp) + movsd 0x40(%rsp), %xmm0 + addsd 0x38(%rsp), %xmm0 + movsd %xmm0, 0x68(%rsp) + movsd 0x68(%rsp), %xmm0 ucomisd 0x4f(%rip), %xmm0 ja .L2 jmp .L3 .L2: - movl 0x30(%rsp), %eax - addq $0x78, %rsp + movl 0x2c(%rsp), %eax + addq $0x70, %rsp retq .L3: - cmpl $0x3e8, 0x30(%rsp) + cmpl $0x3e8, 0x2c(%rsp) jl .L4 xorl %eax, %eax - addq $0x78, %rsp + addq $0x70, %rsp retq .L4: - movsd 0x68(%rsp), %xmm0 + movsd 0x60(%rsp), %xmm0 movsd %xmm0, 0x18(%rsp) - movsd 0x58(%rsp), %xmm0 + movsd 0x50(%rsp), %xmm0 movsd %xmm0, 0x20(%rsp) - movl 0x30(%rsp), %eax + movl 0x2c(%rsp), %eax movl %eax, 0x28(%rsp) jmp .L1 diff --git a/tests/debug/test_var-O0.irt b/tests/debug/test_var-O0.irt index bdc6bd2..fc28338 100644 --- a/tests/debug/test_var-O0.irt +++ b/tests/debug/test_var-O0.irt @@ -73,11 +73,11 @@ Mandelbrot Test (var) } --EXPECT-- test: - subq $0xa0, %rsp + subq $0x98, %rsp movsd %xmm0, (%rsp) movsd %xmm1, 8(%rsp) movsd 8(%rsp), %xmm0 - subsd 0x168(%rip), %xmm0 + subsd 0x160(%rip), %xmm0 movsd %xmm0, 0x18(%rsp) movsd 0x18(%rsp), %xmm0 movsd %xmm0, 0x10(%rsp) @@ -91,56 +91,56 @@ test: .L1: movl 0x38(%rsp), %eax addl $1, %eax - movl %eax, 0x40(%rsp) - movl 0x40(%rsp), %eax + movl %eax, 0x3c(%rsp) + movl 0x3c(%rsp), %eax movl %eax, 0x38(%rsp) movsd 0x30(%rsp), %xmm0 mulsd 0x28(%rsp), %xmm0 - movsd %xmm0, 0x50(%rsp) - movsd 0x50(%rsp), %xmm0 movsd %xmm0, 0x48(%rsp) + movsd 0x48(%rsp), %xmm0 + movsd %xmm0, 0x40(%rsp) movsd 0x30(%rsp), %xmm0 mulsd %xmm0, %xmm0 - movsd %xmm0, 0x60(%rsp) - movsd 0x60(%rsp), %xmm0 movsd %xmm0, 0x58(%rsp) + movsd 0x58(%rsp), %xmm0 + movsd %xmm0, 0x50(%rsp) movsd 0x28(%rsp), %xmm0 mulsd %xmm0, %xmm0 + movsd %xmm0, 0x68(%rsp) + movsd 0x68(%rsp), %xmm0 + movsd %xmm0, 0x60(%rsp) + movsd 0x50(%rsp), %xmm0 + subsd 0x60(%rsp), %xmm0 movsd %xmm0, 0x70(%rsp) movsd 0x70(%rsp), %xmm0 - movsd %xmm0, 0x68(%rsp) - movsd 0x58(%rsp), %xmm0 - subsd 0x68(%rsp), %xmm0 + addsd 0x10(%rsp), %xmm0 movsd %xmm0, 0x78(%rsp) movsd 0x78(%rsp), %xmm0 - addsd 0x10(%rsp), %xmm0 + movsd %xmm0, 0x30(%rsp) + movsd 0x40(%rsp), %xmm0 + addsd %xmm0, %xmm0 movsd %xmm0, 0x80(%rsp) movsd 0x80(%rsp), %xmm0 - movsd %xmm0, 0x30(%rsp) - movsd 0x48(%rsp), %xmm0 - addsd %xmm0, %xmm0 + addsd 0x20(%rsp), %xmm0 movsd %xmm0, 0x88(%rsp) movsd 0x88(%rsp), %xmm0 - addsd 0x20(%rsp), %xmm0 + movsd %xmm0, 0x28(%rsp) + movsd 0x60(%rsp), %xmm0 + addsd 0x50(%rsp), %xmm0 movsd %xmm0, 0x90(%rsp) movsd 0x90(%rsp), %xmm0 - movsd %xmm0, 0x28(%rsp) - movsd 0x68(%rsp), %xmm0 - addsd 0x58(%rsp), %xmm0 - movsd %xmm0, 0x98(%rsp) - movsd 0x98(%rsp), %xmm0 - ucomisd 0x38(%rip), %xmm0 + ucomisd 0x36(%rip), %xmm0 ja .L2 jmp .L3 .L2: movl 0x38(%rsp), %eax - addq $0xa0, %rsp + addq $0x98, %rsp retq .L3: cmpl $0x3e8, 0x38(%rsp) jl .L4 xorl %eax, %eax - addq $0xa0, %rsp + addq $0x98, %rsp retq .L4: jmp .L1