Backport of GC branch patches part 1: kill eh status saving.
[gcc.git] / gcc / function.h
1 /* Structure for saving state for a nested function.
2 Copyright (C) 1989, 92-97, 1998 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20
21
22 #if !defined(NULL_TREE) && !defined(tree)
23 typedef union union_node *_function_tree;
24 #define tree _function_tree
25 #endif
26 #if !defined(NULL_RTX) && !defined(rtx)
27 typedef struct rtx_def *_function_rtx;
28 #define rtx _function_rtx
29 #endif
30
31 struct var_refs_queue
32 {
33 rtx modified;
34 enum machine_mode promoted_mode;
35 int unsignedp;
36 struct var_refs_queue *next;
37 };
38
39 /* Stack of pending (incomplete) sequences saved by `start_sequence'.
40 Each element describes one pending sequence.
41 The main insn-chain is saved in the last element of the chain,
42 unless the chain is empty. */
43
44 struct sequence_stack
45 {
46 /* First and last insns in the chain of the saved sequence. */
47 rtx first, last;
48 tree sequence_rtl_expr;
49 struct sequence_stack *next;
50 };
51
52 extern struct sequence_stack *sequence_stack;
53
54 /* Stack of single obstacks. */
55
56 struct simple_obstack_stack
57 {
58 struct obstack *obstack;
59 struct simple_obstack_stack *next;
60 };
61 \f
62 /* This structure can save all the important global and static variables
63 describing the status of the current function. */
64
65 struct function
66 {
67 struct function *next_global;
68 struct function *next;
69
70 struct eh_status *eh;
71
72 /* For function.c. */
73 char *name;
74 tree decl;
75 int pops_args;
76 int returns_struct;
77 int returns_pcc_struct;
78 int returns_pointer;
79 int needs_context;
80 int calls_setjmp;
81 int calls_longjmp;
82 int calls_alloca;
83 int has_nonlocal_label;
84 int has_nonlocal_goto;
85 int contains_functions;
86 int has_computed_jump;
87 int is_thunk;
88 rtx nonlocal_goto_handler_slots;
89 rtx nonlocal_goto_handler_labels;
90 rtx nonlocal_goto_stack_level;
91 tree nonlocal_labels;
92 int args_size;
93 int pretend_args_size;
94 rtx arg_offset_rtx;
95 int varargs;
96 int stdarg;
97 int max_parm_reg;
98 rtx *parm_reg_stack_loc;
99 int outgoing_args_size;
100 rtx return_rtx;
101 rtx cleanup_label;
102 rtx return_label;
103 rtx save_expr_regs;
104 rtx stack_slot_list;
105 rtx parm_birth_insn;
106 HOST_WIDE_INT frame_offset;
107 rtx tail_recursion_label;
108 rtx tail_recursion_reentry;
109 rtx internal_arg_pointer;
110 char *cannot_inline;
111 rtx arg_pointer_save_area;
112 tree rtl_expr_chain;
113 rtx last_parm_insn;
114 tree context_display;
115 tree trampoline_list;
116 int function_call_count;
117 struct temp_slot *temp_slots;
118 int temp_slot_level;
119 int target_temp_slot_level;
120 int var_temp_slot_level;
121 int instrument_entry_exit;
122 /* This slot is initialized as 0 and is added to
123 during the nested function. */
124 struct var_refs_queue *fixup_var_refs_queue;
125 CUMULATIVE_ARGS args_info;
126
127 /* For stmt.c */
128 struct nesting *block_stack;
129 struct nesting *stack_block_stack;
130 struct nesting *cond_stack;
131 struct nesting *loop_stack;
132 struct nesting *case_stack;
133 struct nesting *nesting_stack;
134 int nesting_depth;
135 int block_start_count;
136 tree last_expr_type;
137 rtx last_expr_value;
138 int expr_stmts_for_value;
139 char *emit_filename;
140 int emit_lineno;
141 struct goto_fixup *goto_fixup_chain;
142
143 /* For expr.c. */
144 rtx pending_chain;
145 int pending_stack_adjust;
146 int inhibit_defer_pop;
147 rtx saveregs_value;
148 rtx apply_args_value;
149 rtx forced_labels;
150 int check_memory_usage;
151
152 /* For emit-rtl.c. */
153 int reg_rtx_no;
154 int first_label_num;
155 rtx first_insn;
156 rtx last_insn;
157 tree sequence_rtl_expr;
158 struct sequence_stack *sequence_stack;
159 int cur_insn_uid;
160 int last_linenum;
161 char *last_filename;
162 char *regno_pointer_flag;
163 char *regno_pointer_align;
164 int regno_pointer_flag_length;
165 rtx *regno_reg_rtx;
166
167 /* For stor-layout.c. */
168 tree permanent_type_chain;
169 tree temporary_type_chain;
170 tree permanent_type_end;
171 tree temporary_type_end;
172 tree pending_sizes;
173 int immediate_size_expand;
174
175 /* For tree.c. */
176 int all_types_permanent;
177 struct momentary_level *momentary_stack;
178 char *maybepermanent_firstobj;
179 char *temporary_firstobj;
180 char *momentary_firstobj;
181 char *momentary_function_firstobj;
182 struct obstack *current_obstack;
183 struct obstack *function_obstack;
184 struct obstack *function_maybepermanent_obstack;
185 struct obstack *expression_obstack;
186 struct obstack *saveable_obstack;
187 struct obstack *rtl_obstack;
188 struct simple_obstack_stack *inline_obstacks;
189
190 /* For integrate.c. */
191 int uses_const_pool;
192
193 /* For md files. */
194 int uses_pic_offset_table;
195 /* tm.h can use this to store whatever it likes. */
196 struct machine_function *machine;
197
198 /* For reorg. */
199 rtx epilogue_delay_list;
200
201 /* For varasm. */
202 struct constant_descriptor **const_rtx_hash_table;
203 struct pool_sym **const_rtx_sym_hash_table;
204 struct pool_constant *first_pool, *last_pool;
205 int pool_offset;
206 rtx const_double_chain;
207 };
208
209 extern struct function *current_function;
210 extern struct function *all_functions;
211
212 /* The FUNCTION_DECL for an inline function currently being expanded. */
213 extern tree inline_function_decl;
214
215 /* Label that will go on parm cleanup code, if any.
216 Jumping to this label runs cleanup code for parameters, if
217 such code must be run. Following this code is the logical return label. */
218
219 extern rtx cleanup_label;
220
221 /* Label that will go on function epilogue.
222 Jumping to this label serves as a "return" instruction
223 on machines which require execution of the epilogue on all returns. */
224
225 extern rtx return_label;
226
227 /* Offset to end of allocated area of stack frame.
228 If stack grows down, this is the address of the last stack slot allocated.
229 If stack grows up, this is the address for the next slot. */
230 extern HOST_WIDE_INT frame_offset;
231
232 /* Label to jump back to for tail recursion, or 0 if we have
233 not yet needed one for this function. */
234 extern rtx tail_recursion_label;
235
236 /* Place after which to insert the tail_recursion_label if we need one. */
237 extern rtx tail_recursion_reentry;
238
239 /* Location at which to save the argument pointer if it will need to be
240 referenced. There are two cases where this is done: if nonlocal gotos
241 exist, or if vars whose is an offset from the argument pointer will be
242 needed by inner routines. */
243
244 extern rtx arg_pointer_save_area;
245
246 /* Chain of all RTL_EXPRs that have insns in them. */
247 extern tree rtl_expr_chain;
248
249 /* List (chain of EXPR_LISTs) of all stack slots in this function.
250 Made for the sake of unshare_all_rtl. */
251 extern rtx stack_slot_list;
252
253 /* Given a function decl for a containing function,
254 return the `struct function' for it. */
255 struct function *find_function_data PROTO((tree));
256
257 /* Pointer to chain of `struct function' for containing functions. */
258 extern struct function *outer_function_chain;
259
260 /* Put all this function's BLOCK nodes into a vector and return it.
261 Also store in each NOTE for the beginning or end of a block
262 the index of that block in the vector. */
263 extern tree *identify_blocks PROTO((tree, rtx));
264
265 /* Return size needed for stack frame based on slots so far allocated.
266 This size counts from zero. It is not rounded to STACK_BOUNDARY;
267 the caller may have to do that. */
268 extern HOST_WIDE_INT get_frame_size PROTO((void));
269
270 /* These variables hold pointers to functions to
271 save and restore machine-specific data,
272 in push_function_context and pop_function_context. */
273 extern void (*save_machine_status) PROTO((struct function *));
274 extern void (*restore_machine_status) PROTO((struct function *));
275
276 /* Save and restore status information for a nested function. */
277 extern void save_tree_status PROTO((struct function *, tree));
278 extern void restore_tree_status PROTO((struct function *, tree));
279 extern void save_varasm_status PROTO((struct function *, tree));
280 extern void restore_varasm_status PROTO((struct function *));
281 extern void save_eh_status PROTO((struct function *));
282 extern void restore_eh_status PROTO((struct function *));
283 extern void save_stmt_status PROTO((struct function *));
284 extern void restore_stmt_status PROTO((struct function *));
285 extern void save_expr_status PROTO((struct function *));
286 extern void restore_expr_status PROTO((struct function *));
287 extern void save_emit_status PROTO((struct function *));
288 extern void restore_emit_status PROTO((struct function *));
289 extern void save_storage_status PROTO((struct function *));
290 extern void restore_storage_status PROTO((struct function *));
291
292 extern rtx get_first_block_beg PROTO((void));
293
294 #ifdef rtx
295 #undef rtx
296 #endif
297
298 #ifdef tree
299 #undef tree
300 #endif