]> gcc.gnu.org Git - gcc.git/blame - gcc/except.h
Makefile.in (install): Some of HEADERS come from the stl dir now.
[gcc.git] / gcc / except.h
CommitLineData
4956d07c
MS
1/* Exception Handling interface routines.
2 Copyright (C) 1996 Free Software Foundation, Inc.
3 Contributed by Mike Stump <mrs@cygnus.com>.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22
23#ifndef GET_CODE
24#define rtx int *
25#endif
26
27#ifdef TREE_CODE
28
911fdd58
RK
29/* A stack of labels. CHAIN points to the next entry in the stack. */
30
4956d07c
MS
31struct label_node {
32 union {
33 rtx rlabel;
34 tree tlabel;
35 } u;
36 struct label_node *chain;
37};
38
911fdd58
RK
39/* An eh_entry is used to describe one exception handling region.
40
478b0752 41 OUTER_CONTEXT is the label used for rethrowing into the outer context.
911fdd58
RK
42
43 EXCEPTION_HANDLER_LABEL is the label corresponding to the handler
44 for this region.
45
46 FINALIZATION is the tree codes for the handler, or is NULL_TREE if
47 one hasn't been generated yet, or is integer_zero_node to mark the
48 end of a group of try blocks. */
49
4956d07c 50struct eh_entry {
478b0752 51 rtx outer_context;
4956d07c
MS
52 rtx exception_handler_label;
53
54 tree finalization;
55};
56
911fdd58
RK
57/* A list of EH_ENTRYs. ENTRY is the entry; CHAIN points to the next
58 entry in the list, or is NULL if this is the last entry. */
59
4956d07c
MS
60struct eh_node {
61 struct eh_entry *entry;
62 struct eh_node *chain;
63};
64
911fdd58
RK
65/* A stack of EH_ENTRYs. TOP is the topmost entry on the stack. TOP is
66 NULL if the stack is empty. */
67
4956d07c
MS
68struct eh_stack {
69 struct eh_node *top;
70};
71
911fdd58
RK
72/* A queue of EH_ENTRYs. HEAD is the front of the queue; TAIL is the
73 end (the latest entry). HEAD and TAIL are NULL if the queue is
74 empty. */
75
4956d07c
MS
76struct eh_queue {
77 struct eh_node *head;
78 struct eh_node *tail;
79};
80
81
e976b8b2
MS
82/* Start an exception handling region. All instructions emitted after
83 this point are considered to be part of the region until
84 expand_eh_region_end () is invoked. */
85
911fdd58
RK
86extern void expand_eh_region_start PROTO((void));
87
4c581243
MS
88/* Just like expand_eh_region_start, except if a cleanup action is
89 entered on the cleanup chain, the TREE_PURPOSE of the element put
90 on the chain is DECL. DECL should be the associated VAR_DECL, if
91 any, otherwise it should be NULL_TREE. */
92
93extern void expand_eh_region_start_for_decl PROTO((tree));
94
e976b8b2
MS
95/* Start an exception handling region for the given cleanup action.
96 All instructions emitted after this point are considered to be part
97 of the region until expand_eh_region_end () is invoked. CLEANUP is
98 the cleanup action to perform. The return value is true if the
99 exception region was optimized away. If that case,
100 expand_eh_region_end does not need to be called for this cleanup,
101 nor should it be.
102
103 This routine notices one particular common case in C++ code
104 generation, and optimizes it so as to not need the exception
105 region. */
106
4c581243 107extern int expand_eh_region_start_tree PROTO((tree, tree));
e976b8b2
MS
108
109/* End an exception handling region. The information about the region
110 is found on the top of ehstack.
111
112 HANDLER is either the cleanup for the exception region, or if we're
113 marking the end of a try block, HANDLER is integer_zero_node.
114
115 HANDLER will be transformed to rtl when expand_leftover_cleanups ()
116 is invoked. */
117
911fdd58
RK
118extern void expand_eh_region_end PROTO((tree));
119
120/* Push RLABEL or TLABEL onto LABELSTACK. Only one of RLABEL or TLABEL
121 should be set; the other must be NULL. */
122
4956d07c 123extern void push_label_entry PROTO((struct label_node **labelstack, rtx rlabel, tree tlabel));
911fdd58
RK
124
125/* Pop the topmost entry from LABELSTACK and return its value as an
126 rtx node. If LABELSTACK is empty, return NULL. */
127
4956d07c 128extern rtx pop_label_entry PROTO((struct label_node **labelstack));
911fdd58
RK
129
130/* Return the topmost entry of LABELSTACK as a tree node, or return
131 NULL_TREE if LABELSTACK is empty. */
132
4956d07c
MS
133extern tree top_label_entry PROTO((struct label_node **labelstack));
134
911fdd58
RK
135/* A set of insns for the catch clauses in the current function. They
136 will be emitted at the end of the current function. */
137
4956d07c 138extern rtx catch_clauses;
4956d07c
MS
139
140#endif
141
142struct function;
143
911fdd58
RK
144/* Toplevel initialization for EH. */
145
4956d07c 146extern void init_eh PROTO((void));
911fdd58
RK
147
148/* Initialization for the per-function EH data. */
149
4956d07c 150extern void init_eh_for_function PROTO((void));
911fdd58
RK
151
152/* Saves the current per-function EH data into P. */
153
4956d07c 154extern void save_eh_status PROTO((struct function *p));
911fdd58
RK
155
156/* Restores the per-function EH data from P. */
157
4956d07c 158extern void restore_eh_status PROTO((struct function *p));
911fdd58
RK
159
160/* Adds an EH table entry for EH entry number N. Called from
161 final_scan_insn for NOTE_INSN_EH_REGION_BEG. */
162
163extern void add_eh_table_entry PROTO((int n));
164
165/* Returns a non-zero value if we need to output an exception table. */
166
4956d07c 167extern int exception_table_p PROTO((void));
911fdd58
RK
168
169/* Outputs the exception table if we have one. */
170
4956d07c 171extern void output_exception_table PROTO((void));
911fdd58
RK
172
173/* Given a return address in ADDR, determine the address we should use
174 to find the corresponding EH region. */
175
176extern rtx eh_outer_context PROTO((rtx addr));
177
178/* Called at the start of a block of try statements for which there is
179 a supplied catch handler. */
180
181extern void expand_start_try_stmts PROTO((void));
182
183/* Called at the start of a block of catch statements. It terminates the
184 previous set of try statements. */
185
186extern void expand_start_all_catch PROTO((void));
187
188/* Called at the end of a block of catch statements. */
189
190extern void expand_end_all_catch PROTO((void));
191
192#ifdef TREE_CODE
193/* Create a new exception region and add the handler for the region
194 onto a list. These regions will be ended (and their handlers
195 emitted) when end_protect_partials is invoked. */
196
197extern void add_partial_entry PROTO((tree handler));
198#endif
199
200/* End all of the pending exception regions that have handlers added with
201 push_protect_entry (). */
202
203extern void end_protect_partials PROTO((void));
204
205/* An internal throw with a direct CONTEXT we want to throw
206 from. CONTEXT must be a label. */
207
208extern void expand_internal_throw PROTO((rtx context));
209
210/* Called from expand_exception_blocks and expand_end_catch_block to
211 expand and pending handlers. */
212
213extern void expand_leftover_cleanups PROTO((void));
214
215/* If necessary, emit insns for the start of per-function unwinder for
216 the current function. */
217
4956d07c 218extern void emit_unwinder PROTO((void));
911fdd58
RK
219
220/* If necessary, emit insns for the end of the per-function unwinder
221 for the current function. */
222
4956d07c 223extern void end_eh_unwinder PROTO((void));
4956d07c 224
911fdd58
RK
225/* Builds a list of handler labels and puts them in the global
226 variable exception_handler_labels. */
227
228extern void find_exception_handler_labels PROTO((void));
229
230/* Performs sanity checking on the check_exception_handler_labels
231 list. */
232
233extern void check_exception_handler_labels PROTO((void));
234
235/* A stack used to keep track of the label used to resume normal program
236 flow out of the current exception handler region. */
4956d07c
MS
237
238extern struct label_node *caught_return_label_stack;
911fdd58
RK
239
240/* A random area used for purposes elsewhere. */
241
4956d07c
MS
242extern struct label_node *false_label_stack;
243
911fdd58
RK
244/* A list of labels used for exception handlers. It is created by
245 find_exception_handler_labels for the optimization passes. */
246
4956d07c
MS
247extern rtx exception_handler_labels;
248
249/* The rtx for the saved PC value. */
250
251extern rtx eh_saved_pc_rtx;
252
911fdd58
RK
253/* Performs optimizations for exception handling, such as removing
254 unnecessary exception regions. Invoked from jump_optimize (). */
255
4956d07c 256extern void exception_optimize PROTO((void));
e976b8b2
MS
257
258/* Get the dynamic handler chain. */
259extern rtx get_dynamic_handler_chain PROTO((void));
260
261/* Get the dynamic cleanup chain. */
262extern rtx get_dynamic_cleanup_chain PROTO((void));
263
264/* Throw an exception. */
265
266extern void emit_throw PROTO((void));
267
268/* One to use setjmp/longjmp method of generating code. */
269
270extern int exceptions_via_longjmp;
271
272/* One to enable asynchronous exception support. */
273
274extern int asynchronous_exceptions;
275
276/* One to protect cleanup actions with a handler that calls
277 __terminate, zero otherwise. */
278
279extern int protect_cleanup_actions_with_terminate;
280
281#ifdef TREE_CODE
282extern tree protect_with_terminate PROTO((tree));
283#endif
0021b564
JM
284
285/* Various hooks for the DWARF 2 __throw routine. */
286
287void expand_builtin_unwind_init PROTO((void));
288rtx expand_builtin_dwarf_fp_regnum PROTO((void));
289rtx expand_builtin_eh_stub PROTO((void));
290#ifdef TREE_CODE
291rtx expand_builtin_frob_return_addr PROTO((tree));
292rtx expand_builtin_extract_return_addr PROTO((tree));
293void expand_builtin_set_return_addr_reg PROTO((tree));
294void expand_builtin_set_eh_regs PROTO((tree, tree));
2f3ca9e7 295rtx expand_builtin_dwarf_reg_size PROTO((tree, rtx));
0021b564 296#endif
This page took 0.122832 seconds and 5 git commands to generate.