public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-5908] ada: Add new predicate Is_Address_Compatible_Type
@ 2023-11-28  9:38 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-11-28  9:38 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d2f2b9e6f9bcc2398f7e9a5a42dfa55053bdb0bf

commit r14-5908-gd2f2b9e6f9bcc2398f7e9a5a42dfa55053bdb0bf
Author: Sebastian Poeplau <poeplau@adacore.com>
Date:   Tue Nov 7 13:28:25 2023 +0100

    ada: Add new predicate Is_Address_Compatible_Type
    
    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.

Diff:
---
 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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-28  9:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28  9:38 [gcc r14-5908] ada: Add new predicate Is_Address_Compatible_Type Marc Poulhi?s

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).