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