Fix memory barrier patterns for pre PA8800 processors
[official-gcc.git] / gcc / ada / exp_imgv.ads
blob85d3b93863bf17fdc624307a5ee17065d7f23823
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- E X P _ I M G V --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2000-2023, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 -- Expand routines for Image, Value and Width attributes. These are the
27 -- attributes that make use of enumeration type image tables.
29 with Types; use Types;
31 package Exp_Imgv is
33 procedure Build_Enumeration_Image_Tables (E : Entity_Id; N : Node_Id);
34 -- Build the enumeration image tables for E, which is an enumeration
35 -- base type. The node N is the point in the tree where the resulting
36 -- declarations are to be inserted.
38 -- The form of the tables generated is as follows:
40 -- xxxS : constant string (1 .. M) := "chars";
41 -- xxxN : constant array (0 .. N) of Index_Type := (i1, i2, .., iN, j);
43 -- Here xxxS is a string obtained by concatenating all the names of the
44 -- enumeration literals in sequence, representing any wide characters
45 -- according to the current wide character encoding method, and with all
46 -- letters forced to upper case.
48 -- The array xxxN is an array of indexes into xxxS pointing to the start
49 -- of each name, with one extra entry at the end, which is the index to
50 -- the character just past the end of the last literal, i.e. it is the
51 -- length of xxxS + 1. The element type is the shortest of the possible
52 -- types that will hold all the values.
54 -- For example, for the type
56 -- type x is (hello,'!',goodbye);
58 -- the generated tables would consist of
60 -- xxxS : constant string (1 .. 15) := "hello'!'goodbye";
61 -- xxxN : constant array (0 .. 3) of Integer_8 := (1, 6, 9, 16);
63 -- Here Integer_8 is used since 16 < 2**(8-1).
65 -- If the entity E needs the tables, the necessary declarations are built
66 -- and the fields Lit_Strings and Lit_Indexes of E are set to point to the
67 -- corresponding entities. If no tables are needed (E is not a user defined
68 -- enumeration root type, or pragma Discard_Names is in effect), then the
69 -- declarations are not constructed and the fields remain Empty.
71 -- If the number of enumeration literals is large enough, a (perfect) hash
72 -- function mapping the literals to their position number is also built and
73 -- requires additional tables. See the System.Perfect_Hash_Generators unit
74 -- for a complete description of this processing.
76 procedure Expand_Image_Attribute (N : Node_Id);
77 -- This procedure is called from Exp_Attr to expand an occurrence of the
78 -- attribute Image.
80 procedure Expand_Wide_Image_Attribute (N : Node_Id);
81 -- This procedure is called from Exp_Attr to expand an occurrence of the
82 -- attribute Wide_Image.
84 procedure Expand_Wide_Wide_Image_Attribute (N : Node_Id);
85 -- This procedure is called from Exp_Attr to expand an occurrence of the
86 -- attribute Wide_Wide_Image.
88 procedure Expand_Valid_Value_Attribute (N : Node_Id);
89 -- This procedure is called from Exp_Attr to expand an occurrence of the
90 -- attribute Valid_Value.
92 procedure Expand_Value_Attribute (N : Node_Id);
93 -- This procedure is called from Exp_Attr to expand an occurrence of the
94 -- attribute Value.
96 type Atype is (Normal, Wide, Wide_Wide);
97 -- Type of attribute in call to Expand_Width_Attribute
99 procedure Expand_Width_Attribute (N : Node_Id; Attr : Atype := Normal);
100 -- This procedure is called from Exp_Attr to expand an occurrence of the
101 -- attributes Width (Attr = Normal), or Wide_Width (Attr Wide), or
102 -- Wide_Wide_Width (Attr = Wide_Wide).
104 end Exp_Imgv;