aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-05-28 08:52:42 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-28 08:52:42 +0000
commit7672ab42ccdedf12b8bab23309e86e7a393e9d99 (patch)
treebc1d4c56947b01310de308308b772aaa82842a5b
parent121dec88595057b7019dbffdca2ad80b8fd2f40c (diff)
downloadgcc-7672ab42ccdedf12b8bab23309e86e7a393e9d99.zip
gcc-7672ab42ccdedf12b8bab23309e86e7a393e9d99.tar.gz
gcc-7672ab42ccdedf12b8bab23309e86e7a393e9d99.tar.bz2
[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
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/repinfo.adb69
2 files changed, 58 insertions, 23 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 39deb15..41df33f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,15 @@
+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>
* libgnat/s-valrea.adb (Scan_Real): Abort computation once it is sure
diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index fd7a931..07c034b 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -302,7 +302,9 @@ package body Repinfo is
procedure List_Array_Info (Ent : Entity_Id; Bytes_Big_Endian : Boolean) is
begin
+ Blank_Line;
List_Type_Info (Ent);
+
Write_Str ("for ");
List_Name (Ent);
Write_Str ("'Component_Size use ");
@@ -310,6 +312,8 @@ package body Repinfo is
Write_Line (";");
List_Scalar_Storage_Order (Ent, Bytes_Big_Endian);
+
+ List_Linker_Section (Ent);
end List_Array_Info;
-------------------
@@ -415,17 +419,14 @@ package body Repinfo is
List_Record_Info (E, Bytes_Big_Endian);
end if;
- List_Linker_Section (E);
-
elsif Is_Array_Type (E) then
if List_Representation_Info >= 1 then
List_Array_Info (E, Bytes_Big_Endian);
end if;
- List_Linker_Section (E);
-
elsif Is_Type (E) then
if List_Representation_Info >= 2 then
+ Blank_Line;
List_Type_Info (E);
List_Linker_Section (E);
end if;
@@ -433,7 +434,6 @@ package body Repinfo is
elsif Ekind_In (E, E_Variable, E_Constant) then
if List_Representation_Info >= 2 then
List_Object_Info (E);
- List_Linker_Section (E);
end if;
elsif Ekind (E) = E_Loop_Parameter or else Is_Formal (E) then
@@ -524,9 +524,25 @@ package body Repinfo is
declare
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);
-- 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 --
-----------
@@ -540,6 +556,16 @@ package body Repinfo is
Write_Char (')');
end Binop;
+ -----------
+ -- Valop --
+ -----------
+
+ procedure Valop (S : String) is
+ begin
+ Write_Str (S);
+ UI_Write (Node.Op1);
+ end Valop;
+
-- Start of processing for Print_Expr
begin
@@ -574,18 +600,17 @@ package body Repinfo is
when Trunc_Mod_Expr =>
Binop (" modt ");
- when Floor_Mod_Expr =>
- Binop (" modf ");
-
when Ceil_Mod_Expr =>
Binop (" modc ");
+ when Floor_Mod_Expr =>
+ Binop (" modf ");
+
when Exact_Div_Expr =>
Binop (" /e ");
when Negate_Expr =>
- Write_Char ('-');
- Print_Expr (Node.Op1);
+ Unop ("-");
when Min_Expr =>
Binop (" min ");
@@ -594,8 +619,7 @@ package body Repinfo is
Binop (" max ");
when Abs_Expr =>
- Write_Str ("abs ");
- Print_Expr (Node.Op1);
+ Unop ("abs ");
when Truth_Andif_Expr =>
Binop (" and if ");
@@ -613,11 +637,7 @@ package body Repinfo is
Binop (" xor ");
when Truth_Not_Expr =>
- Write_Str ("not ");
- Print_Expr (Node.Op1);
-
- when Bit_And_Expr =>
- Binop (" & ");
+ Unop ("not ");
when Lt_Expr =>
Binop (" < ");
@@ -637,13 +657,14 @@ package body Repinfo is
when Ne_Expr =>
Binop (" != ");
+ when Bit_And_Expr =>
+ Binop (" & ");
+
when Discrim_Val =>
- Write_Char ('#');
- UI_Write (Node.Op1);
+ Valop ("#");
when Dynamic_Val =>
- Write_Str ("Var");
- UI_Write (Node.Op1);
+ Valop ("var");
end case;
end;
end if;
@@ -844,6 +865,8 @@ package body Repinfo is
Write_Str ("'Alignment use ");
Write_Val (Alignment (Ent));
Write_Line (";");
+
+ List_Linker_Section (Ent);
end List_Object_Info;
----------------------
@@ -1168,6 +1191,8 @@ package body Repinfo is
Write_Line ("end record;");
List_Scalar_Storage_Order (Ent, Bytes_Big_Endian);
+
+ List_Linker_Section (Ent);
end List_Record_Info;
-------------------
@@ -1283,8 +1308,6 @@ package body Repinfo is
procedure List_Type_Info (Ent : Entity_Id) is
begin
- Blank_Line;
-
-- Do not list size info for unconstrained arrays, not meaningful
if Is_Array_Type (Ent) and then not Is_Constrained (Ent) then