1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 2000-2001 Free Software Foundation, Inc. --
13 -- GNAT is free software; you can redistribute it and/or modify it under --
14 -- terms of the GNU General Public License as published by the Free Soft- --
15 -- ware Foundation; either version 2, or (at your option) any later ver- --
16 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
19 -- for more details. You should have received a copy of the GNU General --
20 -- Public License distributed with GNAT; see file COPYING. If not, write --
21 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
22 -- MA 02111-1307, USA. --
24 -- GNAT was originally developed by the GNAT team at New York University. --
25 -- Extensive contributions were provided by Ada Core Technologies Inc. --
27 ------------------------------------------------------------------------------
29 -- This package does front-end layout of types and objects. The result is
30 -- to annotate the tree with information on size and alignment of types
31 -- and objects. How much layout is performed depends on the setting of the
32 -- target dependent parameter Backend_Layout.
34 with Types
; use Types
;
38 -- The following procedures are called from Freeze, so all entities
39 -- for types and objects that get frozen (which should be all such
40 -- entities which are seen by the back end) will get layed out by one
41 -- of these two procedures.
43 procedure Layout_Type
(E
: Entity_Id
);
44 -- This procedure may set or adjust the fields Esize, RM_Size and
45 -- Alignment in the non-generic type or subtype entity E. If the
46 -- Backend_Layout switch is False, then it is guaranteed that all
47 -- three fields will be properly set on return. Regardless of the
48 -- Backend_Layout value, it is guaranteed that all discrete types
49 -- will have both Esize and RM_Size fields set on return (since
50 -- these are static values). Note that Layout_Type is not called
51 -- for generic types, since these play no part in code generation,
52 -- and hence representation aspects are irrelevant.
54 procedure Layout_Object
(E
: Entity_Id
);
55 -- E is either a variable (E_Variable), a constant (E_Constant),
56 -- a loop parameter (E_Loop_Parameter), or a formal parameter of
57 -- a non-generic subprogram (E_In_Parameter, E_In_Out_Parameter,
58 -- or E_Out_Parameter). This procedure may set or adjust the
59 -- Esize and Alignment fields of E. If Backend_Layout is False,
60 -- then it is guaranteed that both fields will be properly set
61 -- on return. If the Esize is still unknown in the latter case,
62 -- it means that the object must be allocated dynamically, since
63 -- its length is not known at compile time.
65 procedure Set_Discrete_RM_Size
(Def_Id
: Entity_Id
);
66 -- Set proper RM_Size for discrete size, this is normally the minimum
67 -- number of bits to accommodate the range given, except in the case
68 -- where the subtype statically matches the first subtype, in which
69 -- case the size must be copied from the first subtype. For generic
70 -- types, the RM_Size is simply set to zero. This routine also sets
71 -- the Is_Constrained flag in Def_Id.
73 procedure Set_Prim_Alignment
(E
: Entity_Id
);
74 -- The front end always sets alignments for primitive types by calling this
75 -- procedure. Note that we have to do this for discrete types (since the
76 -- Alignment attribute is static), so we might as well do it for all
77 -- scalar types, since the processing is the same.