Commit 30e6f306 by Richard Henderson Committed by Richard Henderson

function.c (ARG_POINTER_CFA_OFFSET): Move ...

        * function.c (ARG_POINTER_CFA_OFFSET): Move ...
        * defaults.h (ARG_POINTER_CFA_OFFSET): ... here.
        (INCOMING_FRAME_SP_OFFSET): Move from dwarf2out.c.
        * dwarf2out.c (struct cfa_loc): Change reg to unsigned int,
        rearrange for better packing.
        (INCOMING_FRAME_SP_OFFSET): Move to defaults.h.
        (lookup_cfa_1): Remove inline marker.
        (cfa_equal_p): Split out of ...
        (def_cfa_1): ... here.  Use INVALID_REGNUM.
        (build_cfa_loc): Handle !cfa->indirect.
        (frame_pointer_cfa_offset): New.
        (dbx_reg_number): Assert register elimination performed; do
        leaf register remapping.
        (reg_loc_descriptor): Avoid calling dbx_reg_number when unused.
        (eliminate_reg_to_offset): New.
        (based_loc_descr): Remove can_use_fbreg argument.  Use fbreg only
        for verifiably local stack frame addresses; re-base to CFA.
        (mem_loc_descriptor): Remove can_use_fbreg argument.
        (concat_loc_descriptor, loc_descriptor): Likewise.
        (containing_function_has_frame_base): Remove.
        (rtl_for_decl_location): Don't do register elimination or
        leaf register remapping here.
        (secname_for_decl): Split out from ..
        (add_location_or_const_value_attribute): ... here.
        (convert_cfa_to_loc_list): New.
        (compute_frame_pointer_to_cfa_displacement): New.
        (gen_subprogram_die): Use them.
        * tree.h (frame_base_decl): Remove.
        * var-tracking.c (frame_base_decl, frame_stack_adjust): Remove.
        (prologue_stack_adjust): Remove.
        (vt_stack_adjustments): Use INCOMING_FRAME_SP_OFFSET.
        (adjust_stack_reference): Re-base memories to arg_pointer_rtx.
        (set_frame_base_location): Remove.
        (compute_bb_dataflow, emit_notes_in_bb): Don't call it.
        (dump_attrs_list, dump_dataflow_set): Use string concatenation.
        (vt_add_function_parameters): Don't eliminate_regs.
        (vt_initialize): Don't create frame_base_decl.

