From patchwork Fri Jan 15 12:12:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 1426945 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DHKn52yHGz9sVF for ; Fri, 15 Jan 2021 23:12:25 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE924397306C; Fri, 15 Jan 2021 12:12:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 46865386F03E for ; Fri, 15 Jan 2021 12:12:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 46865386F03E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Andrew_Stubbs@mentor.com IronPort-SDR: n7B+CigF5a4E9Q9NDMeLZxXqiS+FX5Q2PyN69ZZNB9WGU7QAdv3j7bV/EtYknxQHUg8p8axZBm xggp6dy84oMuVSK74ui2G10RGi8QqtKDIRBudUix8/OLqJ7uW3cVbT3A7YOuqZ43Tr0Ylr53wi IBrdaHY7KvjN3yh/X4Rb8wsdwphWgp9yrg/Bbt301mmzOzi+GgEWMKpmXUxLWUqgzZIwFK4RL+ X6QELNOxZ4pzwjIZYSv0xMwL3m1ZIyc4eI2knWJ8ZGwqfiQbKzX/Dz+fRTqgSPmMeEA7qoCr5j RUE= X-IronPort-AV: E=Sophos;i="5.79,349,1602576000"; d="scan'208";a="59391636" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 15 Jan 2021 04:12:12 -0800 IronPort-SDR: I+JHeGZHHt+8Q/Rxua1e32uENr1RAT0IuD0JKU0ykX9ruQwKrgL2YfNvQwYFqu6oPqOUWFG+zD T0RZ8oUnjTDV+Ln6lqZUGvgywd8R4lbCkV3yKvbTaemjOfH86pJFjulRfh2V146qCZlfWeOokh 1arZd9K5CPuqis+k2RsQmXqB1vtQdwsftLojErrsSjijd63cpvp7u2VTmacd5PRWCr843RyFaM 3ifYZS6v6KIVSfFccBd400d6VoQJy4bmcxB9VQyDsoztMlWI0wbhCUHwXkHNCf6TnmBCFoIZY2 PW4= To: "gcc-patches@gcc.gnu.org" From: Andrew Stubbs Subject: [committed][OG10] amdgcn: DWARF address spaces Message-ID: Date: Fri, 15 Jan 2021 12:12:07 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Language: en-GB X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-05.mgc.mentorg.com (139.181.222.5) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This patch implements DWARF address spaces for pointers to LDS, etc., on AMD GCN. The address space mappings are defined by AMD in their DWARF proposals, and the LLVM implementation. ROCGDB does not actually support this feature yet, I don't believe, but will do so soonish. Committed to devel/omp/gcc-10. Queued for mainline. Andrew amdgcn: DWARF address spaces Map GCN address spaces to the proposed DWARF address spaces defined by AMD. gcc/ChangeLog: * config/gcn/gcn.c: Include dwarf2.h. (gcn_addr_space_debug): New function. (TARGET_ADDR_SPACE_DEBUG): New hook. diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c index 1cb92714f24..f0e4636c06a 100644 --- a/gcc/config/gcn/gcn.c +++ b/gcc/config/gcn/gcn.c @@ -51,6 +51,7 @@ #include "intl.h" #include "rtl-iter.h" #include "gimple.h" +#include "dwarf2.h" /* This file should be included last. */ #include "target-def.h" @@ -1502,6 +1503,31 @@ gcn_addr_space_convert (rtx op, tree from_type, tree to_type) gcc_unreachable (); } +/* Implement TARGET_ADDR_SPACE_DEBUG. + + Return the dwarf address space class for each hardware address space. */ + +static int +gcn_addr_space_debug (addr_space_t as) +{ + switch (as) + { + case ADDR_SPACE_DEFAULT: + case ADDR_SPACE_FLAT: + case ADDR_SPACE_GLOBAL: + case ADDR_SPACE_SCALAR_FLAT: + case ADDR_SPACE_FLAT_SCRATCH: + return DW_ADDR_none; + case ADDR_SPACE_LDS: + return 3; // DW_ADDR_LLVM_group + case ADDR_SPACE_SCRATCH: + return 4; // DW_ADDR_LLVM_private + case ADDR_SPACE_GDS: + return 0x8000; // DW_ADDR_AMDGPU_region + } + gcc_unreachable (); +} + /* Implement REGNO_MODE_CODE_OK_FOR_BASE_P via gcn.h @@ -6366,6 +6392,8 @@ gcn_dwarf_register_span (rtx rtl) #undef TARGET_ADDR_SPACE_ADDRESS_MODE #define TARGET_ADDR_SPACE_ADDRESS_MODE gcn_addr_space_address_mode +#undef TARGET_ADDR_SPACE_DEBUG +#define TARGET_ADDR_SPACE_DEBUG gcn_addr_space_debug #undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P #define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P \ gcn_addr_space_legitimate_address_p