Commit 7672ab42 by Eric Botcazou Committed by Pierre-Marie de Rodat

[Ada] Minor internal cleanup in repinfo unit

This steamlines a bit the implementation.  No functional changes.

2018-05-28  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* repinfo.adb (List_Array_Info): Start with an explicit blank line and
	end with the linker section, if any.
	(List_Entities): Do not output the linker section for record types,
	array types and variables.
	(Print_Expr): Factor out common processing for unary operators and
	special values.  Adjust and reorder the various cases.
	(List_Object_Info): End with the linker section, if any.
	(List_Record_Info): Likewise.
	(List_Type_Info): Do not start with a blank line.

From-SVN: r260815
parent 121dec88
2018-05-28 Eric Botcazou <ebotcazou@adacore.com>
* repinfo.adb (List_Array_Info): Start with an explicit blank line and
end with the linker section, if any.
(List_Entities): Do not output the linker section for record types,
array types and variables.
(Print_Expr): Factor out common processing for unary operators and
special values. Adjust and reorder the various cases.
(List_Object_Info): End with the linker section, if any.
(List_Record_Info): Likewise.
(List_Type_Info): Do not start with a blank line.
2018-05-25 Nicolas Roche <roche@adacore.com> 2018-05-25 Nicolas Roche <roche@adacore.com>
* libgnat/s-valrea.adb (Scan_Real): Abort computation once it is sure * libgnat/s-valrea.adb (Scan_Real): Abort computation once it is sure
......
...@@ -302,7 +302,9 @@ package body Repinfo is ...@@ -302,7 +302,9 @@ package body Repinfo is
procedure List_Array_Info (Ent : Entity_Id; Bytes_Big_Endian : Boolean) is procedure List_Array_Info (Ent : Entity_Id; Bytes_Big_Endian : Boolean) is
begin begin
Blank_Line;
List_Type_Info (Ent); List_Type_Info (Ent);
Write_Str ("for "); Write_Str ("for ");
List_Name (Ent); List_Name (Ent);
Write_Str ("'Component_Size use "); Write_Str ("'Component_Size use ");
...@@ -310,6 +312,8 @@ package body Repinfo is ...@@ -310,6 +312,8 @@ package body Repinfo is
Write_Line (";"); Write_Line (";");
List_Scalar_Storage_Order (Ent, Bytes_Big_Endian); List_Scalar_Storage_Order (Ent, Bytes_Big_Endian);
List_Linker_Section (Ent);
end List_Array_Info; end List_Array_Info;
------------------- -------------------
...@@ -415,17 +419,14 @@ package body Repinfo is ...@@ -415,17 +419,14 @@ package body Repinfo is
List_Record_Info (E, Bytes_Big_Endian); List_Record_Info (E, Bytes_Big_Endian);
end if; end if;
List_Linker_Section (E);
elsif Is_Array_Type (E) then elsif Is_Array_Type (E) then
if List_Representation_Info >= 1 then if List_Representation_Info >= 1 then
List_Array_Info (E, Bytes_Big_Endian); List_Array_Info (E, Bytes_Big_Endian);
end if; end if;
List_Linker_Section (E);
elsif Is_Type (E) then elsif Is_Type (E) then
if List_Representation_Info >= 2 then if List_Representation_Info >= 2 then
Blank_Line;
List_Type_Info (E); List_Type_Info (E);
List_Linker_Section (E); List_Linker_Section (E);
end if; end if;
...@@ -433,7 +434,6 @@ package body Repinfo is ...@@ -433,7 +434,6 @@ package body Repinfo is
elsif Ekind_In (E, E_Variable, E_Constant) then elsif Ekind_In (E, E_Variable, E_Constant) then
if List_Representation_Info >= 2 then if List_Representation_Info >= 2 then
List_Object_Info (E); List_Object_Info (E);
List_Linker_Section (E);
end if; end if;
elsif Ekind (E) = E_Loop_Parameter or else Is_Formal (E) then elsif Ekind (E) = E_Loop_Parameter or else Is_Formal (E) then
...@@ -524,9 +524,25 @@ package body Repinfo is ...@@ -524,9 +524,25 @@ package body Repinfo is
declare declare
Node : Exp_Node renames Rep_Table.Table (-UI_To_Int (Val)); Node : Exp_Node renames Rep_Table.Table (-UI_To_Int (Val));
procedure Unop (S : String);
-- Output text for unary operator with S being operator name
procedure Binop (S : String); procedure Binop (S : String);
-- Output text for binary operator with S being operator name -- Output text for binary operator with S being operator name
procedure Valop (S : String);
-- Output text for special value with S being value symbol
----------
-- Unop --
----------
procedure Unop (S : String) is
begin
Write_Str (S);
Print_Expr (Node.Op1);
end Unop;
----------- -----------
-- Binop -- -- Binop --
----------- -----------
...@@ -540,6 +556,16 @@ package body Repinfo is ...@@ -540,6 +556,16 @@ package body Repinfo is
Write_Char (')'); Write_Char (')');
end Binop; end Binop;
-----------
-- Valop --
-----------
procedure Valop (S : String) is
begin
Write_Str (S);
UI_Write (Node.Op1);
end Valop;
-- Start of processing for Print_Expr -- Start of processing for Print_Expr
begin begin
...@@ -574,18 +600,17 @@ package body Repinfo is ...@@ -574,18 +600,17 @@ package body Repinfo is
when Trunc_Mod_Expr => when Trunc_Mod_Expr =>
Binop (" modt "); Binop (" modt ");
when Floor_Mod_Expr =>
Binop (" modf ");
when Ceil_Mod_Expr => when Ceil_Mod_Expr =>
Binop (" modc "); Binop (" modc ");
when Floor_Mod_Expr =>
Binop (" modf ");
when Exact_Div_Expr => when Exact_Div_Expr =>
Binop (" /e "); Binop (" /e ");
when Negate_Expr => when Negate_Expr =>
Write_Char ('-'); Unop ("-");
Print_Expr (Node.Op1);
when Min_Expr => when Min_Expr =>
Binop (" min "); Binop (" min ");
...@@ -594,8 +619,7 @@ package body Repinfo is ...@@ -594,8 +619,7 @@ package body Repinfo is
Binop (" max "); Binop (" max ");
when Abs_Expr => when Abs_Expr =>
Write_Str ("abs "); Unop ("abs ");
Print_Expr (Node.Op1);
when Truth_Andif_Expr => when Truth_Andif_Expr =>
Binop (" and if "); Binop (" and if ");
...@@ -613,11 +637,7 @@ package body Repinfo is ...@@ -613,11 +637,7 @@ package body Repinfo is
Binop (" xor "); Binop (" xor ");
when Truth_Not_Expr => when Truth_Not_Expr =>
Write_Str ("not "); Unop ("not ");
Print_Expr (Node.Op1);
when Bit_And_Expr =>
Binop (" & ");
when Lt_Expr => when Lt_Expr =>
Binop (" < "); Binop (" < ");
...@@ -637,13 +657,14 @@ package body Repinfo is ...@@ -637,13 +657,14 @@ package body Repinfo is
when Ne_Expr => when Ne_Expr =>
Binop (" != "); Binop (" != ");
when Bit_And_Expr =>
Binop (" & ");
when Discrim_Val => when Discrim_Val =>
Write_Char ('#'); Valop ("#");
UI_Write (Node.Op1);
when Dynamic_Val => when Dynamic_Val =>
Write_Str ("Var"); Valop ("var");
UI_Write (Node.Op1);
end case; end case;
end; end;
end if; end if;
...@@ -844,6 +865,8 @@ package body Repinfo is ...@@ -844,6 +865,8 @@ package body Repinfo is
Write_Str ("'Alignment use "); Write_Str ("'Alignment use ");
Write_Val (Alignment (Ent)); Write_Val (Alignment (Ent));
Write_Line (";"); Write_Line (";");
List_Linker_Section (Ent);
end List_Object_Info; end List_Object_Info;
---------------------- ----------------------
...@@ -1168,6 +1191,8 @@ package body Repinfo is ...@@ -1168,6 +1191,8 @@ package body Repinfo is
Write_Line ("end record;"); Write_Line ("end record;");
List_Scalar_Storage_Order (Ent, Bytes_Big_Endian); List_Scalar_Storage_Order (Ent, Bytes_Big_Endian);
List_Linker_Section (Ent);
end List_Record_Info; end List_Record_Info;
------------------- -------------------
...@@ -1283,8 +1308,6 @@ package body Repinfo is ...@@ -1283,8 +1308,6 @@ package body Repinfo is
procedure List_Type_Info (Ent : Entity_Id) is procedure List_Type_Info (Ent : Entity_Id) is
begin begin
Blank_Line;
-- Do not list size info for unconstrained arrays, not meaningful -- Do not list size info for unconstrained arrays, not meaningful
if Is_Array_Type (Ent) and then not Is_Constrained (Ent) then if Is_Array_Type (Ent) and then not Is_Constrained (Ent) then
......
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