dwarf2cfi: Simplify re-initialization for each function.

There's no point calling lookup_cfa to re-create the CFA
we initialized just a few lines above.

        * dwarf2cfi.c (lookup_cfa): Remove.
        (execute_dwarf2_frame): Assert queues are empty on entry.
        Setup initial cfa directly, not via lookup_cfa.
        Don't clear args_size state here.

From-SVN: r176098
This commit is contained in:
Richard Henderson 2011-07-09 13:30:07 -07:00 committed by Richard Henderson
parent 3edb53aaae
commit 4a8ee12241
2 changed files with 20 additions and 32 deletions

View File

@ -1,3 +1,10 @@
2011-07-09 Richard Henderson <rth@redhat.com>
* dwarf2cfi.c (lookup_cfa): Remove.
(execute_dwarf2_frame): Assert queues are empty on entry.
Setup initial cfa directly, not via lookup_cfa.
Don't clear args_size state here.
2011-07-09 Richard Henderson <rth@redhat.com> 2011-07-09 Richard Henderson <rth@redhat.com>
* dwarf2cfi.c (add_cfi_vec): New. * dwarf2cfi.c (add_cfi_vec): New.

View File

@ -405,7 +405,9 @@ get_cfa_from_loc_descr (dw_cfa_location *cfa, struct dw_loc_descr_struct *loc)
} }
} }
/* Subroutine of lookup_cfa. */ /* Find the previous value for the CFA, iteratively. CFI is the opcode
to interpret, *LOC will be updated as necessary, *REMEMBER is used for
one level of remember/restore state processing. */
void void
lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, dw_cfa_location *remember) lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, dw_cfa_location *remember)
@ -444,29 +446,6 @@ lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, dw_cfa_location *remember)
} }
} }
/* Find the previous value for the CFA. */
static void
lookup_cfa (dw_cfa_location *loc)
{
int ix;
dw_cfi_ref cfi;
dw_fde_ref fde;
dw_cfa_location remember;
memset (loc, 0, sizeof (*loc));
loc->reg = INVALID_REGNUM;
remember = *loc;
FOR_EACH_VEC_ELT (dw_cfi_ref, cie_cfi_vec, ix, cfi)
lookup_cfa_1 (cfi, loc, &remember);
fde = cfun->fde;
if (fde)
FOR_EACH_VEC_ELT (dw_cfi_ref, fde->dw_fde_cfi, ix, cfi)
lookup_cfa_1 (cfi, loc, &remember);
}
/* The current rule for calculating the DWARF2 canonical frame address. */ /* The current rule for calculating the DWARF2 canonical frame address. */
static dw_cfa_location cfa; static dw_cfa_location cfa;
@ -2301,7 +2280,7 @@ dwarf2out_frame_debug (rtx insn, bool after_p)
/* Examine CFI and return true if a cfi label and set_loc is needed /* Examine CFI and return true if a cfi label and set_loc is needed
beforehand. Even when generating CFI assembler instructions, we beforehand. Even when generating CFI assembler instructions, we
still have to add the cfi to the list so that lookup_cfa works still have to add the cfi to the list so that lookup_cfa_1 works
later on. When -g2 and above we even need to force emitting of later on. When -g2 and above we even need to force emitting of
CFI labels and add to list a DW_CFA_set_loc for convert_cfa_to_fb_loc_list CFI labels and add to list a DW_CFA_set_loc for convert_cfa_to_fb_loc_list
purposes. If we're generating DWARF3 output we use DW_OP_call_frame_cfa purposes. If we're generating DWARF3 output we use DW_OP_call_frame_cfa
@ -2596,15 +2575,18 @@ execute_dwarf2_frame (void)
} }
/* Set up state for generating call frame debug info. */ /* Set up state for generating call frame debug info. */
lookup_cfa (&cfa); gcc_checking_assert (queued_reg_saves == NULL);
gcc_assert (cfa.reg gcc_checking_assert (regs_saved_in_regs == NULL);
== (unsigned long)DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM));
memset (&cfa, 0, sizeof(cfa));
cfa.reg = STACK_POINTER_REGNUM;
cfa.offset = INCOMING_FRAME_SP_OFFSET;
old_cfa = cfa; old_cfa = cfa;
cfa.reg = STACK_POINTER_REGNUM;
cfa_store = cfa; cfa_store = cfa;
cfa_temp.reg = -1;
cfa_temp.offset = 0; memset (&cfa_temp, 0, sizeof(cfa_temp));
cfa_temp.reg = INVALID_REGNUM;
dwarf2out_alloc_current_fde (); dwarf2out_alloc_current_fde ();
@ -2617,7 +2599,6 @@ execute_dwarf2_frame (void)
barrier_args_size = NULL; barrier_args_size = NULL;
regs_saved_in_regs = NULL; regs_saved_in_regs = NULL;
queued_reg_saves = NULL; queued_reg_saves = NULL;
args_size = old_args_size = 0;
return 0; return 0;
} }