From patchwork Thu Oct 24 10:45:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 285871 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6A58E2C0119 for ; Thu, 24 Oct 2013 21:46:10 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=E9IT5ifU8bzbLPfj 3g4V8wLmo7uKWLlySz/v/ZW+DY00ZKvvUZ0uESNtWuhGPQbcy3A7KLzZurVZk4t6 WFPbdPb1JJheuIDH535xI0rRB1EVJFLajwrFc/BuP99bl1m9Uozp+5g2sC5lYuk9 ACs368K+DQT+PcF1rawOVvFjPnM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=+DTnjOdPtoOE6nCcPC95pA 8bkA8=; b=QM63ukO9tAmT7AI8We0v0Mp74J89hcBf04GKzBikRNuRDXShTxfZL2 uQLwjU/ZL/khUTingWESJSnNs3AFAhE7dOoO97nlPUPEgTvlHkOAKs9wsGSmFTJy R2kzQZyW+LrPG7bau70CI4ce2FGHjC/vb7oiOw7IuBYJk4m3InwaA= Received: (qmail 31600 invoked by alias); 24 Oct 2013 10:46:04 -0000 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 Received: (qmail 31586 invoked by uid 89); 24 Oct 2013 10:46:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 24 Oct 2013 10:46:02 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 4C0C22688B63 for ; Thu, 24 Oct 2013 12:45:59 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id twFQljpe_wAk for ; Thu, 24 Oct 2013 12:45:59 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 211402688B2C for ; Thu, 24 Oct 2013 12:45:59 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Improve debug info for small structures (2) Date: Thu, 24 Oct 2013 12:45:50 +0200 Message-ID: <8592328.QliyaZRQOE@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.29-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 Hi, this is a follow-up to http://gcc.gnu.org/ml/gcc-patches/2013-06/msg00895.html which fixed the 3. issue partially. This resulted in gcc.dg/guality/param-2.c being compiled with -fno-var-tracking-assignments. The attached testcase param-3.c is identical to param-2.c but without the special option; it fails (at least) for SPARC & PowerPC on the one hand and for SPARC64 & x86-64 on the other hand. The first issue is that var-tracking.c cannot track values for multiple-part variables; rather than implementing this, which looks quite daunting to me, the patch simply reverts to location tracking for multiple-part parameters, on the grounds that they are rarely modified in practice. The second issue is that var-tracking.c doesn't handle multiple-part parameters coming in a PARALLEL, like on SPARC64 & x86-64. Tested on x86-64 & PowerPC Linux and SPARC & SPARC64 Solaris, OK for mainline? 2013-10-24 Eric Botcazou * var-tracking.c (track_expr_p): Do not track declarations for parts of tracked parameters. (add_stores): Do not track values for tracked parameters passed in multiple locations. (vt_get_decl_and_offset): Handle PARALLEL. (vt_add_function_parameter): Handle parameters with incoming PARALLEL. 2013-10-24 Eric Botcazou * gcc.dg/guality/param-3.c: New test. Index: var-tracking.c =================================================================== --- var-tracking.c (revision 203876) +++ var-tracking.c (working copy) @@ -5065,6 +5065,11 @@ track_expr_p (tree expr, bool need_rtl) &maxsize); if (!DECL_P (innerdecl) || DECL_IGNORED_P (innerdecl) + /* Do not track declarations for parts of tracked parameters + since we want to track them as a whole instead. */ + || (TREE_CODE (innerdecl) == PARM_DECL + && DECL_MODE (innerdecl) != BLKmode + && TREE_CODE (TREE_TYPE (innerdecl)) != UNION_TYPE) || TREE_STATIC (innerdecl) || bitsize <= 0 || bitpos + bitsize > 256 @@ -5919,6 +5924,20 @@ add_stores (rtx loc, const_rtx expr, voi if (type != MO_VAL_SET) goto log_and_return; + /* We cannot track values for multiple-part variables, so we track only + locations for tracked parameters passed either by invisible reference + or directly in multiple locations. */ + if (track_p + && REG_P (loc) + && REG_EXPR (loc) + && TREE_CODE (REG_EXPR (loc)) == PARM_DECL + && DECL_MODE (REG_EXPR (loc)) != BLKmode + && ((MEM_P (DECL_INCOMING_RTL (REG_EXPR (loc))) + && XEXP (DECL_INCOMING_RTL (REG_EXPR (loc)), 0) != arg_pointer_rtx) + || (GET_CODE (DECL_INCOMING_RTL (REG_EXPR (loc))) == PARALLEL + && XVECLEN (DECL_INCOMING_RTL (REG_EXPR (loc)), 0) > 1))) + goto log_and_return; + v = find_use_val (oloc, mode, cui); if (!v) @@ -9447,6 +9466,32 @@ vt_get_decl_and_offset (rtx rtl, tree *d return true; } } + else if (GET_CODE (rtl) == PARALLEL) + { + tree decl = NULL_TREE; + HOST_WIDE_INT offset = MAX_VAR_PARTS; + int len = XVECLEN (rtl, 0), i; + + for (i = 0; i < len; i++) + { + rtx reg = XEXP (XVECEXP (rtl, 0, i), 0); + if (!REG_P (reg) || !REG_ATTRS (reg)) + break; + if (!decl) + decl = REG_EXPR (reg); + if (REG_EXPR (reg) != decl) + break; + if (REG_OFFSET (reg) < offset) + offset = REG_OFFSET (reg); + } + + if (i == len) + { + *declp = decl; + *offsetp = offset; + return true; + } + } else if (MEM_P (rtl)) { if (MEM_ATTRS (rtl)) @@ -9532,6 +9577,28 @@ vt_add_function_parameter (tree parm) p.outgoing = incoming; vec_safe_push (windowed_parm_regs, p); } + else if (GET_CODE (incoming) == PARALLEL) + { + rtx outgoing + = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (XVECLEN (incoming, 0))); + int i; + + for (i = 0; i < XVECLEN (incoming, 0); i++) + { + rtx reg = XEXP (XVECEXP (incoming, 0, i), 0); + parm_reg_t p; + p.incoming = reg; + reg = gen_rtx_REG_offset (reg, GET_MODE (reg), + OUTGOING_REGNO (REGNO (reg)), 0); + p.outgoing = reg; + XVECEXP (outgoing, 0, i) + = gen_rtx_EXPR_LIST (VOIDmode, reg, + XEXP (XVECEXP (incoming, 0, i), 1)); + vec_safe_push (windowed_parm_regs, p); + } + + incoming = outgoing; + } else if (MEM_P (incoming) && REG_P (XEXP (incoming, 0)) && HARD_REGISTER_P (XEXP (incoming, 0))) @@ -9665,6 +9732,20 @@ vt_add_function_parameter (tree parm) } } } + else if (GET_CODE (incoming) == PARALLEL && !dv_onepart_p (dv)) + { + int i; + + for (i = 0; i < XVECLEN (incoming, 0); i++) + { + rtx reg = XEXP (XVECEXP (incoming, 0, i), 0); + offset = REG_OFFSET (reg); + gcc_assert (REGNO (reg) < FIRST_PSEUDO_REGISTER); + attrs_list_insert (&out->regs[REGNO (reg)], dv, offset, reg); + set_variable_part (out, reg, dv, offset, + VAR_INIT_STATUS_INITIALIZED, NULL, INSERT); + } + } else if (MEM_P (incoming)) { incoming = var_lowpart (mode, incoming);