2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / ada / exp_ch11.ads
blob080d91532af17d00e137685808971ac7082c4f69
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- E X P _ C H 1 1 --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2000 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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- Expand routines for chapter 11 constructs
29 with Types; use Types;
31 package Exp_Ch11 is
32 procedure Expand_N_Exception_Declaration (N : Node_Id);
33 procedure Expand_N_Handled_Sequence_Of_Statements (N : Node_Id);
34 procedure Expand_N_Raise_Constraint_Error (N : Node_Id);
35 procedure Expand_N_Raise_Program_Error (N : Node_Id);
36 procedure Expand_N_Raise_Statement (N : Node_Id);
37 procedure Expand_N_Raise_Storage_Error (N : Node_Id);
38 procedure Expand_N_Subprogram_Info (N : Node_Id);
40 -- Data structures for gathering information to build exception tables
41 -- See runtime routine Ada.Exceptions for full details on the format and
42 -- content of these tables.
44 procedure Initialize;
45 -- Initializes these data structures for a new main unit file
47 procedure Expand_At_End_Handler (HSS : Node_Id; Block : Node_Id);
48 -- Given a handled statement sequence, HSS, for which the At_End_Proc
49 -- field is set, and which currently has no exception handlers, this
50 -- procedure expands the special exception handler required.
51 -- This procedure also create a new scope for the given Block, if
52 -- Block is not Empty.
54 procedure Expand_Exception_Handlers (HSS : Node_Id);
55 -- This procedure expands exception handlers, and is called as part
56 -- of the processing for Expand_N_Handled_Sequence_Of_Statements and
57 -- is also called from Expand_At_End_Handler. N is the handled sequence
58 -- of statements that has the exception handler(s) to be expanded. This
59 -- is also called to expand the special exception handler built for
60 -- accept bodies (see Exp_Ch9.Build_Accept_Body).
62 procedure Generate_Unit_Exception_Table;
63 -- Procedure called by main driver to generate unit exception table if
64 -- zero cost exceptions are enabled. See System.Exceptions for details.
66 function Is_Non_Ada_Error (E : Entity_Id) return Boolean;
67 -- This function is provided for Gigi use. It returns True if operating on
68 -- VMS, and the argument E is the entity for System.Aux_Dec.Non_Ada_Error.
69 -- This is used to generate the special matching code for this exception.
71 procedure Remove_Handler_Entries (N : Node_Id);
72 -- This procedure is called when optimization circuits determine that
73 -- an entire subtree can be removed. If the subtree contains handler
74 -- entries in zero cost exception mode, then such removal can lead to
75 -- dangling references to non-existent handlers in the handler table.
76 -- This procedure removes such references.
78 --------------------------------------
79 -- Subprogram_Descriptor Generation --
80 --------------------------------------
82 -- Subprogram descriptors are required for all subprograms, including
83 -- explicit subprograms defined in the program, subprograms that are
84 -- imported via pragma Import, and also for the implicit elaboration
85 -- subprograms used to elaborate package specs and bodies.
87 procedure Generate_Subprogram_Descriptor_For_Package
88 (N : Node_Id;
89 Spec : Entity_Id);
90 -- This is used to create a descriptor for the implicit elaboration
91 -- procedure for a package spec of body. The compiler only generates
92 -- such descriptors if the package spec or body contains exception
93 -- handlers (either explicitly in the case of a body, or from generic
94 -- package instantiations). N is the node for the package body or
95 -- spec, and Spec is the package body or package entity respectively.
96 -- N must be a compilation unit, and the descriptor is placed at
97 -- the end of the actions for the auxiliary compilation unit node.
99 procedure Generate_Subprogram_Descriptor_For_Subprogram
100 (N : Node_Id;
101 Spec : Entity_Id);
102 -- This is used to create a desriptor for a subprogram, both those
103 -- present in the source, and those implicitly generated by code
104 -- expansion. N is the subprogram body node, and Spec is the entity
105 -- for the subprogram. The descriptor is placed at the end of the
106 -- Last exception handler, or, if there are no handlers, at the end
107 -- of the statement sequence.
109 procedure Generate_Subprogram_Descriptor_For_Imported_Subprogram
110 (Spec : Entity_Id;
111 Slist : List_Id);
112 -- This is used to create a descriptor for an imported subprogram.
113 -- Such descriptors are needed for propagation of exceptions through
114 -- such subprograms. The descriptor never references any handlers,
115 -- and is appended to the given Slist.
117 end Exp_Ch11;