From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2796 invoked by alias); 29 Jun 2011 21:54:57 -0000 Received: (qmail 2788 invoked by uid 22791); 29 Jun 2011 21:54:56 -0000 X-SWARE-Spam-Status: No, hits=-2.3 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-vw0-f47.google.com (HELO mail-vw0-f47.google.com) (209.85.212.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Jun 2011 21:54:40 +0000 Received: by vws2 with SMTP id 2so1418881vws.20 for ; Wed, 29 Jun 2011 14:54:39 -0700 (PDT) Received: by 10.52.89.134 with SMTP id bo6mr1905240vdb.181.1309384205680; Wed, 29 Jun 2011 14:50:05 -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 l31sm898998vbr.11.2011.06.29.14.50.04 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 29 Jun 2011 14:50:05 -0700 (PDT) From: Richard Henderson To: gcc-patches@gcc.gnu.org Cc: richard.earnshaw@arm.com, sje@cup.hp.com, ubizjak@gmail.com, matt@3am-software.com Subject: [PATCH 03/12] dwarf2out: Add REG_CFA_FLUSH_QUEUE. Date: Wed, 29 Jun 2011 22:33:00 -0000 Message-Id: <1309384152-25027-4-git-send-email-rth@redhat.com> In-Reply-To: <1309384152-25027-1-git-send-email-rth@redhat.com> References: <1309384152-25027-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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg02303.txt.bz2 --- gcc/dwarf2out.c | 37 +++++++++++++++++++++++++------------ gcc/final.c | 4 +++- gcc/reg-notes.def | 11 +++++++++-- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 6fad7e9..9cccc04 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -2832,6 +2832,7 @@ dwarf2out_frame_debug (rtx insn, bool after_p) const char *label; rtx note, n; bool handled_one = false; + bool need_flush = false; if (!NONJUMP_INSN_P (insn) || clobbers_queued_reg_save (insn)) dwarf2out_flush_queued_reg_saves (); @@ -2854,7 +2855,7 @@ dwarf2out_frame_debug (rtx insn, bool after_p) { case REG_FRAME_RELATED_EXPR: insn = XEXP (note, 0); - goto found; + goto do_frame_expr; case REG_CFA_DEF_CFA: dwarf2out_frame_debug_def_cfa (XEXP (note, 0), label); @@ -2934,24 +2935,36 @@ dwarf2out_frame_debug (rtx insn, bool after_p) handled_one = true; break; + case REG_CFA_FLUSH_QUEUE: + /* The actual flush happens below. */ + need_flush = true; + handled_one = true; + break; + default: break; } + if (handled_one) { - if (any_cfis_emitted) - dwarf2out_flush_queued_reg_saves (); - return; + /* Minimize the number of advances by emitting the entire queue + once anything is emitted. */ + need_flush |= any_cfis_emitted; } + else + { + insn = PATTERN (insn); + do_frame_expr: + dwarf2out_frame_debug_expr (insn, label); - insn = PATTERN (insn); - found: - dwarf2out_frame_debug_expr (insn, label); + /* Check again. A parallel can save and update the same register. + We could probably check just once, here, but this is safer than + removing the check at the start of the function. */ + if (any_cfis_emitted || clobbers_queued_reg_save (insn)) + need_flush = true; + } - /* Check again. A parallel can save and update the same register. - We could probably check just once, here, but this is safer than - removing the check above. */ - if (any_cfis_emitted || clobbers_queued_reg_save (insn)) + if (need_flush) dwarf2out_flush_queued_reg_saves (); } diff --git a/gcc/final.c b/gcc/final.c index cb4a83d..c0c1fc8 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -2683,7 +2683,9 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, current_output_insn = debug_insn = insn; - if (CALL_P (insn) && dwarf2out_do_frame ()) + if (dwarf2out_do_frame () + && (CALL_P (insn) + || find_reg_note (insn, REG_CFA_FLUSH_QUEUE, NULL))) dwarf2out_frame_debug (insn, false); /* Find the proper template for this insn. */ diff --git a/gcc/reg-notes.def b/gcc/reg-notes.def index 9924355..eccac9e 100644 --- a/gcc/reg-notes.def +++ b/gcc/reg-notes.def @@ -155,16 +155,23 @@ REG_NOTE (CFA_EXPRESSION) first pattern is the register to be restored. */ REG_NOTE (CFA_RESTORE) -/* Attached to insn that is RTX_FRAME_RELATED_P, marks insn that sets +/* Attached to insns that are RTX_FRAME_RELATED_P, marks insn that sets vDRAP from DRAP. If vDRAP is a register, vdrap_reg is initalized to the argument, if it is a MEM, it is ignored. */ REG_NOTE (CFA_SET_VDRAP) -/* Attached to insn that are RTX_FRAME_RELATED_P, indicating a window +/* Attached to insns that are RTX_FRAME_RELATED_P, indicating a window save operation, i.e. will result in a DW_CFA_GNU_window_save. The argument is ignored. */ REG_NOTE (CFA_WINDOW_SAVE) +/* Attached to insns that are RTX_FRAME_RELATED_P, marks the insn as + requiring that all queued information should be flushed *before* insn, + regardless of what is visible in the rtl. The argument is ignored. + This is normally used for a call instruction which is not exposed to + the rest of the compiler as a CALL_INSN. */ +REG_NOTE (CFA_FLUSH_QUEUE) + /* Indicates that REG holds the exception context for the function. This context is shared by inline functions, so the code to acquire the real exception context is delayed until after inlining. */ -- 1.7.5.4