From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25209 invoked by alias); 18 Sep 2019 08:47:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 25196 invoked by uid 89); 18 Sep 2019 08:47:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=sk:dispatc X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 Sep 2019 08:47:37 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 42F48117D1A; Wed, 18 Sep 2019 04:39:45 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id SI1zhuqDH7uA; Wed, 18 Sep 2019 04:39:45 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id 1BB82117CFD; Wed, 18 Sep 2019 04:39:45 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id 19580702; Wed, 18 Sep 2019 04:39:45 -0400 (EDT) Date: Wed, 18 Sep 2019 08:47:00 -0000 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [Ada] Code cleanup of alignment representation clauses in dispatch tables Message-ID: <20190918083945.GA145152@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="sdtB3X0nJg68CQEu" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg01084.txt.bz2 --sdtB3X0nJg68CQEu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 430 This patch does not modify the functionality of the compiler; it avoids generating non-required alignment representation clauses for dispatch tables. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-09-18 Javier Miranda gcc/ada/ * exp_disp.adb (Make_DT, Make_Secondary_DT): Remove generation of alignment representation clause for the following tables: Predef_Prims, Iface_DT, TSD, ITable, DT. --sdtB3X0nJg68CQEu Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" Content-length: 9158 --- gcc/ada/exp_disp.adb +++ gcc/ada/exp_disp.adb @@ -4041,7 +4041,6 @@ package body Exp_Disp is -- predef-prim-op-thunk-2'address, -- ... -- predef-prim-op-thunk-n'address); - -- for Predef_Prims'Alignment use Address'Alignment -- Create the thunks associated with the predefined primitives and -- save their entity to fill the aggregate. @@ -4125,16 +4124,6 @@ package body Exp_Disp is Object_Definition => New_Occurrence_Of (Defining_Identifier (Decl), Loc), Expression => New_Node)); - - Append_To (Result, - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (Predef_Prims, Loc), - Chars => Name_Alignment, - Expression => - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (RTE (RE_Integer_Address), Loc), - Attribute_Name => Name_Alignment))); end; -- Generate @@ -4143,6 +4132,7 @@ package body Exp_Disp is -- (OSD_Table => (1 => , -- ... -- N => )); + -- for OSD'Alignment use Address'Alignment; -- Iface_DT : Dispatch_Table (Nb_Prims) := -- ([ Signature => ], @@ -4154,7 +4144,6 @@ package body Exp_Disp is -- prim-op-2'address, -- ... -- prim-op-n'address)); - -- for Iface_DT'Alignment use Address'Alignment; -- Stage 3: Initialize the discriminant and the record components @@ -4454,17 +4443,6 @@ package body Exp_Disp is Make_Aggregate (Loc, Expressions => DT_Aggr_List))); - Append_To (Result, - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (Iface_DT, Loc), - Chars => Name_Alignment, - - Expression => - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (RTE (RE_Integer_Address), Loc), - Attribute_Name => Name_Alignment))); - if Exporting_Table then Export_DT (Typ, Iface_DT, Suffix_Index); @@ -4946,7 +4924,6 @@ package body Exp_Disp is -- Generate: -- DT : No_Dispatch_Table_Wrapper; - -- for DT'Alignment use Address'Alignment; -- DT_Ptr : Tag := !Tag (DT.NDT_Prims_Ptr'Address); if not Has_DT (Typ) then @@ -4960,16 +4937,6 @@ package body Exp_Disp is (RTE (RE_No_Dispatch_Table_Wrapper), Loc))); Append_To (Result, - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (DT, Loc), - Chars => Name_Alignment, - Expression => - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (RTE (RE_Integer_Address), Loc), - Attribute_Name => Name_Alignment))); - - Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => DT_Ptr, Object_Definition => New_Occurrence_Of (RTE (RE_Tag), Loc), @@ -5008,7 +4975,6 @@ package body Exp_Disp is -- Generate: -- DT : Dispatch_Table_Wrapper (Nb_Prim); - -- for DT'Alignment use Address'Alignment; -- DT_Ptr : Tag := !Tag (DT.Prims_Ptr'Address); else @@ -5037,16 +5003,6 @@ package body Exp_Disp is Constraints => DT_Constr_List)))); Append_To (Result, - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (DT, Loc), - Chars => Name_Alignment, - Expression => - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (RTE (RE_Integer_Address), Loc), - Attribute_Name => Name_Alignment))); - - Append_To (Result, Make_Object_Declaration (Loc, Defining_Identifier => DT_Ptr, Object_Definition => New_Occurrence_Of (RTE (RE_Tag), Loc), @@ -5161,7 +5117,6 @@ package body Exp_Disp is -- Tags_Table => (0 => null, -- 1 => Parent'Tag -- ...); - -- for TSD'Alignment use Address'Alignment TSD_Aggr_List := New_List; @@ -5699,16 +5654,6 @@ package body Exp_Disp is Make_Integer_Literal (Loc, Num_Ifaces), Make_Aggregate (Loc, TSD_Ifaces_List))))); - Append_To (Result, - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (ITable, Loc), - Chars => Name_Alignment, - Expression => - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (RTE (RE_Integer_Address), Loc), - Attribute_Name => Name_Alignment))); - Iface_Table_Node := Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (ITable, Loc), @@ -5859,16 +5804,6 @@ package body Exp_Disp is Set_Is_True_Constant (TSD, Building_Static_DT (Typ)); - Append_To (Result, - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (TSD, Loc), - Chars => Name_Alignment, - Expression => - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (RTE (RE_Integer_Address), Loc), - Attribute_Name => Name_Alignment))); - -- Initialize or declare the dispatch table object if not Has_DT (Typ) then @@ -5906,7 +5841,6 @@ package body Exp_Disp is -- DT : aliased constant No_Dispatch_Table := -- (NDT_TSD => TSD'Address; -- NDT_Prims_Ptr => 0); - -- for DT'Alignment use Address'Alignment; else Append_To (Result, @@ -5918,16 +5852,6 @@ package body Exp_Disp is New_Occurrence_Of (RTE (RE_No_Dispatch_Table_Wrapper), Loc), Expression => Make_Aggregate (Loc, DT_Aggr_List))); - Append_To (Result, - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (DT, Loc), - Chars => Name_Alignment, - Expression => - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (RTE (RE_Integer_Address), Loc), - Attribute_Name => Name_Alignment))); - Export_DT (Typ, DT); end if; @@ -5940,7 +5864,6 @@ package body Exp_Disp is -- predef-prim-op-2'address, -- ... -- predef-prim-op-n'address); - -- for Predef_Prims'Alignment use Address'Alignment -- DT : Dispatch_Table (Nb_Prims) := -- (Signature => , @@ -6025,16 +5948,6 @@ package body Exp_Disp is -- Remember aggregates initializing dispatch tables Append_Elmt (New_Node, DT_Aggr); - - Append_To (Result, - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (Predef_Prims, Loc), - Chars => Name_Alignment, - Expression => - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (RTE (RE_Integer_Address), Loc), - Attribute_Name => Name_Alignment))); end; -- Stage 1: Initialize the discriminant and the record components @@ -6221,16 +6134,6 @@ package body Exp_Disp is Constraints => DT_Constr_List)), Expression => Make_Aggregate (Loc, DT_Aggr_List))); - Append_To (Result, - Make_Attribute_Definition_Clause (Loc, - Name => New_Occurrence_Of (DT, Loc), - Chars => Name_Alignment, - Expression => - Make_Attribute_Reference (Loc, - Prefix => - New_Occurrence_Of (RTE (RE_Integer_Address), Loc), - Attribute_Name => Name_Alignment))); - Export_DT (Typ, DT); end if; end if; --sdtB3X0nJg68CQEu--