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