OSDN Git Service

* config/xtensa/lib1funcs.asm (__udivsi3, __divsi3): Rearrange special
[pf3gnuchains/gcc-fork.git] / gcc / except.h
1 /* Exception Handling interface routines.
2    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
3    Free Software Foundation, Inc.
4    Contributed by Mike Stump <mrs@cygnus.com>.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, USA.  */
22
23
24 struct function;
25
26 /* Per-function EH data.  Used only in except.c, but GC and others
27    manipulate pointers to the opaque type.  */
28 struct eh_status;
29
30 /* Internal structure describing a region.  */
31 struct eh_region;
32
33 /* Test: is exception handling turned on?  */
34 extern int doing_eh (int);
35
36 /* Note that the current EH region (if any) may contain a throw, or a
37    call to a function which itself may contain a throw.  */
38 extern void note_eh_region_may_contain_throw (struct eh_region *);
39 extern void note_current_region_may_contain_throw (void);
40
41 /* Invokes CALLBACK for every exception handler label.  Only used by old
42    loop hackery; should not be used by new code.  */
43 extern void for_each_eh_label (void (*) (rtx));
44
45 /* Invokes CALLBACK for every exception region in the current function.  */
46 extern void for_each_eh_region (void (*) (struct eh_region *));
47
48 /* Determine if the given INSN can throw an exception.  */
49 extern bool can_throw_internal_1 (int);
50 extern bool can_throw_internal (rtx);
51 extern bool can_throw_external_1 (int);
52 extern bool can_throw_external (rtx);
53
54 /* Set TREE_NOTHROW and cfun->all_throwers_are_sibcalls.  */
55 extern void set_nothrow_function_flags (void);
56
57 /* After initial rtl generation, call back to finish generating
58    exception support code.  */
59 extern void finish_eh_generation (void);
60
61 extern void init_eh (void);
62 extern void init_eh_for_function (void);
63
64 extern rtx reachable_handlers (rtx);
65 extern void maybe_remove_eh_handler (rtx);
66
67 extern void convert_from_eh_region_ranges (void);
68 extern void convert_to_eh_region_ranges (void);
69 extern void find_exception_handler_labels (void);
70 extern bool current_function_has_exception_handlers (void);
71 extern void output_function_exception_table (void);
72
73 extern void expand_builtin_unwind_init (void);
74 extern rtx expand_builtin_eh_return_data_regno (tree);
75 extern rtx expand_builtin_extract_return_addr (tree);
76 extern void expand_builtin_init_dwarf_reg_sizes (tree);
77 extern rtx expand_builtin_frob_return_addr (tree);
78 extern rtx expand_builtin_dwarf_sp_column (void);
79 extern void expand_builtin_eh_return (tree, tree);
80 extern void expand_eh_return (void);
81 extern rtx expand_builtin_extend_pointer (tree);
82 extern rtx get_exception_pointer (struct function *);
83 extern rtx get_exception_filter (struct function *);
84
85 extern void sjlj_emit_function_exit_after (rtx);
86
87 extern struct eh_region *gen_eh_region_cleanup (struct eh_region *,
88                                                 struct eh_region *);
89 extern struct eh_region *gen_eh_region_try (struct eh_region *);
90 extern struct eh_region *gen_eh_region_catch (struct eh_region *, tree);
91 extern struct eh_region *gen_eh_region_allowed (struct eh_region *, tree);
92 extern struct eh_region *gen_eh_region_must_not_throw (struct eh_region *);
93 extern int get_eh_region_number (struct eh_region *);
94 extern bool get_eh_region_may_contain_throw (struct eh_region *);
95 extern tree get_eh_region_tree_label (struct eh_region *);
96 extern void set_eh_region_tree_label (struct eh_region *, tree);
97
98 extern void foreach_reachable_handler (int, bool,
99                                        void (*) (struct eh_region *, void *),
100                                        void *);
101
102 extern void collect_eh_region_array (void);
103 extern void expand_resx_expr (tree);
104 extern void verify_eh_tree (struct function *);
105 extern void dump_eh_tree (FILE *, struct function *);
106
107 /* tree-eh.c */
108 extern int lookup_stmt_eh_region (tree);
109 extern bool verify_eh_edges (tree);
110
111 /* If non-NULL, this is a function that returns an expression to be
112    executed if an unhandled exception is propagated out of a cleanup
113    region.  For example, in C++, an exception thrown by a destructor
114    during stack unwinding is required to result in a call to
115    `std::terminate', so the C++ version of this function returns a
116    CALL_EXPR for `std::terminate'.  */
117 extern tree (*lang_protect_cleanup_actions) (void);
118
119 /* Return true if type A catches type B.  */
120 extern int (*lang_eh_type_covers) (tree a, tree b);
121
122 /* Map a type to a runtime object to match type.  */
123 extern tree (*lang_eh_runtime_type) (tree);
124
125
126 /* Just because the user configured --with-sjlj-exceptions=no doesn't
127    mean that we can use call frame exceptions.  Detect that the target
128    has appropriate support.  */
129
130 #ifndef MUST_USE_SJLJ_EXCEPTIONS
131 # if !(defined (EH_RETURN_DATA_REGNO)                   \
132        && (defined (TARGET_UNWIND_INFO)                 \
133            || (DWARF2_UNWIND_INFO                       \
134                && (defined (EH_RETURN_HANDLER_RTX)      \
135                    || defined (HAVE_eh_return)))))
136 #  define MUST_USE_SJLJ_EXCEPTIONS      1
137 # else
138 #  define MUST_USE_SJLJ_EXCEPTIONS      0
139 # endif
140 #endif
141
142 #ifdef CONFIG_SJLJ_EXCEPTIONS
143 # if CONFIG_SJLJ_EXCEPTIONS == 1
144 #  define USING_SJLJ_EXCEPTIONS         1
145 # endif
146 # if CONFIG_SJLJ_EXCEPTIONS == 0
147 #  define USING_SJLJ_EXCEPTIONS         0
148 #  ifndef EH_RETURN_DATA_REGNO
149     #error "EH_RETURN_DATA_REGNO required"
150 #  endif
151 #  if !defined(EH_RETURN_HANDLER_RTX) && !defined(HAVE_eh_return)
152     #error "EH_RETURN_HANDLER_RTX or eh_return required"
153 #  endif
154 #  if !defined(DWARF2_UNWIND_INFO) && !defined(TARGET_UNWIND_INFO)
155     #error "{DWARF2,TARGET}_UNWIND_INFO required"
156 #  endif
157 # endif
158 #else
159 # define USING_SJLJ_EXCEPTIONS          MUST_USE_SJLJ_EXCEPTIONS
160 #endif