Commit f04e9787 by Javier Miranda Committed by Pierre-Marie de Rodat

[Ada] Code cleanup of alignment representation clauses in dispatch tables

This patch does not modify the functionality of the compiler; it avoids
generating non-required alignment representation clauses for dispatch
tables.

2019-09-18  Javier Miranda  <miranda@adacore.com>

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.

From-SVN: r275853
parent 50a73953
2019-09-18 Javier Miranda <miranda@adacore.com>
* 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.
2019-09-18 Steve Baird <baird@adacore.com> 2019-09-18 Steve Baird <baird@adacore.com>
* sem_eval.adb (Expr_Value): Do not fail "the type of a null * sem_eval.adb (Expr_Value): Do not fail "the type of a null
......
...@@ -4041,7 +4041,6 @@ package body Exp_Disp is ...@@ -4041,7 +4041,6 @@ package body Exp_Disp is
-- predef-prim-op-thunk-2'address, -- predef-prim-op-thunk-2'address,
-- ... -- ...
-- predef-prim-op-thunk-n'address); -- predef-prim-op-thunk-n'address);
-- for Predef_Prims'Alignment use Address'Alignment
-- Create the thunks associated with the predefined primitives and -- Create the thunks associated with the predefined primitives and
-- save their entity to fill the aggregate. -- save their entity to fill the aggregate.
...@@ -4125,16 +4124,6 @@ package body Exp_Disp is ...@@ -4125,16 +4124,6 @@ package body Exp_Disp is
Object_Definition => New_Occurrence_Of Object_Definition => New_Occurrence_Of
(Defining_Identifier (Decl), Loc), (Defining_Identifier (Decl), Loc),
Expression => New_Node)); 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; end;
-- Generate -- Generate
...@@ -4143,6 +4132,7 @@ package body Exp_Disp is ...@@ -4143,6 +4132,7 @@ package body Exp_Disp is
-- (OSD_Table => (1 => <value>, -- (OSD_Table => (1 => <value>,
-- ... -- ...
-- N => <value>)); -- N => <value>));
-- for OSD'Alignment use Address'Alignment;
-- Iface_DT : Dispatch_Table (Nb_Prims) := -- Iface_DT : Dispatch_Table (Nb_Prims) :=
-- ([ Signature => <sig-value> ], -- ([ Signature => <sig-value> ],
...@@ -4154,7 +4144,6 @@ package body Exp_Disp is ...@@ -4154,7 +4144,6 @@ package body Exp_Disp is
-- prim-op-2'address, -- prim-op-2'address,
-- ... -- ...
-- prim-op-n'address)); -- prim-op-n'address));
-- for Iface_DT'Alignment use Address'Alignment;
-- Stage 3: Initialize the discriminant and the record components -- Stage 3: Initialize the discriminant and the record components
...@@ -4454,17 +4443,6 @@ package body Exp_Disp is ...@@ -4454,17 +4443,6 @@ package body Exp_Disp is
Make_Aggregate (Loc, Make_Aggregate (Loc,
Expressions => DT_Aggr_List))); 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 if Exporting_Table then
Export_DT (Typ, Iface_DT, Suffix_Index); Export_DT (Typ, Iface_DT, Suffix_Index);
...@@ -4946,7 +4924,6 @@ package body Exp_Disp is ...@@ -4946,7 +4924,6 @@ package body Exp_Disp is
-- Generate: -- Generate:
-- DT : No_Dispatch_Table_Wrapper; -- DT : No_Dispatch_Table_Wrapper;
-- for DT'Alignment use Address'Alignment;
-- DT_Ptr : Tag := !Tag (DT.NDT_Prims_Ptr'Address); -- DT_Ptr : Tag := !Tag (DT.NDT_Prims_Ptr'Address);
if not Has_DT (Typ) then if not Has_DT (Typ) then
...@@ -4960,16 +4937,6 @@ package body Exp_Disp is ...@@ -4960,16 +4937,6 @@ package body Exp_Disp is
(RTE (RE_No_Dispatch_Table_Wrapper), Loc))); (RTE (RE_No_Dispatch_Table_Wrapper), Loc)));
Append_To (Result, 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, Make_Object_Declaration (Loc,
Defining_Identifier => DT_Ptr, Defining_Identifier => DT_Ptr,
Object_Definition => New_Occurrence_Of (RTE (RE_Tag), Loc), Object_Definition => New_Occurrence_Of (RTE (RE_Tag), Loc),
...@@ -5008,7 +4975,6 @@ package body Exp_Disp is ...@@ -5008,7 +4975,6 @@ package body Exp_Disp is
-- Generate: -- Generate:
-- DT : Dispatch_Table_Wrapper (Nb_Prim); -- DT : Dispatch_Table_Wrapper (Nb_Prim);
-- for DT'Alignment use Address'Alignment;
-- DT_Ptr : Tag := !Tag (DT.Prims_Ptr'Address); -- DT_Ptr : Tag := !Tag (DT.Prims_Ptr'Address);
else else
...@@ -5037,16 +5003,6 @@ package body Exp_Disp is ...@@ -5037,16 +5003,6 @@ package body Exp_Disp is
Constraints => DT_Constr_List)))); Constraints => DT_Constr_List))));
Append_To (Result, 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, Make_Object_Declaration (Loc,
Defining_Identifier => DT_Ptr, Defining_Identifier => DT_Ptr,
Object_Definition => New_Occurrence_Of (RTE (RE_Tag), Loc), Object_Definition => New_Occurrence_Of (RTE (RE_Tag), Loc),
...@@ -5161,7 +5117,6 @@ package body Exp_Disp is ...@@ -5161,7 +5117,6 @@ package body Exp_Disp is
-- Tags_Table => (0 => null, -- Tags_Table => (0 => null,
-- 1 => Parent'Tag -- 1 => Parent'Tag
-- ...); -- ...);
-- for TSD'Alignment use Address'Alignment
TSD_Aggr_List := New_List; TSD_Aggr_List := New_List;
...@@ -5699,16 +5654,6 @@ package body Exp_Disp is ...@@ -5699,16 +5654,6 @@ package body Exp_Disp is
Make_Integer_Literal (Loc, Num_Ifaces), Make_Integer_Literal (Loc, Num_Ifaces),
Make_Aggregate (Loc, TSD_Ifaces_List))))); 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 := Iface_Table_Node :=
Make_Attribute_Reference (Loc, Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (ITable, Loc), Prefix => New_Occurrence_Of (ITable, Loc),
...@@ -5859,16 +5804,6 @@ package body Exp_Disp is ...@@ -5859,16 +5804,6 @@ package body Exp_Disp is
Set_Is_True_Constant (TSD, Building_Static_DT (Typ)); 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 -- Initialize or declare the dispatch table object
if not Has_DT (Typ) then if not Has_DT (Typ) then
...@@ -5906,7 +5841,6 @@ package body Exp_Disp is ...@@ -5906,7 +5841,6 @@ package body Exp_Disp is
-- DT : aliased constant No_Dispatch_Table := -- DT : aliased constant No_Dispatch_Table :=
-- (NDT_TSD => TSD'Address; -- (NDT_TSD => TSD'Address;
-- NDT_Prims_Ptr => 0); -- NDT_Prims_Ptr => 0);
-- for DT'Alignment use Address'Alignment;
else else
Append_To (Result, Append_To (Result,
...@@ -5918,16 +5852,6 @@ package body Exp_Disp is ...@@ -5918,16 +5852,6 @@ package body Exp_Disp is
New_Occurrence_Of (RTE (RE_No_Dispatch_Table_Wrapper), Loc), New_Occurrence_Of (RTE (RE_No_Dispatch_Table_Wrapper), Loc),
Expression => Make_Aggregate (Loc, DT_Aggr_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); Export_DT (Typ, DT);
end if; end if;
...@@ -5940,7 +5864,6 @@ package body Exp_Disp is ...@@ -5940,7 +5864,6 @@ package body Exp_Disp is
-- predef-prim-op-2'address, -- predef-prim-op-2'address,
-- ... -- ...
-- predef-prim-op-n'address); -- predef-prim-op-n'address);
-- for Predef_Prims'Alignment use Address'Alignment
-- DT : Dispatch_Table (Nb_Prims) := -- DT : Dispatch_Table (Nb_Prims) :=
-- (Signature => <sig-value>, -- (Signature => <sig-value>,
...@@ -6025,16 +5948,6 @@ package body Exp_Disp is ...@@ -6025,16 +5948,6 @@ package body Exp_Disp is
-- Remember aggregates initializing dispatch tables -- Remember aggregates initializing dispatch tables
Append_Elmt (New_Node, DT_Aggr); 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; end;
-- Stage 1: Initialize the discriminant and the record components -- Stage 1: Initialize the discriminant and the record components
...@@ -6221,16 +6134,6 @@ package body Exp_Disp is ...@@ -6221,16 +6134,6 @@ package body Exp_Disp is
Constraints => DT_Constr_List)), Constraints => DT_Constr_List)),
Expression => Make_Aggregate (Loc, DT_Aggr_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); Export_DT (Typ, DT);
end if; end if;
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment