1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
10 -- Copyright (C) 1992-2000 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 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 ------------------------------------------------------------------------------
28 -- Expand routines for chapter 11 constructs
30 with Types
; use Types
;
33 procedure Expand_N_Exception_Declaration
(N
: Node_Id
);
34 procedure Expand_N_Handled_Sequence_Of_Statements
(N
: Node_Id
);
35 procedure Expand_N_Raise_Constraint_Error
(N
: Node_Id
);
36 procedure Expand_N_Raise_Program_Error
(N
: Node_Id
);
37 procedure Expand_N_Raise_Statement
(N
: Node_Id
);
38 procedure Expand_N_Raise_Storage_Error
(N
: Node_Id
);
39 procedure Expand_N_Subprogram_Info
(N
: Node_Id
);
41 -- Data structures for gathering information to build exception tables
42 -- See runtime routine Ada.Exceptions for full details on the format and
43 -- content of these tables.
46 -- Initializes these data structures for a new main unit file
48 procedure Expand_At_End_Handler
(HSS
: Node_Id
; Block
: Node_Id
);
49 -- Given a handled statement sequence, HSS, for which the At_End_Proc
50 -- field is set, and which currently has no exception handlers, this
51 -- procedure expands the special exception handler required.
52 -- This procedure also create a new scope for the given Block, if
53 -- Block is not Empty.
55 procedure Expand_Exception_Handlers
(HSS
: Node_Id
);
56 -- This procedure expands exception handlers, and is called as part
57 -- of the processing for Expand_N_Handled_Sequence_Of_Statements and
58 -- is also called from Expand_At_End_Handler. N is the handled sequence
59 -- of statements that has the exception handler(s) to be expanded. This
60 -- is also called to expand the special exception handler built for
61 -- accept bodies (see Exp_Ch9.Build_Accept_Body).
63 procedure Generate_Unit_Exception_Table
;
64 -- Procedure called by main driver to generate unit exception table if
65 -- zero cost exceptions are enabled. See System.Exceptions for details.
67 function Is_Non_Ada_Error
(E
: Entity_Id
) return Boolean;
68 -- This function is provided for Gigi use. It returns True if operating on
69 -- VMS, and the argument E is the entity for System.Aux_Dec.Non_Ada_Error.
70 -- This is used to generate the special matching code for this exception.
72 procedure Remove_Handler_Entries
(N
: Node_Id
);
73 -- This procedure is called when optimization circuits determine that
74 -- an entire subtree can be removed. If the subtree contains handler
75 -- entries in zero cost exception mode, then such removal can lead to
76 -- dangling references to non-existent handlers in the handler table.
77 -- This procedure removes such references.
79 --------------------------------------
80 -- Subprogram_Descriptor Generation --
81 --------------------------------------
83 -- Subprogram descriptors are required for all subprograms, including
84 -- explicit subprograms defined in the program, subprograms that are
85 -- imported via pragma Import, and also for the implicit elaboration
86 -- subprograms used to elaborate package specs and bodies.
88 procedure Generate_Subprogram_Descriptor_For_Package
91 -- This is used to create a descriptor for the implicit elaboration
92 -- procedure for a package spec of body. The compiler only generates
93 -- such descriptors if the package spec or body contains exception
94 -- handlers (either explicitly in the case of a body, or from generic
95 -- package instantiations). N is the node for the package body or
96 -- spec, and Spec is the package body or package entity respectively.
97 -- N must be a compilation unit, and the descriptor is placed at
98 -- the end of the actions for the auxiliary compilation unit node.
100 procedure Generate_Subprogram_Descriptor_For_Subprogram
103 -- This is used to create a desriptor for a subprogram, both those
104 -- present in the source, and those implicitly generated by code
105 -- expansion. N is the subprogram body node, and Spec is the entity
106 -- for the subprogram. The descriptor is placed at the end of the
107 -- Last exception handler, or, if there are no handlers, at the end
108 -- of the statement sequence.
110 procedure Generate_Subprogram_Descriptor_For_Imported_Subprogram
113 -- This is used to create a descriptor for an imported subprogram.
114 -- Such descriptors are needed for propagation of exceptions through
115 -- such subprograms. The descriptor never references any handlers,
116 -- and is appended to the given Slist.