aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2021-02-12 02:54:07 -0500
committerArnaud Charlet <charlet@adacore.com>2021-02-12 08:53:41 -0500
commit3fbf81a252d7599b4e99b7c969ff164a2330bdb5 (patch)
treee1411dfdb4c2fa19fcb1c54b336c9356490d0d3f
parentf699e0b16578cdc1be8b90691ef8b0964af32d2f (diff)
downloadgcc-3fbf81a252d7599b4e99b7c969ff164a2330bdb5.zip
gcc-3fbf81a252d7599b4e99b7c969ff164a2330bdb5.tar.gz
gcc-3fbf81a252d7599b4e99b7c969ff164a2330bdb5.tar.bz2
[Ada] Remove unused subprograms (continued)
gcc/ada/ * repinfo.ads, repinfo.adb (*SO_Ref*): Restore.
-rw-r--r--gcc/ada/repinfo.adb49
-rw-r--r--gcc/ada/repinfo.ads58
2 files changed, 103 insertions, 4 deletions
diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index 61912ef..bfb8af3 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -92,6 +92,18 @@ package body Repinfo is
Table_Increment => Alloc.Rep_Table_Increment,
Table_Name => "BE_Rep_Table");
+ --------------------------------------------------------------
+ -- Representation of Front-End Dynamic Size/Offset Entities --
+ --------------------------------------------------------------
+
+ package Dynamic_SO_Entity_Table is new Table.Table (
+ Table_Component_Type => Entity_Id,
+ Table_Index_Type => Nat,
+ Table_Low_Bound => 1,
+ Table_Initial => Alloc.Rep_Table_Initial,
+ Table_Increment => Alloc.Rep_Table_Increment,
+ Table_Name => "FE_Rep_Table");
+
Unit_Casing : Casing_Type;
-- Identifier casing for current unit. This is set by List_Rep_Info for
-- each unit, before calling subprograms which may read it.
@@ -212,6 +224,16 @@ package body Repinfo is
Op1 => Discriminant_Number (Discr));
end Create_Discrim_Ref;
+ ---------------------------
+ -- Create_Dynamic_SO_Ref --
+ ---------------------------
+
+ function Create_Dynamic_SO_Ref (E : Entity_Id) return Dynamic_SO_Ref is
+ begin
+ Dynamic_SO_Entity_Table.Append (E);
+ return UI_From_Int (-Dynamic_SO_Entity_Table.Last);
+ end Create_Dynamic_SO_Ref;
+
-----------------
-- Create_Node --
-----------------
@@ -240,6 +262,33 @@ package body Repinfo is
return Entity_Header_Num (Id mod Relevant_Entities_Size);
end Entity_Hash;
+ ---------------------------
+ -- Get_Dynamic_SO_Entity --
+ ---------------------------
+
+ function Get_Dynamic_SO_Entity (U : Dynamic_SO_Ref) return Entity_Id is
+ begin
+ return Dynamic_SO_Entity_Table.Table (-UI_To_Int (U));
+ end Get_Dynamic_SO_Entity;
+
+ -----------------------
+ -- Is_Dynamic_SO_Ref --
+ -----------------------
+
+ function Is_Dynamic_SO_Ref (U : SO_Ref) return Boolean is
+ begin
+ return U < Uint_0;
+ end Is_Dynamic_SO_Ref;
+
+ ----------------------
+ -- Is_Static_SO_Ref --
+ ----------------------
+
+ function Is_Static_SO_Ref (U : SO_Ref) return Boolean is
+ begin
+ return U >= Uint_0;
+ end Is_Static_SO_Ref;
+
---------
-- lgx --
---------
diff --git a/gcc/ada/repinfo.ads b/gcc/ada/repinfo.ads
index f730c53..a2ab832 100644
--- a/gcc/ada/repinfo.ads
+++ b/gcc/ada/repinfo.ads
@@ -51,10 +51,10 @@ package Repinfo is
-- for example in the case where representation clauses or
-- pragmas specify the values.
- -- 2. Otherwise the backend is responsible for layout of all types and
- -- objects not laid out by the front end. This includes all dynamic
- -- values, and also static values (e.g. record sizes) when not set by
- -- the front end.
+ -- 2. The backend is responsible for layout of all types and objects
+ -- not laid out by the front end. This includes all dynamic values,
+ -- and also static values (e.g. record sizes) when not set by the
+ -- front end.
-----------------------------
-- Back Annotation by Gigi --
@@ -291,6 +291,56 @@ package Repinfo is
function Create_Discrim_Ref (Discr : Entity_Id) return Node_Ref;
-- Creates a reference to the discriminant whose entity is Discr
+ --------------------------------------------------------
+ -- Front-End Interface for Dynamic Size/Offset Values --
+ --------------------------------------------------------
+
+ -- This interface is used by GNAT LLVM to deal with all dynamic size and
+ -- offset fields.
+
+ -- The interface here allows these created entities to be referenced
+ -- using negative Unit values, so that they can be stored in the
+ -- appropriate size and offset fields in the tree.
+
+ -- In the case of components, if the location of the component is static,
+ -- then all four fields (Component_Bit_Offset, Normalized_Position, Esize,
+ -- and Normalized_First_Bit) are set to appropriate values. In the case of
+ -- a non-static component location, Component_Bit_Offset is not used and
+ -- is left set to Unknown. Normalized_Position and Normalized_First_Bit
+ -- are set appropriately.
+
+ subtype SO_Ref is Uint;
+ -- Type used to represent a Uint value that represents a static or
+ -- dynamic size/offset value (non-negative if static, negative if
+ -- the size value is dynamic).
+
+ subtype Dynamic_SO_Ref is Uint;
+ -- Type used to represent a negative Uint value used to store
+ -- a dynamic size/offset value.
+
+ function Is_Dynamic_SO_Ref (U : SO_Ref) return Boolean;
+ pragma Inline (Is_Dynamic_SO_Ref);
+ -- Given a SO_Ref (Uint) value, returns True iff the SO_Ref value
+ -- represents a dynamic Size/Offset value (i.e. it is negative).
+
+ function Is_Static_SO_Ref (U : SO_Ref) return Boolean;
+ pragma Inline (Is_Static_SO_Ref);
+ -- Given a SO_Ref (Uint) value, returns True iff the SO_Ref value
+ -- represents a static Size/Offset value (i.e. it is non-negative).
+
+ function Create_Dynamic_SO_Ref (E : Entity_Id) return Dynamic_SO_Ref;
+ -- Given the Entity_Id for a constant (case 1), the Node_Id for an
+ -- expression (case 2), or the Entity_Id for a function (case 3),
+ -- this function returns a (negative) Uint value that can be used
+ -- to retrieve the entity or expression for later use.
+
+ function Get_Dynamic_SO_Entity (U : Dynamic_SO_Ref) return Entity_Id;
+ -- Retrieve the Node_Id or Entity_Id stored by a previous call to
+ -- Create_Dynamic_SO_Ref. The approach is that the front end makes
+ -- the necessary Create_Dynamic_SO_Ref calls to associate the node
+ -- and entity id values and the back end makes Get_Dynamic_SO_Ref
+ -- calls to retrieve them.
+
------------------------------
-- External tools Interface --
------------------------------