From patchwork Thu Aug 1 15:17:09 2024 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: 1967842 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=c4Kw+Wav; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WZY336VfXz1ybX for ; Fri, 2 Aug 2024 01:36:15 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1BFB93865C21 for ; Thu, 1 Aug 2024 15:36:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id DBA11386481C for ; Thu, 1 Aug 2024 15:17:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DBA11386481C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine 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 DBA11386481C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::330 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525483; cv=none; b=Tpgo5fF9no8pZ0rjpyW6orua0vaEDZ/10og/kVVE1KZq9KcFQNkAnnpSIKJoeCdeaBW7geLtu1dYmZ7VdUY28E3Hu/gSdx0VUf2RkkSmDPBqa1Yq9FG2H7AE9q1TnF9BEQmSV3iBIpnaux8nDu1EE6cLjAnfhnwnihI4ONFbERw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525483; c=relaxed/simple; bh=mEAZ1Wn/acTABHA0M3Xclmwm4fZB2Vf4c01rC8iBhsE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=huG4qP9TZa6NfmwWjlchVu6tpdt395BhbKXxYqKNz1WSZESDU4YvoVlCJaFJ0N9Z4/o4pHAAHDRn2sVAyY1fKRLQi/+C7RXQH8sXLoNaumdxgoYDMzP0pK95JLA64S6QTGMPSVDZ6nEtwmI60uqXNiLD/0ZSPC/lBIb7obrTZHc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4281c164408so39763325e9.1 for ; Thu, 01 Aug 2024 08:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1722525470; x=1723130270; 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=qn1uVeD5sQ1JK5RC4mIXRXXJ0iDWab/DwtUqHq7mCQY=; b=c4Kw+Wav4AIDG1pDNkbKuUR58n8lUOzQkS1YFpnMohhlkSVNTS+CUbshSDxVjBrrK8 eh/8Lf+0U3Zo3u++3hhUl1n10Zx/dmgDIQhOifixOZINoTyLVOn8f4JgRdLQNI6A/QtV 0BMWq+fIh+waARcyyhhJ/LKe/HJzFYWffAugUApB3Kb4ZupPRRTJnmkoyB1C1q6OznLI q9Sbz2BLZ18u7fxMa8u91bGbBnpUb8bjVx9ELskVLV/S/g7th47l561VHhWs8g+YhV2B 9CEx75vpnHn4OYa/USGnGWOAZ43v2xeKDoE6qw2MfbAPcAWBj9W0oAqYNw07EAAKzbQg K3Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722525470; x=1723130270; 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=qn1uVeD5sQ1JK5RC4mIXRXXJ0iDWab/DwtUqHq7mCQY=; b=CbJ4SZzxwx4SZnR9STqTLeJvpC/uh8NzDaAcvW+Gz72Qm8PMJZv99CHH04RUsILXSg mCqshf980pHoZbkV36IIPY6jVm5my8/PX4lyhmIpJZiqOwpsND/g/8CFJToDEfHUWDUk OKFCkK05+JQ9I6CKW+iZh9sOcLpCM457va8SP8lf0xrTArSkAL+L94SQDY+pnVLzGcLF PlZ+eb0cdLTt6QbzH8DOMD3nOGlkmpwmjwXXsVQOLJJUuFVRVZMin7njgmNSVWi21k2d zEDQ7a9OBhVSWFREVHimtRRSdK6zsi8R0bFtqc1jCH8eEeyXHrpkQgpaSY3KiqX/I76i afLg== X-Gm-Message-State: AOJu0YzO3iF87xNSD5KRPsGAKKufvPVaCccJ+KTqA34P220tDZ2boVnh easFZeT7Ci+HDmryPVuapAZzI9wr4KZoeZGveFMWh8q6AdJDS8zPGC8fYY3qJZHevaILC7jRcfD E9Q== X-Google-Smtp-Source: AGHT+IHgEXWDj3ynhn+UVEjPjTlbPQby1z4YczqlpIMtCYtkKNm3145MIV00aWdYhr6R0RyqockR7Q== X-Received: by 2002:adf:e644:0:b0:365:980c:d281 with SMTP id ffacd0b85a97d-36bbc1bcce8mr104272f8f.45.1722525469834; Thu, 01 Aug 2024 08:17:49 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:b6aa:4751:9ea1:da1e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b36857fdesm20065995f8f.75.2024.08.01.08.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 08:17:49 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED 01/30] ada: Remove obsolete workaround Date: Thu, 1 Aug 2024 17:17:09 +0200 Message-ID: <20240801151738.400796-1-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_FILL_THIS_FORM_SHORT 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~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Eric Botcazou It is possible to call the "+" operator of System.Storage_Elements directly as done for example in Expand_Interface_Thunk. gcc/ada/ * exp_ch7.adb (Make_Address_For_Finalize): Generate a direct call to the "+" operator of System.Storage_Elements. (Make_Finalize_Address_Stmts): Likewise. * rtsfind.ads (RE_Id): Remove RE_Add_Offset_To_Address. (RE_Unit_Table): Remove entry for RE_Add_Offset_To_Address. * libgnat/s-finpri.ads (Add_Offset_To_Address): Delete. * libgnat/s-finpri.adb (Add_Offset_To_Address): Likewise. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch7.adb | 37 ++++++++++++++++++++---------------- gcc/ada/libgnat/s-finpri.adb | 12 ------------ gcc/ada/libgnat/s-finpri.ads | 7 ------- gcc/ada/rtsfind.ads | 2 -- 4 files changed, 21 insertions(+), 37 deletions(-) diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index f4a707034c1..454f74507f4 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -5351,23 +5351,25 @@ package body Exp_Ch7 is -- V - (Obj_Typ'Descriptor_Size / Storage_Unit) - -- Note that this is done through a wrapper routine as RTSfind - -- cannot retrieve operations with string name of the form "+". - Obj_Addr := Make_Function_Call (Loc, Name => - New_Occurrence_Of (RTE (RE_Add_Offset_To_Address), Loc), + Make_Expanded_Name (Loc, + Chars => Name_Op_Subtract, + Prefix => + New_Occurrence_Of + (RTU_Entity (System_Storage_Elements), Loc), + Selector_Name => + Make_Identifier (Loc, Name_Op_Subtract)), Parameter_Associations => New_List ( Obj_Addr, - Make_Op_Minus (Loc, - Make_Op_Divide (Loc, - Left_Opnd => - Make_Attribute_Reference (Loc, - Prefix => New_Occurrence_Of (Obj_Typ, Loc), - Attribute_Name => Name_Descriptor_Size), - Right_Opnd => - Make_Integer_Literal (Loc, System_Storage_Unit))))); + Make_Op_Divide (Loc, + Left_Opnd => + Make_Attribute_Reference (Loc, + Prefix => New_Occurrence_Of (Obj_Typ, Loc), + Attribute_Name => Name_Descriptor_Size), + Right_Opnd => + Make_Integer_Literal (Loc, System_Storage_Unit)))); end if; return Obj_Addr; @@ -8105,14 +8107,17 @@ package body Exp_Ch7 is -- start of the elements: -- -- V + Dnn - -- - -- Note that this is done through a wrapper routine since RTSfind - -- cannot retrieve operations with string names of the form "+". Obj_Expr := Make_Function_Call (Loc, Name => - New_Occurrence_Of (RTE (RE_Add_Offset_To_Address), Loc), + Make_Expanded_Name (Loc, + Chars => Name_Op_Add, + Prefix => + New_Occurrence_Of + (RTU_Entity (System_Storage_Elements), Loc), + Selector_Name => + Make_Identifier (Loc, Name_Op_Add)), Parameter_Associations => New_List ( Obj_Expr, New_Occurrence_Of (Dope_Id, Loc))); diff --git a/gcc/ada/libgnat/s-finpri.adb b/gcc/ada/libgnat/s-finpri.adb index bc90fe23ac9..9767090cb4a 100644 --- a/gcc/ada/libgnat/s-finpri.adb +++ b/gcc/ada/libgnat/s-finpri.adb @@ -60,18 +60,6 @@ package body System.Finalization_Primitives is -- Unlock the finalization collection, i.e. relinquish ownership of the -- lock to the collection. - --------------------------- - -- Add_Offset_To_Address -- - --------------------------- - - function Add_Offset_To_Address - (Addr : System.Address; - Offset : System.Storage_Elements.Storage_Offset) return System.Address - is - begin - return System.Storage_Elements."+" (Addr, Offset); - end Add_Offset_To_Address; - --------------------------------- -- Attach_Object_To_Collection -- --------------------------------- diff --git a/gcc/ada/libgnat/s-finpri.ads b/gcc/ada/libgnat/s-finpri.ads index a821f1db657..851917b5924 100644 --- a/gcc/ada/libgnat/s-finpri.ads +++ b/gcc/ada/libgnat/s-finpri.ads @@ -171,13 +171,6 @@ package System.Finalization_Primitives with Preelaborate is private - -- Since RTSfind cannot contain names of the form RE_"+", the following - -- routine serves as a wrapper around System.Storage_Elements."+". - - function Add_Offset_To_Address - (Addr : System.Address; - Offset : System.Storage_Elements.Storage_Offset) return System.Address; - -- Finalization masters: -- Master node type structure. Finalize_Address comes first because it is diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads index f4566b4846f..8c0c9045360 100644 --- a/gcc/ada/rtsfind.ads +++ b/gcc/ada/rtsfind.ads @@ -919,7 +919,6 @@ package Rtsfind is RE_Attr_Long_Long_Float, -- System.Fat_LLF - RE_Add_Offset_To_Address, -- System.Finalization_Primitives RE_Attach_Object_To_Collection, -- System.Finalization_Primitives RE_Attach_Object_To_Master, -- System.Finalization_Primitives RE_Attach_Object_To_Node, -- System.Finalization_Primitives @@ -2571,7 +2570,6 @@ package Rtsfind is RE_Attr_Long_Long_Float => System_Fat_LLF, - RE_Add_Offset_To_Address => System_Finalization_Primitives, RE_Attach_Object_To_Collection => System_Finalization_Primitives, RE_Attach_Object_To_Master => System_Finalization_Primitives, RE_Attach_Object_To_Node => System_Finalization_Primitives,