From-SVN: r103983
parent d1d26ecf
2005-09-07 Richard Henderson <rth@redhat.com>
* function.c (ARG_POINTER_CFA_OFFSET): Move ...
* defaults.h (ARG_POINTER_CFA_OFFSET): ... here.
(INCOMING_FRAME_SP_OFFSET): Move from dwarf2out.c.
* dwarf2out.c (struct cfa_loc): Change reg to unsigned int,
rearrange for better packing.
(INCOMING_FRAME_SP_OFFSET): Move to defaults.h.
(lookup_cfa_1): Remove inline marker.
(cfa_equal_p): Split out of ...
(def_cfa_1): ... here. Use INVALID_REGNUM.
(build_cfa_loc): Handle !cfa->indirect.
(frame_pointer_cfa_offset): New.
(dbx_reg_number): Assert register elimination performed; do
leaf register remapping.
(reg_loc_descriptor): Avoid calling dbx_reg_number when unused.
(eliminate_reg_to_offset): New.
(based_loc_descr): Remove can_use_fbreg argument. Use fbreg only
for verifiably local stack frame addresses; re-base to CFA.
(mem_loc_descriptor): Remove can_use_fbreg argument.
(concat_loc_descriptor, loc_descriptor): Likewise.
(containing_function_has_frame_base): Remove.
(rtl_for_decl_location): Don't do register elimination or
leaf register remapping here.
(secname_for_decl): Split out from ..
(add_location_or_const_value_attribute): ... here.
(convert_cfa_to_loc_list): New.
(compute_frame_pointer_to_cfa_displacement): New.
(gen_subprogram_die): Use them.
* tree.h (frame_base_decl): Remove.
* var-tracking.c (frame_base_decl, frame_stack_adjust): Remove.
(prologue_stack_adjust): Remove.
(vt_stack_adjustments): Use INCOMING_FRAME_SP_OFFSET.
(adjust_stack_reference): Re-base memories to arg_pointer_rtx.
(set_frame_base_location): Remove.
(compute_bb_dataflow, emit_notes_in_bb): Don't call it.
(dump_attrs_list, dump_dataflow_set): Use string concatenation.
(vt_add_function_parameters): Don't eliminate_regs.
(vt_initialize): Don't create frame_base_decl.
2005-09-07 Eric Botcazou <ebotcazou@libertysurf.fr> 2005-09-07 Eric Botcazou <ebotcazou@libertysurf.fr>
* doc/install.texi (*-*-solaris2*): Clarify wording on the recommended * doc/install.texi (*-*-solaris2*): Clarify wording on the recommended
......
...@@ -835,4 +835,15 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -835,4 +835,15 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#define FRAME_GROWS_DOWNWARD 0 #define FRAME_GROWS_DOWNWARD 0
#endif #endif
/* On most machines, the CFA coincides with the first incoming parm. */
#ifndef ARG_POINTER_CFA_OFFSET
#define ARG_POINTER_CFA_OFFSET(FNDECL) FIRST_PARM_OFFSET (FNDECL)
#endif
/* The offset from the incoming value of %sp to the top of the stack frame
for the current function. */
#ifndef INCOMING_FRAME_SP_OFFSET
#define INCOMING_FRAME_SP_OFFSET 0
#endif
#endif /* ! GCC_DEFAULTS_H */ #endif /* ! GCC_DEFAULTS_H */
...@@ -1211,12 +1211,6 @@ static int cfa_offset; ...@@ -1211,12 +1211,6 @@ static int cfa_offset;
#endif #endif
#endif #endif
/* On most machines, the CFA coincides with the first incoming parm. */
#ifndef ARG_POINTER_CFA_OFFSET
#define ARG_POINTER_CFA_OFFSET(FNDECL) FIRST_PARM_OFFSET (FNDECL)
#endif
/* Given a piece of RTX and a pointer to a HOST_WIDE_INT, if the RTX /* Given a piece of RTX and a pointer to a HOST_WIDE_INT, if the RTX
is a virtual register, return the equivalent hard register and set the is a virtual register, return the equivalent hard register and set the
......
...@@ -3036,7 +3036,6 @@ enum ptrmemfunc_vbit_where_t ...@@ -3036,7 +3036,6 @@ enum ptrmemfunc_vbit_where_t
#define NULL_TREE (tree) NULL #define NULL_TREE (tree) NULL
extern GTY(()) tree frame_base_decl;
extern tree decl_assembler_name (tree); extern tree decl_assembler_name (tree);
/* Compute the number of bytes occupied by 'node'. This routine only /* Compute the number of bytes occupied by 'node'. This routine only
......
...@@ -268,19 +268,12 @@ static htab_t changed_variables; ...@@ -268,19 +268,12 @@ static htab_t changed_variables;
/* Shall notes be emitted? */ /* Shall notes be emitted? */
static bool emit_notes; static bool emit_notes;
/* 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. */ /* Local function prototypes. */
static void stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *, static void stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *,
HOST_WIDE_INT *); HOST_WIDE_INT *);
static void insn_stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *, static void insn_stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *,
HOST_WIDE_INT *); HOST_WIDE_INT *);
static void bb_stack_adjust_offset (basic_block); static void bb_stack_adjust_offset (basic_block);
static HOST_WIDE_INT prologue_stack_adjust (void);
static bool vt_stack_adjustments (void); static bool vt_stack_adjustments (void);
static rtx adjust_stack_reference (rtx, HOST_WIDE_INT); static rtx adjust_stack_reference (rtx, HOST_WIDE_INT);
static hashval_t variable_htab_hash (const void *); static hashval_t variable_htab_hash (const void *);
...@@ -335,7 +328,6 @@ static void dump_dataflow_set (dataflow_set *); ...@@ -335,7 +328,6 @@ static void dump_dataflow_set (dataflow_set *);
static void dump_dataflow_sets (void); static void dump_dataflow_sets (void);
static void variable_was_changed (variable, htab_t); static void variable_was_changed (variable, htab_t);
static void set_frame_base_location (dataflow_set *, rtx);
static void set_variable_part (dataflow_set *, rtx, tree, HOST_WIDE_INT); static void set_variable_part (dataflow_set *, rtx, tree, HOST_WIDE_INT);
static void delete_variable_part (dataflow_set *, rtx, tree, HOST_WIDE_INT); static void delete_variable_part (dataflow_set *, rtx, tree, HOST_WIDE_INT);
static int emit_note_insn_var_location (void **, void *); static int emit_note_insn_var_location (void **, void *);
...@@ -491,38 +483,6 @@ bb_stack_adjust_offset (basic_block bb) ...@@ -491,38 +483,6 @@ bb_stack_adjust_offset (basic_block bb)
VTI (bb)->out.stack_adjust = offset; VTI (bb)->out.stack_adjust = offset;
} }
/* Compute stack adjustment caused by function prologue. */
static HOST_WIDE_INT
prologue_stack_adjust (void)
{
HOST_WIDE_INT offset = 0;
basic_block bb = ENTRY_BLOCK_PTR->next_bb;
rtx insn;
rtx end;
if (!BB_END (bb))
return 0;
end = NEXT_INSN (BB_END (bb));
for (insn = BB_HEAD (bb); insn != end; insn = NEXT_INSN (insn))
{
if (NOTE_P (insn)
&& NOTE_LINE_NUMBER (insn) == NOTE_INSN_PROLOGUE_END)
break;
if (INSN_P (insn))
{
HOST_WIDE_INT tmp;
insn_stack_adjust_offset_pre_post (insn, &tmp, &tmp);
offset += tmp;
}
}
return offset;
}
/* Compute stack adjustments for all blocks by traversing DFS tree. /* Compute stack adjustments for all blocks by traversing DFS tree.
Return true when the adjustments on all incoming edges are consistent. Return true when the adjustments on all incoming edges are consistent.
Heavily borrowed from flow_depth_first_order_compute. */ Heavily borrowed from flow_depth_first_order_compute. */
...@@ -535,7 +495,7 @@ vt_stack_adjustments (void) ...@@ -535,7 +495,7 @@ vt_stack_adjustments (void)
/* Initialize entry block. */ /* Initialize entry block. */
VTI (ENTRY_BLOCK_PTR)->visited = true; VTI (ENTRY_BLOCK_PTR)->visited = true;
VTI (ENTRY_BLOCK_PTR)->out.stack_adjust = frame_stack_adjust; VTI (ENTRY_BLOCK_PTR)->out.stack_adjust = INCOMING_FRAME_SP_OFFSET;
/* Allocate stack for back-tracking up CFG. */ /* Allocate stack for back-tracking up CFG. */
stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge_iterator)); stack = xmalloc ((n_basic_blocks + 1) * sizeof (edge_iterator));
...@@ -589,27 +549,23 @@ vt_stack_adjustments (void) ...@@ -589,27 +549,23 @@ vt_stack_adjustments (void)
return true; return true;
} }
/* Adjust stack reference MEM by ADJUSTMENT bytes and return the new rtx. */ /* Adjust stack reference MEM by ADJUSTMENT bytes and make it relative
to the argument pointer. Return the new rtx. */
static rtx static rtx
adjust_stack_reference (rtx mem, HOST_WIDE_INT adjustment) adjust_stack_reference (rtx mem, HOST_WIDE_INT adjustment)
{ {
rtx adjusted_mem; rtx addr, cfa, tmp;
rtx tmp;
if (adjustment == 0) adjustment -= ARG_POINTER_CFA_OFFSET (current_function_decl);
return mem; cfa = plus_constant (arg_pointer_rtx, adjustment);
adjusted_mem = copy_rtx (mem); addr = replace_rtx (copy_rtx (XEXP (mem, 0)), stack_pointer_rtx, cfa);
XEXP (adjusted_mem, 0) = replace_rtx (XEXP (adjusted_mem, 0), tmp = simplify_rtx (addr);
stack_pointer_rtx,
gen_rtx_PLUS (Pmode, stack_pointer_rtx,
GEN_INT (adjustment)));
tmp = simplify_rtx (XEXP (adjusted_mem, 0));
if (tmp) if (tmp)
XEXP (adjusted_mem, 0) = tmp; addr = tmp;
return adjusted_mem; return replace_equiv_address_nv (mem, addr);
} }
/* The hash function for variable_htab, computes the hash value /* The hash function for variable_htab, computes the hash value
...@@ -1652,14 +1608,7 @@ compute_bb_dataflow (basic_block bb) ...@@ -1652,14 +1608,7 @@ compute_bb_dataflow (basic_block bb)
break; break;
case MO_ADJUST: case MO_ADJUST:
{ out->stack_adjust += VTI (bb)->mos[i].u.adjust;
rtx base;
out->stack_adjust += VTI (bb)->mos[i].u.adjust;
base = gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx,
out->stack_adjust));
set_frame_base_location (out, base);
}
break; break;
} }
} }
...@@ -1782,8 +1731,7 @@ dump_attrs_list (attrs list) ...@@ -1782,8 +1731,7 @@ dump_attrs_list (attrs list)
for (; list; list = list->next) for (; list; list = list->next)
{ {
print_mem_expr (dump_file, list->decl); print_mem_expr (dump_file, list->decl);
fprintf (dump_file, "+"); fprintf (dump_file, "+" HOST_WIDE_INT_PRINT_DEC, list->offset);
fprintf (dump_file, HOST_WIDE_INT_PRINT_DEC, list->offset);
} }
fprintf (dump_file, "\n"); fprintf (dump_file, "\n");
} }
...@@ -1833,9 +1781,8 @@ dump_dataflow_set (dataflow_set *set) ...@@ -1833,9 +1781,8 @@ dump_dataflow_set (dataflow_set *set)
{ {
int i; int i;
fprintf (dump_file, "Stack adjustment: "); fprintf (dump_file, "Stack adjustment: " HOST_WIDE_INT_PRINT_DEC "\n",
fprintf (dump_file, HOST_WIDE_INT_PRINT_DEC, set->stack_adjust); set->stack_adjust);
fprintf (dump_file, "\n");
for (i = 1; i < FIRST_PSEUDO_REGISTER; i++) for (i = 1; i < FIRST_PSEUDO_REGISTER; i++)
{ {
if (set->regs[i]) if (set->regs[i])
...@@ -1914,31 +1861,6 @@ variable_was_changed (variable var, htab_t htab) ...@@ -1914,31 +1861,6 @@ variable_was_changed (variable var, htab_t htab)
} }
} }
/* 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. */
static void
set_frame_base_location (dataflow_set *set, rtx loc)
{
variable var;
var = htab_find_with_hash (set->vars, frame_base_decl,
VARIABLE_HASH_VAL (frame_base_decl));
gcc_assert (var);
gcc_assert (var->n_var_parts == 1);
gcc_assert (!var->var_part[0].offset);
gcc_assert (var->var_part[0].loc_chain);
/* If frame_base_decl is shared unshare it first. */
if (var->refcount > 1)
var = unshare_variable (set, var);
var->var_part[0].loc_chain->loc = loc;
var->var_part[0].cur_loc = loc;
variable_was_changed (var, set->vars);
}
/* Set the part of variable's location in the dataflow set SET. The variable /* Set the part of variable's location in the dataflow set SET. The variable
part is specified by variable's declaration DECL and offset OFFSET and the part is specified by variable's declaration DECL and offset OFFSET and the
part's location by LOC. */ part's location by LOC. */
...@@ -2463,15 +2385,7 @@ emit_notes_in_bb (basic_block bb) ...@@ -2463,15 +2385,7 @@ emit_notes_in_bb (basic_block bb)
break; break;
case MO_ADJUST: case MO_ADJUST:
{ set.stack_adjust += VTI (bb)->mos[i].u.adjust;
rtx base;
set.stack_adjust += VTI (bb)->mos[i].u.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);
}
break; break;
} }
} }
...@@ -2575,7 +2489,6 @@ vt_add_function_parameters (void) ...@@ -2575,7 +2489,6 @@ vt_add_function_parameters (void)
gcc_assert (parm == decl); gcc_assert (parm == decl);
incoming = eliminate_regs (incoming, 0, NULL_RTX);
out = &VTI (ENTRY_BLOCK_PTR)->out; out = &VTI (ENTRY_BLOCK_PTR)->out;
if (REG_P (incoming)) if (REG_P (incoming))
...@@ -2586,9 +2499,7 @@ vt_add_function_parameters (void) ...@@ -2586,9 +2499,7 @@ vt_add_function_parameters (void)
set_variable_part (out, incoming, parm, offset); set_variable_part (out, incoming, parm, offset);
} }
else if (MEM_P (incoming)) else if (MEM_P (incoming))
{ set_variable_part (out, incoming, parm, offset);
set_variable_part (out, incoming, parm, offset);
}
} }
} }
...@@ -2733,28 +2644,6 @@ vt_initialize (void) ...@@ -2733,28 +2644,6 @@ vt_initialize (void)
changed_variables = htab_create (10, variable_htab_hash, variable_htab_eq, changed_variables = htab_create (10, variable_htab_hash, variable_htab_eq,
NULL); NULL);
vt_add_function_parameters (); vt_add_function_parameters ();
if (!frame_pointer_needed)
{
rtx base;
/* Create fake variable for tracking stack pointer changes. */
frame_base_decl = make_node (VAR_DECL);
DECL_NAME (frame_base_decl) = get_identifier ("___frame_base_decl");
TREE_TYPE (frame_base_decl) = char_type_node;
DECL_ARTIFICIAL (frame_base_decl) = 1;
DECL_IGNORED_P (frame_base_decl) = 1;
/* Set its initial "location". */
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
{
frame_base_decl = NULL;
}
} }
/* Free the data structures needed for variable tracking. */ /* Free the data structures needed for variable tracking. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment