+2004-07-05 Josef Zlomek <zlomekj@suse.cz>
+
+ * var-tracking.c: Fix some comments.
+ (frame_stack_adjust): New.
+ (vt_stack_adjustments): Init stack_adjust of entry block to
+ minus stack adjustment of function prologue.
+ (adjust_stack_reference): Do not adjust if adjustment == 0.
+ (compute_bb_dataflow): Use plus_constant instead of gen_rtx_PLUS.
+ (emit_notes_in_bb): Likewise.
+ (vt_add_function_parameters): Do not adjust locations of
+ function arguments.
+ (vt_initialize): Compute the stack adjustment of function
+ prologue and offset the initial "location" of frame_base_decl
+ from the stack pointer after prologue.
+
2004-07-04 Richard Henderson <rth@redhat.com>
* function.c (struct assign_parm_data_all): New.
/* Fake variable for stack pointer. */
tree frame_base_decl;
+/* Stack adjust caused by function prologue. */
+static HOST_WIDE_INT frame_stack_adjust;
+
/* Local function prototypes. */
static void stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *,
HOST_WIDE_INT *);
VTI (bb)->out.stack_adjust = offset;
}
-/* Compute stack adjustment caused by function prolog. */
+/* Compute stack adjustment caused by function prologue. */
static HOST_WIDE_INT
prologue_stack_adjust (void)
/* Initialize entry block. */
VTI (ENTRY_BLOCK_PTR)->visited = true;
- VTI (ENTRY_BLOCK_PTR)->out.stack_adjust = 0;
+ VTI (ENTRY_BLOCK_PTR)->out.stack_adjust = frame_stack_adjust;
/* Allocate stack for back-tracking up CFG. */
stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge));
rtx adjusted_mem;
rtx tmp;
+ if (adjustment == 0)
+ return mem;
+
adjusted_mem = copy_rtx (mem);
XEXP (adjusted_mem, 0) = replace_rtx (XEXP (adjusted_mem, 0),
stack_pointer_rtx,
rtx base;
out->stack_adjust += VTI (bb)->mos[i].u.adjust;
- base = gen_rtx_MEM (Pmode,
- gen_rtx_PLUS (Pmode, stack_pointer_rtx,
- GEN_INT (out->stack_adjust)));
+ base = gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx,
+ out->stack_adjust));
set_frame_base_location (out, base);
}
break;
}
/* Set the location of frame_base_decl to LOC in dataflow set SET. This
- function expects that
- frame_base_decl has already one location for offset 0 in the variable table.
- */
+ function expects that frame_base_decl has already one location for offset 0
+ in the variable table. */
static void
set_frame_base_location (dataflow_set *set, rtx loc)
rtx base;
set.stack_adjust += VTI (bb)->mos[i].u.adjust;
- base = gen_rtx_MEM (Pmode,
- gen_rtx_PLUS (Pmode, stack_pointer_rtx,
- GEN_INT (set.stack_adjust)));
+ base = gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx,
+ set.stack_adjust));
set_frame_base_location (&set, base);
emit_notes_for_changes (insn, EMIT_NOTE_AFTER_INSN);
}
vt_add_function_parameters (void)
{
tree parm;
- HOST_WIDE_INT stack_adjust = 0;
- if (!frame_pointer_needed)
- stack_adjust = prologue_stack_adjust ();
-
for (parm = DECL_ARGUMENTS (current_function_decl);
parm; parm = TREE_CHAIN (parm))
{
#endif
incoming = eliminate_regs (incoming, 0, NULL_RTX);
- if (!frame_pointer_needed && MEM_P (incoming))
- incoming = adjust_stack_reference (incoming, -stack_adjust);
out = &VTI (ENTRY_BLOCK_PTR)->out;
if (REG_P (incoming))
DECL_ARTIFICIAL (frame_base_decl) = 1;
/* Set its initial "location". */
- base = gen_rtx_MEM (Pmode, stack_pointer_rtx);
+ frame_stack_adjust = -prologue_stack_adjust ();
+ base = gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx,
+ frame_stack_adjust));
set_variable_part (&VTI (ENTRY_BLOCK_PTR)->out, base, frame_base_decl, 0);
}
else