From patchwork Mon May 30 10:35:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 97904 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 10F03B6F68 for ; Mon, 30 May 2011 20:39:27 +1000 (EST) Received: (qmail 32452 invoked by alias); 30 May 2011 10:39:25 -0000 Received: (qmail 32443 invoked by uid 22791); 30 May 2011 10:39:24 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 May 2011 10:39:08 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4UAd7Q0006638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 30 May 2011 06:39:07 -0400 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4UAd5CO027394 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 30 May 2011 06:39:07 -0400 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.4/8.14.4) with ESMTP id p4UAd54g009197 for ; Mon, 30 May 2011 07:39:05 -0300 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p4UAZx1u028191; Mon, 30 May 2011 07:35:59 -0300 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id p4UAZwk7028190; Mon, 30 May 2011 07:35:58 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Subject: introduce --param max-vartrack-expr-depth Date: Mon, 30 May 2011 07:35:58 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 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 One of my patches for PR 48866 regressed guality/asm-1.c on x86_64-linux-gnu because what used to be a single complex debug value expression became a chain of debug temps holding simpler expressions, and this chain exceeded the default recursion depth in resolving location expressions. This patch introduces a param to control this depth, so that one can trade compile time for better debug info, and bumps up the default depth a bit, avoiding the regression. Regstrapped on x86_64-linux-gnu and i686-linux-gnu. Ok to install? for gcc/ChangeLog from Alexandre Oliva * params.def (PARAM_MAX_VARTRACK_EXPR_DEPTH): New. * doc/invoke.texi: Document max-vartrack-expr-depth. * var-tracking.c (EXPR_DEPTH): New. (reverse_op, vt_expand_loc, vt_expand_loc_dummy): Use it. Index: gcc/params.def =================================================================== --- gcc/params.def.orig 2011-05-30 03:16:26.496342009 -0300 +++ gcc/params.def 2011-05-30 03:35:17.852414343 -0300 @@ -839,6 +839,14 @@ DEFPARAM (PARAM_MAX_VARTRACK_SIZE, "Max. size of var tracking hash tables", 50000000, 0, 0) +/* Set maximum recursion depth for var tracking expression expansion + and resolution. */ + +DEFPARAM (PARAM_MAX_VARTRACK_EXPR_DEPTH, + "max-vartrack-expr-depth", + "Max. recursion depth for expanding var tracking expressions", + 10, 0, 0) + /* Set minimum insn uid for non-debug insns. */ DEFPARAM (PARAM_MIN_NONDEBUG_INSN_UID, Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi.orig 2011-05-30 03:40:14.716854423 -0300 +++ gcc/doc/invoke.texi 2011-05-30 03:46:29.349288790 -0300 @@ -8866,6 +8866,16 @@ the function. If the limit is exceeded tracking analysis is completely disabled for the function. Setting the parameter to zero makes it unlimited. +@item max-vartrack-expr-depth +Sets a maximum number of recursion levels when attempting to map +variable names or debug temporaries to value expressions. This trades +compile time for more complete debug information. If this is set too +low, value expressions that are available and could be represented in +debug information may end up not being used; setting this higher may +enable the compiler to find more complex debug expressions, but compile +time may grow exponentially, and even then, it may fail to find more +usable expressions. The default is 10. + @item min-nondebug-insn-uid Use uids starting at this parameter for nondebug insns. The range below the parameter is reserved exclusively for debug insns created by Index: gcc/var-tracking.c =================================================================== --- gcc/var-tracking.c.orig 2011-05-30 03:40:46.135898766 -0300 +++ gcc/var-tracking.c 2011-05-30 03:39:35.745798000 -0300 @@ -5215,6 +5215,8 @@ add_uses_1 (rtx *x, void *cui) for_each_rtx (x, add_uses, cui); } +#define EXPR_DEPTH (PARAM_VALUE (PARAM_MAX_VARTRACK_EXPR_DEPTH)) + /* Attempt to reverse the EXPR operation in the debug info. Say for reg1 = reg2 + 6 even when reg2 is no longer live we can express its value as VAL - 6. */ @@ -5286,7 +5288,7 @@ reverse_op (rtx val, const_rtx expr) arg = XEXP (src, 1); if (!CONST_INT_P (arg) && GET_CODE (arg) != SYMBOL_REF) { - arg = cselib_expand_value_rtx (arg, scratch_regs, 5); + arg = cselib_expand_value_rtx (arg, scratch_regs, EXPR_DEPTH); if (arg == NULL_RTX) return NULL_RTX; if (!CONST_INT_P (arg) && GET_CODE (arg) != SYMBOL_REF) @@ -7416,7 +7418,7 @@ vt_expand_loc (rtx loc, htab_t vars, boo data.dummy = false; data.cur_loc_changed = false; data.ignore_cur_loc = ignore_cur_loc; - loc = cselib_expand_value_rtx_cb (loc, scratch_regs, 8, + loc = cselib_expand_value_rtx_cb (loc, scratch_regs, EXPR_DEPTH, vt_expand_loc_callback, &data); if (loc && MEM_P (loc)) @@ -7438,7 +7440,7 @@ vt_expand_loc_dummy (rtx loc, htab_t var data.dummy = true; data.cur_loc_changed = false; data.ignore_cur_loc = false; - ret = cselib_dummy_expand_value_rtx_cb (loc, scratch_regs, 8, + ret = cselib_dummy_expand_value_rtx_cb (loc, scratch_regs, EXPR_DEPTH, vt_expand_loc_callback, &data); *pcur_loc_changed = data.cur_loc_changed; return ret;