Commit a518b996 by Richard Henderson Committed by Richard Henderson

dwarf2out: Convert fde_table to a VEC.

Prepare for allocating the FDE for the current function earlier
than dwarf2out_begin_prologue.

        * dwarf2out.c (fde_table, fde_table_allocated, fde_table_in_use,
        FDE_TABLE_INCREMENT): Replace with...
        (fde_vec): ... this, a new vector.
        (current_fde): Remove.  Replace all users with cfun->fde.
        (output_call_frame_info): Use FOR_EACH_VEC_ELT over fde_vec.
        (size_of_aranges, dwarf2out_finish): Likewise.
        (dwarf2out_alloc_current_fde): Break out from ...
        (dwarf2out_begin_prologue): ... here.
        (dwarf2out_frame_init): Remove.
        * dwarf2cfi.c: Update all users of current_fde.
        (dwarf2out_frame_init): Rename from dwarf2cfi_frame_init.
        * dwarf2out.h: Update decls.
        (dw_fde_node): Add fde_index member.
        * function.h (struct function): Add fde member.

From-SVN: r176018
parent 89e25f95
2011-07-07 Richard Henderson <rth@redhat.com>
* dwarf2out.c (fde_table, fde_table_allocated, fde_table_in_use,
FDE_TABLE_INCREMENT): Replace with...
(fde_vec): ... this, a new vector.
(current_fde): Remove. Replace all users with cfun->fde.
(output_call_frame_info): Use FOR_EACH_VEC_ELT over fde_vec.
(size_of_aranges, dwarf2out_finish): Likewise.
(dwarf2out_alloc_current_fde): Break out from ...
(dwarf2out_begin_prologue): ... here.
(dwarf2out_frame_init): Remove.
* dwarf2cfi.c: Update all users of current_fde.
(dwarf2out_frame_init): Rename from dwarf2cfi_frame_init.
* dwarf2out.h: Update decls.
(dw_fde_node): Add fde_index member.
* function.h (struct function): Add fde member.
2011-07-07 Bernd Schmidt <bernds@codesourcery.com> 2011-07-07 Bernd Schmidt <bernds@codesourcery.com>
Richard Henderson <rth@redhat.com> Richard Henderson <rth@redhat.com>
......
...@@ -294,7 +294,7 @@ add_fde_cfi (dw_cfi_ref cfi) ...@@ -294,7 +294,7 @@ add_fde_cfi (dw_cfi_ref cfi)
} }
else else
{ {
dw_fde_ref fde = current_fde (); dw_fde_ref fde = cfun->fde;
VEC_safe_push (dw_cfi_ref, gc, fde->dw_fde_cfi, cfi); VEC_safe_push (dw_cfi_ref, gc, fde->dw_fde_cfi, cfi);
dwarf2out_emit_cfi (cfi); dwarf2out_emit_cfi (cfi);
} }
...@@ -468,7 +468,7 @@ lookup_cfa (dw_cfa_location *loc) ...@@ -468,7 +468,7 @@ lookup_cfa (dw_cfa_location *loc)
FOR_EACH_VEC_ELT (dw_cfi_ref, cie_cfi_vec, ix, cfi) FOR_EACH_VEC_ELT (dw_cfi_ref, cie_cfi_vec, ix, cfi)
lookup_cfa_1 (cfi, loc, &remember); lookup_cfa_1 (cfi, loc, &remember);
fde = current_fde (); fde = cfun->fde;
if (fde) if (fde)
FOR_EACH_VEC_ELT (dw_cfi_ref, fde->dw_fde_cfi, ix, cfi) FOR_EACH_VEC_ELT (dw_cfi_ref, fde->dw_fde_cfi, ix, cfi)
lookup_cfa_1 (cfi, loc, &remember); lookup_cfa_1 (cfi, loc, &remember);
...@@ -599,8 +599,8 @@ static void ...@@ -599,8 +599,8 @@ static void
reg_save (bool for_cie, unsigned int reg, unsigned int sreg, reg_save (bool for_cie, unsigned int reg, unsigned int sreg,
HOST_WIDE_INT offset) HOST_WIDE_INT offset)
{ {
dw_fde_ref fde = for_cie ? NULL : cfun->fde;
dw_cfi_ref cfi = new_cfi (); dw_cfi_ref cfi = new_cfi ();
dw_fde_ref fde = current_fde ();
cfi->dw_cfi_oprnd1.dw_cfi_reg_num = reg; cfi->dw_cfi_oprnd1.dw_cfi_reg_num = reg;
...@@ -1652,7 +1652,7 @@ dwarf2out_frame_debug_cfa_window_save (void) ...@@ -1652,7 +1652,7 @@ dwarf2out_frame_debug_cfa_window_save (void)
Rule 16: Rule 16:
(set sp (and: sp <const_int>)) (set sp (and: sp <const_int>))
constraints: cfa_store.reg == sp constraints: cfa_store.reg == sp
effects: current_fde.stack_realign = 1 effects: cfun->fde.stack_realign = 1
cfa_store.offset = 0 cfa_store.offset = 0
fde->drap_reg = cfa.reg if cfa.reg != sp and cfa.reg != fp fde->drap_reg = cfa.reg if cfa.reg != sp and cfa.reg != fp
...@@ -1742,7 +1742,7 @@ dwarf2out_frame_debug_expr (rtx expr) ...@@ -1742,7 +1742,7 @@ dwarf2out_frame_debug_expr (rtx expr)
src = rsi; src = rsi;
} }
fde = current_fde (); fde = cfun->fde;
switch (GET_CODE (dest)) switch (GET_CODE (dest))
{ {
...@@ -2268,7 +2268,7 @@ dwarf2out_frame_debug (rtx insn, bool after_p) ...@@ -2268,7 +2268,7 @@ dwarf2out_frame_debug (rtx insn, bool after_p)
n = XEXP (note, 0); n = XEXP (note, 0);
if (REG_P (n)) if (REG_P (n))
{ {
dw_fde_ref fde = current_fde (); dw_fde_ref fde = cfun->fde;
if (fde) if (fde)
{ {
gcc_assert (fde->vdrap_reg == INVALID_REGNUM); gcc_assert (fde->vdrap_reg == INVALID_REGNUM);
...@@ -2387,7 +2387,7 @@ cfi_label_required_p (dw_cfi_ref cfi) ...@@ -2387,7 +2387,7 @@ cfi_label_required_p (dw_cfi_ref cfi)
static void static void
add_cfis_to_fde (void) add_cfis_to_fde (void)
{ {
dw_fde_ref fde = current_fde (); dw_fde_ref fde = cfun->fde;
rtx insn, next; rtx insn, next;
/* We always start with a function_begin label. */ /* We always start with a function_begin label. */
bool first = false; bool first = false;
...@@ -2611,7 +2611,7 @@ dwarf2cfi_function_init (void) ...@@ -2611,7 +2611,7 @@ dwarf2cfi_function_init (void)
/* Run once. */ /* Run once. */
void void
dwarf2cfi_frame_init (void) dwarf2out_frame_init (void)
{ {
dw_cfa_location loc; dw_cfa_location loc;
......
...@@ -88,7 +88,10 @@ typedef struct GTY(()) dw_fde_struct { ...@@ -88,7 +88,10 @@ typedef struct GTY(()) dw_fde_struct {
cfi_vec dw_fde_cfi; cfi_vec dw_fde_cfi;
int dw_fde_switch_cfi_index; /* Last CFI before switching sections. */ int dw_fde_switch_cfi_index; /* Last CFI before switching sections. */
HOST_WIDE_INT stack_realignment; HOST_WIDE_INT stack_realignment;
unsigned funcdef_number; unsigned funcdef_number;
unsigned fde_index;
/* Dynamic realign argument pointer register. */ /* Dynamic realign argument pointer register. */
unsigned int drap_reg; unsigned int drap_reg;
/* Virtual dynamic realign argument pointer register. */ /* Virtual dynamic realign argument pointer register. */
...@@ -215,7 +218,6 @@ dw_loc_descr_node; ...@@ -215,7 +218,6 @@ dw_loc_descr_node;
/* Interface from dwarf2out.c to dwarf2cfi.c. */ /* Interface from dwarf2out.c to dwarf2cfi.c. */
extern dw_fde_ref current_fde (void);
extern struct dw_loc_descr_struct *build_cfa_loc extern struct dw_loc_descr_struct *build_cfa_loc
(dw_cfa_location *, HOST_WIDE_INT); (dw_cfa_location *, HOST_WIDE_INT);
extern struct dw_loc_descr_struct *build_cfa_aligned_loc extern struct dw_loc_descr_struct *build_cfa_aligned_loc
...@@ -224,9 +226,9 @@ extern struct dw_loc_descr_struct *mem_loc_descriptor ...@@ -224,9 +226,9 @@ extern struct dw_loc_descr_struct *mem_loc_descriptor
(rtx, enum machine_mode mode, enum machine_mode mem_mode, (rtx, enum machine_mode mode, enum machine_mode mem_mode,
enum var_init_status); enum var_init_status);
extern enum machine_mode get_address_mode (rtx mem); extern enum machine_mode get_address_mode (rtx mem);
extern dw_fde_ref dwarf2out_alloc_current_fde (void);
/* Interface from dwarf2cfi.c to dwarf2out.c. */ /* Interface from dwarf2cfi.c to dwarf2out.c. */
extern void dwarf2cfi_frame_init (void);
extern void dwarf2cfi_function_init (void); extern void dwarf2cfi_function_init (void);
extern void lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, extern void lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc,
dw_cfa_location *remember); dw_cfa_location *remember);
......
...@@ -169,6 +169,7 @@ struct gimple_df; ...@@ -169,6 +169,7 @@ struct gimple_df;
struct temp_slot; struct temp_slot;
typedef struct temp_slot *temp_slot_p; typedef struct temp_slot *temp_slot_p;
struct call_site_record_d; struct call_site_record_d;
struct dw_fde_struct;
DEF_VEC_P(temp_slot_p); DEF_VEC_P(temp_slot_p);
DEF_VEC_ALLOC_P(temp_slot_p,gc); DEF_VEC_ALLOC_P(temp_slot_p,gc);
...@@ -542,6 +543,11 @@ struct GTY(()) function { ...@@ -542,6 +543,11 @@ struct GTY(()) function {
/* Used types hash table. */ /* Used types hash table. */
htab_t GTY ((param_is (union tree_node))) used_types_hash; htab_t GTY ((param_is (union tree_node))) used_types_hash;
/* Dwarf2 Frame Description Entry, containing the Call Frame Instructions
used for unwinding. Only set when either dwarf2 unwinding or dwarf2
debugging is enabled. */
struct dw_fde_struct *fde;
/* Last statement uid. */ /* Last statement uid. */
int last_stmt_uid; int last_stmt_uid;
......
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