From patchwork Sat Jul 9 20:13:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 104016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 716EF1007D1 for ; Sun, 10 Jul 2011 06:14:39 +1000 (EST) Received: (qmail 335 invoked by alias); 9 Jul 2011 20:14:33 -0000 Received: (qmail 32762 invoked by uid 22791); 9 Jul 2011 20:14:29 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pw0-f47.google.com (HELO mail-pw0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Jul 2011 20:14:12 +0000 Received: by pwi1 with SMTP id 1so2006858pwi.20 for ; Sat, 09 Jul 2011 13:14:12 -0700 (PDT) Received: by 10.68.16.161 with SMTP id h1mr4985197pbd.113.1310242452095; Sat, 09 Jul 2011 13:14:12 -0700 (PDT) Received: from localhost.localdomain (c-71-227-161-214.hsd1.wa.comcast.net [71.227.161.214]) by mx.google.com with ESMTPS id c5sm2796524pbh.94.2011.07.09.13.14.11 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 09 Jul 2011 13:14:11 -0700 (PDT) From: Richard Henderson To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/6] dwarf2cfi: Simplify re-initialization for each function. Date: Sat, 9 Jul 2011 13:13:59 -0700 Message-Id: <1310242442-26123-4-git-send-email-rth@redhat.com> In-Reply-To: <1310242442-26123-1-git-send-email-rth@redhat.com> References: <1310242442-26123-1-git-send-email-rth@redhat.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org There's no point calling lookup_cfa to re-create the CFA we initialized just a few lines above. --- gcc/dwarf2cfi.c | 45 +++++++++++++-------------------------------- 1 files changed, 13 insertions(+), 32 deletions(-) diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c index ca9b503..b4b035d 100644 --- a/gcc/dwarf2cfi.c +++ b/gcc/dwarf2cfi.c @@ -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 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. */ 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 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 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 @@ -2596,15 +2575,18 @@ execute_dwarf2_frame (void) } /* Set up state for generating call frame debug info. */ - lookup_cfa (&cfa); - gcc_assert (cfa.reg - == (unsigned long)DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM)); + gcc_checking_assert (queued_reg_saves == NULL); + gcc_checking_assert (regs_saved_in_regs == NULL); - old_cfa = cfa; + memset (&cfa, 0, sizeof(cfa)); cfa.reg = STACK_POINTER_REGNUM; + cfa.offset = INCOMING_FRAME_SP_OFFSET; + + old_cfa = 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 (); @@ -2617,7 +2599,6 @@ execute_dwarf2_frame (void) barrier_args_size = NULL; regs_saved_in_regs = NULL; queued_reg_saves = NULL; - args_size = old_args_size = 0; return 0; }