summaryrefslogtreecommitdiff
path: root/gcc/combine-stack-adj.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-02 22:18:35 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-02 22:18:35 +0000
commitdfe00a8f1c5b0999d2beb7a2d59c27ceeb94faa9 (patch)
tree3dd838d8e7cbbe356e3db0a0c2bcb80fcfbb4daf /gcc/combine-stack-adj.c
parenteadd7e6b87e44077a0642519602a7c4d2dce3df6 (diff)
downloadgcc-dfe00a8f1c5b0999d2beb7a2d59c27ceeb94faa9.tar.gz
PR target/49864
* reg-notes.def (REG_ARGS_SIZE): New. * calls.c (emit_call_1): Emit REG_ARGS_SIZE for call_pop. (expand_call): Add REG_ARGS_SIZE to emit_stack_restore. * cfgcleanup.c (old_insns_match_p): Don't allow cross-jumping to different stack levels. * combine-stack-adj.c (adjust_frame_related_expr): Remove. (maybe_move_args_size_note): New. (combine_stack_adjustments_for_block): Use it. * combine.c (distribute_notes): Place REG_ARGS_SIZE. * dwarf2cfi.c (dw_cfi_row_struct): Remove args_size member. (dw_trace_info): Add beg_true_args_size, end_true_args_size, beg_delay_args_size, end_delay_args_size, eh_head, args_size_undefined. (cur_cfa): New. (queued_args_size): Remove. (add_cfi_args_size): Assert size is non-negative. (stack_adjust_offset, dwarf2out_args_size): Remove. (dwarf2out_stack_adjust, dwarf2out_notice_stack_adjust): Remove. (notice_args_size, notice_eh_throw): New. (dwarf2out_frame_debug_def_cfa): Use cur_cfa. (dwarf2out_frame_debug_adjust_cfa): Likewise. (dwarf2out_frame_debug_cfa_offset): Likewise. (dwarf2out_frame_debug_expr): Likewise. Don't stack_adjust_offset. (dwarf2out_frame_debug): Don't handle non-frame-related-p insns. (change_cfi_row): Don't emit args_size. (maybe_record_trace_start_abnormal): Split out from ... (maybe_record_trace_start): Here. Set args_size_undefined. (create_trace_edges): Update to match. (scan_trace): Handle REG_ARGS_SIZE. (connect_traces): Connect args_size between EH insns. * emit-rtl.c (try_split): Handle REG_ARGS_SIZE. * explow.c (suppress_reg_args_size): New. (adjust_stack_1): Split out from ... (adjust_stack): ... here. (anti_adjust_stack): Use it. (allocate_dynamic_stack_space): Suppress REG_ARGS_SIZE. * expr.c (mem_autoinc_base): New. (fixup_args_size_notes): New. (emit_single_push_insn_1): Rename from emit_single_push_insn. (emit_single_push_insn): New. Generate REG_ARGS_SIZE. * recog.c (peep2_attempt): Handle REG_ARGS_SIZE. * reload1.c (reload_as_needed): Likewise. * rtl.h (fixup_args_size_notes): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177218 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/combine-stack-adj.c')
-rw-r--r--gcc/combine-stack-adj.c69
1 files changed, 11 insertions, 58 deletions
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index d267b701f1f..bca078442f7 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -296,68 +296,22 @@ record_stack_refs (rtx *xp, void *data)
return 0;
}
-/* Adjust or create REG_FRAME_RELATED_EXPR note when merging a stack
- adjustment into a frame related insn. */
+/* If INSN has a REG_ARGS_SIZE note, move it to LAST. */
static void
-adjust_frame_related_expr (rtx last_sp_set, rtx insn,
- HOST_WIDE_INT this_adjust)
+maybe_move_args_size_note (rtx last, rtx insn)
{
- rtx note = find_reg_note (last_sp_set, REG_FRAME_RELATED_EXPR, NULL_RTX);
- rtx new_expr = NULL_RTX;
+ rtx note, last_note;
- if (note == NULL_RTX && RTX_FRAME_RELATED_P (insn))
+ note = find_reg_note (insn, REG_ARGS_SIZE, NULL_RTX);
+ if (note == NULL)
return;
- if (note
- && GET_CODE (XEXP (note, 0)) == SEQUENCE
- && XVECLEN (XEXP (note, 0), 0) >= 2)
- {
- rtx expr = XEXP (note, 0);
- rtx last = XVECEXP (expr, 0, XVECLEN (expr, 0) - 1);
- int i;
-
- if (GET_CODE (last) == SET
- && RTX_FRAME_RELATED_P (last) == RTX_FRAME_RELATED_P (insn)
- && SET_DEST (last) == stack_pointer_rtx
- && GET_CODE (SET_SRC (last)) == PLUS
- && XEXP (SET_SRC (last), 0) == stack_pointer_rtx
- && CONST_INT_P (XEXP (SET_SRC (last), 1)))
- {
- XEXP (SET_SRC (last), 1)
- = GEN_INT (INTVAL (XEXP (SET_SRC (last), 1)) + this_adjust);
- return;
- }
-
- new_expr = gen_rtx_SEQUENCE (VOIDmode,
- rtvec_alloc (XVECLEN (expr, 0) + 1));
- for (i = 0; i < XVECLEN (expr, 0); i++)
- XVECEXP (new_expr, 0, i) = XVECEXP (expr, 0, i);
- }
- else
- {
- new_expr = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2));
- if (note)
- XVECEXP (new_expr, 0, 0) = XEXP (note, 0);
- else
- {
- rtx expr = copy_rtx (single_set_for_csa (last_sp_set));
-
- XEXP (SET_SRC (expr), 1)
- = GEN_INT (INTVAL (XEXP (SET_SRC (expr), 1)) - this_adjust);
- RTX_FRAME_RELATED_P (expr) = 1;
- XVECEXP (new_expr, 0, 0) = expr;
- }
- }
-
- XVECEXP (new_expr, 0, XVECLEN (new_expr, 0) - 1)
- = copy_rtx (single_set_for_csa (insn));
- RTX_FRAME_RELATED_P (XVECEXP (new_expr, 0, XVECLEN (new_expr, 0) - 1))
- = RTX_FRAME_RELATED_P (insn);
- if (note)
- XEXP (note, 0) = new_expr;
+ last_note = find_reg_note (last, REG_ARGS_SIZE, NULL_RTX);
+ if (last_note)
+ XEXP (last_note, 0) = XEXP (note, 0);
else
- add_reg_note (last_sp_set, REG_FRAME_RELATED_EXPR, new_expr);
+ add_reg_note (last, REG_ARGS_SIZE, XEXP (note, 0));
}
/* Subroutine of combine_stack_adjustments, called for each basic block. */
@@ -431,9 +385,8 @@ combine_stack_adjustments_for_block (basic_block bb)
last_sp_adjust + this_adjust,
this_adjust))
{
- if (RTX_FRAME_RELATED_P (last_sp_set))
- adjust_frame_related_expr (last_sp_set, insn,
- this_adjust);
+ maybe_move_args_size_note (last_sp_set, insn);
+
/* It worked! */
delete_insn (insn);
last_sp_adjust += this_adjust;