]> gcc.gnu.org Git - gcc.git/blame - gcc/except.h
Initial revision
[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
41 START_LABEL is the label corresponding to the start of the region.
42
43 END_LABEL is the label corresponding to the end of the region.
44
45 EXCEPTION_HANDLER_LABEL is the label corresponding to the handler
46 for this region.
47
48 FINALIZATION is the tree codes for the handler, or is NULL_TREE if
49 one hasn't been generated yet, or is integer_zero_node to mark the
50 end of a group of try blocks. */
51
4956d07c
MS
52struct eh_entry {
53 rtx start_label;
54 rtx end_label;
55 rtx exception_handler_label;
56
57 tree finalization;
58};
59
911fdd58
RK
60/* A list of EH_ENTRYs. ENTRY is the entry; CHAIN points to the next
61 entry in the list, or is NULL if this is the last entry. */
62
4956d07c
MS
63struct eh_node {
64 struct eh_entry *entry;
65 struct eh_node *chain;
66};
67
911fdd58
RK
68/* A stack of EH_ENTRYs. TOP is the topmost entry on the stack. TOP is
69 NULL if the stack is empty. */
70
4956d07c
MS
71struct eh_stack {
72 struct eh_node *top;
73};
74
911fdd58
RK
75/* A queue of EH_ENTRYs. HEAD is the front of the queue; TAIL is the
76 end (the latest entry). HEAD and TAIL are NULL if the queue is
77 empty. */
78
4956d07c
MS
79struct eh_queue {
80 struct eh_node *head;
81 struct eh_node *tail;
82};
83
84
911fdd58
RK
85extern void expand_eh_region_start PROTO((void));
86
87extern void expand_eh_region_end PROTO((tree));
88
89/* Push RLABEL or TLABEL onto LABELSTACK. Only one of RLABEL or TLABEL
90 should be set; the other must be NULL. */
91
4956d07c 92extern void push_label_entry PROTO((struct label_node **labelstack, rtx rlabel, tree tlabel));
911fdd58
RK
93
94/* Pop the topmost entry from LABELSTACK and return its value as an
95 rtx node. If LABELSTACK is empty, return NULL. */
96
4956d07c 97extern rtx pop_label_entry PROTO((struct label_node **labelstack));
911fdd58
RK
98
99/* Return the topmost entry of LABELSTACK as a tree node, or return
100 NULL_TREE if LABELSTACK is empty. */
101
4956d07c
MS
102extern tree top_label_entry PROTO((struct label_node **labelstack));
103
911fdd58
RK
104/* The stack used to keep track of the exception region corresponding to
105 the current instruction. */
106
4956d07c 107extern struct eh_stack ehstack;
911fdd58
RK
108
109/* A queue used to track closed exception regions whose handlers have
110 not been emitted yet. */
111
4956d07c 112extern struct eh_queue ehqueue;
911fdd58
RK
113
114/* A set of insns for the catch clauses in the current function. They
115 will be emitted at the end of the current function. */
116
4956d07c 117extern rtx catch_clauses;
4956d07c
MS
118
119#endif
120
121struct function;
122
911fdd58
RK
123/* Toplevel initialization for EH. */
124
4956d07c 125extern void init_eh PROTO((void));
911fdd58
RK
126
127/* Initialization for the per-function EH data. */
128
4956d07c 129extern void init_eh_for_function PROTO((void));
911fdd58
RK
130
131/* Saves the current per-function EH data into P. */
132
4956d07c 133extern void save_eh_status PROTO((struct function *p));
911fdd58
RK
134
135/* Restores the per-function EH data from P. */
136
4956d07c 137extern void restore_eh_status PROTO((struct function *p));
911fdd58
RK
138
139/* Adds an EH table entry for EH entry number N. Called from
140 final_scan_insn for NOTE_INSN_EH_REGION_BEG. */
141
142extern void add_eh_table_entry PROTO((int n));
143
144/* Returns a non-zero value if we need to output an exception table. */
145
4956d07c 146extern int exception_table_p PROTO((void));
911fdd58
RK
147
148/* Outputs the exception table if we have one. */
149
4956d07c 150extern void output_exception_table PROTO((void));
911fdd58
RK
151
152/* Given a return address in ADDR, determine the address we should use
153 to find the corresponding EH region. */
154
155extern rtx eh_outer_context PROTO((rtx addr));
156
157/* Called at the start of a block of try statements for which there is
158 a supplied catch handler. */
159
160extern void expand_start_try_stmts PROTO((void));
161
162/* Called at the start of a block of catch statements. It terminates the
163 previous set of try statements. */
164
165extern void expand_start_all_catch PROTO((void));
166
167/* Called at the end of a block of catch statements. */
168
169extern void expand_end_all_catch PROTO((void));
170
171#ifdef TREE_CODE
172/* Create a new exception region and add the handler for the region
173 onto a list. These regions will be ended (and their handlers
174 emitted) when end_protect_partials is invoked. */
175
176extern void add_partial_entry PROTO((tree handler));
177#endif
178
179/* End all of the pending exception regions that have handlers added with
180 push_protect_entry (). */
181
182extern void end_protect_partials PROTO((void));
183
184/* An internal throw with a direct CONTEXT we want to throw
185 from. CONTEXT must be a label. */
186
187extern void expand_internal_throw PROTO((rtx context));
188
189/* Called from expand_exception_blocks and expand_end_catch_block to
190 expand and pending handlers. */
191
192extern void expand_leftover_cleanups PROTO((void));
193
194/* If necessary, emit insns for the start of per-function unwinder for
195 the current function. */
196
4956d07c 197extern void emit_unwinder PROTO((void));
911fdd58
RK
198
199/* If necessary, emit insns for the end of the per-function unwinder
200 for the current function. */
201
4956d07c 202extern void end_eh_unwinder PROTO((void));
4956d07c 203
911fdd58
RK
204/* Builds a list of handler labels and puts them in the global
205 variable exception_handler_labels. */
206
207extern void find_exception_handler_labels PROTO((void));
208
209/* Performs sanity checking on the check_exception_handler_labels
210 list. */
211
212extern void check_exception_handler_labels PROTO((void));
213
214/* A stack used to keep track of the label used to resume normal program
215 flow out of the current exception handler region. */
4956d07c
MS
216
217extern struct label_node *caught_return_label_stack;
911fdd58
RK
218
219/* A random area used for purposes elsewhere. */
220
4956d07c
MS
221extern struct label_node *false_label_stack;
222
911fdd58
RK
223/* A list of labels used for exception handlers. It is created by
224 find_exception_handler_labels for the optimization passes. */
225
4956d07c
MS
226extern rtx exception_handler_labels;
227
228/* The rtx for the saved PC value. */
229
230extern rtx eh_saved_pc_rtx;
231
911fdd58
RK
232/* Performs optimizations for exception handling, such as removing
233 unnecessary exception regions. Invoked from jump_optimize (). */
234
4956d07c 235extern void exception_optimize PROTO((void));
This page took 0.122753 seconds and 5 git commands to generate.