From patchwork Tue Dec 1 06:02:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Funck X-Patchwork-Id: 550685 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AC67B1401E7 for ; Tue, 1 Dec 2015 17:05:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=aqAEAa/y; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=rvyZdEwQIciBxhCxD6uAedkx1ZdJLpwzaOAoPIPtyGTjBhBkgo NvXsLrNwxG6KKHp9g3fgDPfY1/IohagfkQ/rqVUVWr2TsWiS32cWzTeh9QU+xLt9 GZDl3fWvG2q3sSQTUpRbIEeWk9uRdULqPnMKSa6tM5KSnp1DvDm1QD9us= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=2ky+v+w8k8AoFAIfTlbiQ7mdsV4=; b=aqAEAa/yG+7o8OuSrHNb yCHo0vxOZ4NGO6ISy9Reg+bs8PT1fQSl//M5K370KhgS/HIHiyOcvloCKBGJgu4N IP1svMSDevwmGpNVZUq8ClFxXa5D+gxzNAaBSFvB+HE5NdHt4hf6mpvdVxOGqhNm UOW91RmbdBnKKrHnpeqA/6g= Received: (qmail 61626 invoked by alias); 1 Dec 2015 06:02:59 -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 59947 invoked by uid 89); 1 Dec 2015 06:02:57 -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, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-oi0-f100.google.com Received: from mail-oi0-f100.google.com (HELO mail-oi0-f100.google.com) (209.85.218.100) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 01 Dec 2015 06:02:43 +0000 Received: by oie188 with SMTP id 188so12011285oie.0 for ; Mon, 30 Nov 2015 22:02:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=43BuxxakZHGTR9n3tBD5iuODHlFgH/tsvtBlR7vN9Aw=; b=XePuG39WFgjL0/pDh2vY7LTSCpAc8wqmJqJj0XX+5aAoAISGARn08RHARM/Pcsp8xv t/j5ehzg9TNWzPrsHLZHuAfheMSzaNUQCy3Byg4+cxbQwwLhx8dj8TtYxcLcNuPicuCU 7QMyyNG/8tLJgd7Mu1toPLUt+HX3ysWV+R7aWxs/ajEI3YhpiIQWmU8wZDRM+VgOyoXF sSCmMKPi0raSkYNYh1EdB21NbN1Rr++L5PaAWeN+r73cGpKlIYqJHMBbpo63T8lqORJw HZdKUt7eLeR4QP4+p4u49GU9SxayYNuGvIXaCSTCgQKRN5mqD+jjo5vkVrI0qxkLfoEb Cqaw== X-Gm-Message-State: ALoCoQm+vrW4/XfYSf5xxMsJJGE0k/R/NMv0LD5ZbSnsLsn8tgTH3ChGM1iR9PMglPVvkkfM0cqACsts8h/vOTZIoLqdpEYUOQ== X-Received: by 10.107.4.65 with SMTP id 62mr58551253ioe.92.1448949761070; Mon, 30 Nov 2015 22:02:41 -0800 (PST) Received: from intrepid.com (74-95-8-117-SFBA.hfc.comcastbusiness.net. [74.95.8.117]) by smtp-relay.gmail.com with ESMTPS id mw4sm2410255igb.4.2015.11.30.22.02.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Nov 2015 22:02:41 -0800 (PST) X-Relaying-Domain: intrepid.com Received: from corp.local (localhost [127.0.0.1]) by corp.local (8.14.8/8.14.8) with ESMTP id tB162ejT031229; Mon, 30 Nov 2015 22:02:40 -0800 Received: (from gary@localhost) by corp.local (8.14.8/8.14.8/Submit) id tB162eWO031227; Mon, 30 Nov 2015 22:02:40 -0800 Date: Mon, 30 Nov 2015 22:02:40 -0800 From: Gary Funck To: Gcc Patches Cc: Cary Coutant , Jason Merrill , Nenad Vukicevic Subject: [UPC 12/22] DWARF support Message-ID: <20151201060240.GA31214@intrepid.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Background ---------- An overview email, describing the UPC-related changes is here: https://gcc.gnu.org/ml/gcc-patches/2015-12/msg00005.html The GUPC branch is described here: http://gcc.gnu.org/projects/gupc.html The UPC-related source code differences are summarized here: http://gccupc.org/gupc-changes All languages (c, c++, fortran, go, lto, objc, obj-c++) have been bootstrapped; no test suite regressions were introduced, relative to the GCC trunk. If you are on the cc-list, your name was chosen either because you are listed as a maintainer for the area that applies to the patches described in this email, or you were a frequent contributor of patches made to files listed in this email. In the change log entries included in each patch, the directory containing the affected files is listed, followed by the files. When the patches are applied, the change log entries will be distributed to the appropriate ChangeLog file. Overview -------- The Dwarf4 specification defines extensions which add support for UPC. See: http://dwarfstd.org/doc/DWARF4.pdf for details. These extensions are defined in /include/dwarf2.def. The patch below implements UPC debugging support. This support is enabled via the -dwarf-2-upc compilation switch. It is not enabled by default, because some older versions of GDB will abort when encountering the UPC-related DWARF extensions. A few years back, we added support to GDB for UPC, though that support was experimental and not pushed back into the mainline. A couple of commercial parallel debuggers implemented support for GNU UPC, utilizing these DWARF extensions. 2015-11-30 Gary Funck gcc/ * dwarf2out.c (modified_type_die): If the type is shared qualified, generate UPC debugging information as defined in the DWARF4 specification. (add_subscript_info): If the array index is "THREADS scaled", add the DW_AT_upc_threads_scaled attribute to the subrange DIE. (gen_compile_unit_die): If -fupc is asserted, set the language to DW_LANG_Upc. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (.../trunk) (revision 231059) +++ gcc/dwarf2out.c (.../branches/gupc) (revision 231080) @@ -10899,6 +10899,50 @@ modified_type_die (tree type, int cv_qua mod_type_die = d; } } + else if (use_upc_dwarf2_extensions + && (cv_quals & TYPE_QUAL_SHARED)) + { + HOST_WIDE_INT block_factor = 1; + + /* Inside the compiler, + "shared int x;" TYPE_BLOCK_FACTOR is null. + "shared [] int *p;" TYPE_BLOCK_FACTOR is zero. + "shared [10] int x[50];" TYPE_BLOCK_FACTOR is 10 * bitsize(int) + The DWARF2 encoding is as follows: + "shared int x;" DW_AT_count: 1 + "shared [] int *p;" + "shared [10] int x[50];" DW_AT_count: 10 + The logic below handles thse various contingencies. */ + + mod_type_die = new_die (DW_TAG_upc_shared_type, + comp_unit_die (), type); + + if (TYPE_HAS_BLOCK_FACTOR (type)) + block_factor = TREE_INT_CST_LOW (TYPE_BLOCK_FACTOR (type)); + + if (block_factor != 0) + add_AT_unsigned (mod_type_die, DW_AT_count, block_factor); + + sub_die = modified_type_die (type, + cv_quals & ~TYPE_QUAL_SHARED, + context_die); + } + else if (use_upc_dwarf2_extensions && cv_quals & TYPE_QUAL_STRICT) + { + mod_type_die = new_die (DW_TAG_upc_strict_type, + comp_unit_die (), type); + sub_die = modified_type_die (type, + cv_quals & ~TYPE_QUAL_STRICT, + context_die); + } + else if (use_upc_dwarf2_extensions && cv_quals & TYPE_QUAL_RELAXED) + { + mod_type_die = new_die (DW_TAG_upc_relaxed_type, + comp_unit_die (), type); + sub_die = modified_type_die (type, + cv_quals & ~TYPE_QUAL_RELAXED, + context_die); + } else if (code == POINTER_TYPE || code == REFERENCE_TYPE) { dwarf_tag tag = DW_TAG_pointer_type; @@ -16992,6 +17036,12 @@ add_subscript_info (dw_die_ref type_die, if (!subrange_die) subrange_die = new_die (DW_TAG_subrange_type, type_die, NULL); + + if (use_upc_dwarf2_extensions && TYPE_HAS_THREADS_FACTOR (type)) + { + add_AT_flag (subrange_die, DW_AT_upc_threads_scaled, 1); + } + if (domain) { /* We have an array type with specified bounds. */ @@ -20279,6 +20329,10 @@ gen_compile_unit_die (const char *filena if (dwarf_version >= 5 /* || !dwarf_strict */) if (strcmp (language_string, "GNU C11") == 0) language = DW_LANG_C11; + + if (use_upc_dwarf2_extensions && flag_upc) + language = DW_LANG_Upc; + } } else if (strncmp (language_string, "GNU C++", 7) == 0)