From patchwork Tue Nov 28 09:39:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 170649 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3792607vqx; Tue, 28 Nov 2023 01:40:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IG82qEHPuKh8vsgPk6TTzv/UAA9rJnsrHcov9ss0z/TKHCs7f07jivoe/G1aCJ/aGxwv3bY X-Received: by 2002:a0c:e9cd:0:b0:67a:4513:c681 with SMTP id q13-20020a0ce9cd000000b0067a4513c681mr6898729qvo.17.1701164409898; Tue, 28 Nov 2023 01:40:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701164409; cv=pass; d=google.com; s=arc-20160816; b=C+IoRRlwbrJrOX5HxajvTLc4LWngvI0hEuG4LwxmSJZAb4T6v1PYP9lFIzTKZ08vbe TlN51/+VtP9hRbYAOdRqBcrYv5pHi7kTs83GAjqoRwuGmK4fknpaZmPhXuHPwMqjHFNc a68PPh3WAS39XUobnyJ2TF0+pkShPvOjxWHC31eahNTUuOczPT5rwa00/yqqWLePfvUk e3kCH9M70NDla0VH4cJ9N0a/g0FvE+aq+mAvBdw8HsfAQz+3wyuf+DJ04N7KO0q10b8c FaTA/uhTLwQuhSotDI7GZm0wNXdFRzCIPo/GmivAY7Mg4aCQPB9lxLacncn/hPSyMEM6 8ftQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=XDFo+Mtp3gL36JECo/LDGmEmN1u1N7bEQEfD8vdOlMY=; fh=CkGzVCquR8A5LlIRcKC7HbCNaPX8AigmBi7d2GCj5Jg=; b=pLmMuT2b8xwy/UANzlICmwq8GmeAcCoWmfZONz8YuuLdsmiJalejlsS2El31IFAizI tdjKJMd74xk076kHd9VlrTgODVyNdWurr/oyFjphxbtQDqBPP4VYGXVA30wFySiHB3bo SwWJuSFS0aFD0jrWIqY9G7xArIKoyqSIT8tSdkaVBxr0+r54ruziQudcAb571cd25h0p 92CqZtLIYdv5TpRXnS/W/m7n+rq+5cOojhm/Vm1TklGaKfJNF24Hz6w9KazgoG18k8Vm nnxf+hw/lUy+bHs3pMza4q8m1AFnmSLjCfs6Mmq8kOff/AwiBA3fBCCKIlhvcTChfxAF RM1A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=Hrj87tgQ; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o4-20020ad45c84000000b0066ad6036429si12838699qvh.554.2023.11.28.01.40.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 01:40:09 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=Hrj87tgQ; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 748293949089 for ; Tue, 28 Nov 2023 09:39:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 423A83942025 for ; Tue, 28 Nov 2023 09:39:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 423A83942025 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 423A83942025 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701164363; cv=none; b=wu6Lvcz/s50EjZge88dyK+hPz84HuMMa2lzTbLadPZHZArRDkC1tLE+1W0KeC6xnR+p16dT7I5xaSsI45AE76HsVe2ZXRvm6Iwl+cZUm2rNxP4mjkH2L4tpm1mH/1bggSHD54Sh8ZAkr37Lqeiw4oSqMx9dF+HDdUolkLiIlMVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701164363; c=relaxed/simple; bh=GIh8oaXzVXg/9BcPMkUBwRwp3sMI8R/0Nxdng9sou8E=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BUxDw4hcwlLG7FCIX/BHJjJlfV0yjWY+aNoX9PMNODJb1/z1xxiL0mvalPMGtM5RlrpMYzztYK68vrimF5AZjna4vRdLMJF3C+eLC+pyENr1PkrkwSfKpIEc1RRKLB3SH1FUezwsQi3Iy+1uBDU0kqNa75ybF8uEz3234gWn9j8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1cfb83211b9so22717035ad.3 for ; Tue, 28 Nov 2023 01:39:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1701164360; x=1701769160; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XDFo+Mtp3gL36JECo/LDGmEmN1u1N7bEQEfD8vdOlMY=; b=Hrj87tgQg98hjpIQbJ9J8tsUTRGXYDJaMN70xJWEP3X+ZVTopHNN/XQoAy+kmc1Usq IfmUocf1Xo/txhNOSpRk6jD1qwguO4TTSxGI5VvZSdHl15XcgT3gGerJf5a2UJNQHcoe Hy+tY3BA0ac4BlwLA3iu4NWTGwi7gPIw5SJ/UG5/GKSTGMrUc5b2bji0/0GObmLldgh1 yT0EIGnEeO8BtwoyhzQQAHTAG77TkXirI560fm77qxj3bub4igAzLdz9v3j4OD3Q9Hxx uhriRiGaesQY5rhjZTDEkq1HxvnCWaNm7hr1cl2SoVx8ICkEGxpQjGM4tiLj30uWL/X4 Y8Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701164360; x=1701769160; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XDFo+Mtp3gL36JECo/LDGmEmN1u1N7bEQEfD8vdOlMY=; b=mcm3dY76F50/v1EjSVkHlCmI2AAsqC7yZB7tpB/fb63WxI6X27QZ+5i5LEKRnjGmK6 Wx5ajjS2mhosJK/EujmxPMaN4I2hcF2a/oUWMHBqDo4WX/CPi6FkowfY7BjPcGfuZ/tc q0RESOPWpLIZbMX/T0XO2FLyW5PQ6cFtQoim7OfPWxhScp1ChpLsdiVYMcIzo4sgaUo4 DtIE/Ir7ANDb4vQa8xbHKvSe2yOj97VzdJBeqLYSAGm8h2eYMNMJvyDK++yl1XEgOZ6z 0eFoiGfmfUOgJIhfquIdFoxNaqpw+c7uePM1WUncg48ByR+czKCxSV7mV1AR7J3SvUO6 I5eg== X-Gm-Message-State: AOJu0YzzvkVRmzAeDVzpHEd+bDWzLq8alTTQ3HPD48U9uBEST7BkX3D1 QmmPa79TtpvUOJ5TW0M3WxzIs4Ue0Q2wDUzK/vUQKg== X-Received: by 2002:a17:902:d346:b0:1cf:b4c6:49b7 with SMTP id l6-20020a170902d34600b001cfb4c649b7mr8299655plk.61.1701164360169; Tue, 28 Nov 2023 01:39:20 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:a24b:a65f:9576:c701]) by smtp.gmail.com with ESMTPSA id i10-20020a170902eb4a00b001cfc618d76csm4260815pli.70.2023.11.28.01.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 01:39:19 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Sebastian Poeplau Subject: [COMMITTED] ada: Add new predicate Is_Address_Compatible_Type Date: Tue, 28 Nov 2023 10:39:12 +0100 Message-ID: <20231128093912.2970916-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783800172497781763 X-GMAIL-MSGID: 1783800172497781763 From: Sebastian Poeplau When emitting code for architectures with tagged pointers, it is useful to be able to recognize values representing addresses because they require special handling. This commits adds the predicate Is_Address_Compatible_Type, which differs from the node attribute Is_Descendant_Of_Address by also taking Standard_Address into account. gcc/ada/ * einfo-utils.ads, einfo-utils.adb (Is_Address_Compatible_Type): New function. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/einfo-utils.adb | 5 +++++ gcc/ada/einfo-utils.ads | 2 ++ 2 files changed, 7 insertions(+) diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb index 88f4d4be7c8..46177acc7f8 100644 --- a/gcc/ada/einfo-utils.adb +++ b/gcc/ada/einfo-utils.adb @@ -201,6 +201,11 @@ package body Einfo.Utils is and then Ekind (Directly_Designated_Type (Id)) = E_Subprogram_Type; end Is_Access_Subprogram_Type; + function Is_Address_Compatible_Type (Id : E) return B is + begin + return Is_Descendant_Of_Address (Id) or else Id = Standard_Address; + end Is_Address_Compatible_Type; + function Is_Aggregate_Type (Id : E) return B is begin return Ekind (Id) in Aggregate_Kind; diff --git a/gcc/ada/einfo-utils.ads b/gcc/ada/einfo-utils.ads index 742ca220080..5589276e22f 100644 --- a/gcc/ada/einfo-utils.ads +++ b/gcc/ada/einfo-utils.ads @@ -96,6 +96,8 @@ package Einfo.Utils is function Is_Access_Type (Id : E) return B with Inline; function Is_Access_Protected_Subprogram_Type (Id : E) return B with Inline; function Is_Access_Subprogram_Type (Id : E) return B with Inline; + function Is_Address_Compatible_Type (Id : E) return B with Inline; + -- Check whether the type represents an address function Is_Aggregate_Type (Id : E) return B with Inline; function Is_Anonymous_Access_Type (Id : E) return B with Inline; function Is_Array_Type (Id : E) return B with Inline;