OSDN Git Service

Backport of GC branch patches part 2: kill stmt status saving.
[pf3gnuchains/gcc-fork.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   struct stmt_status *stmt;
72
73   /* For function.c.  */
74   char *name;
75   tree decl;
76   int pops_args;
77   int returns_struct;
78   int returns_pcc_struct;
79   int returns_pointer;
80   int needs_context;
81   int calls_setjmp;
82   int calls_longjmp;
83   int calls_alloca;
84   int has_nonlocal_label;
85   int has_nonlocal_goto;
86   int contains_functions;
87   int has_computed_jump;
88   int is_thunk;
89   rtx nonlocal_goto_handler_slots;
90   rtx nonlocal_goto_handler_labels;
91   rtx nonlocal_goto_stack_level;
92   tree nonlocal_labels;
93   int args_size;
94   int pretend_args_size;
95   rtx arg_offset_rtx;
96   int varargs;
97   int stdarg;
98   int max_parm_reg;
99   rtx *parm_reg_stack_loc;
100   int outgoing_args_size;
101   rtx return_rtx;
102   rtx cleanup_label;
103   rtx return_label;
104   rtx save_expr_regs;
105   rtx stack_slot_list;
106   rtx parm_birth_insn;
107   HOST_WIDE_INT frame_offset;
108   rtx tail_recursion_label;
109   rtx tail_recursion_reentry;
110   rtx internal_arg_pointer;
111   char *cannot_inline;
112   rtx arg_pointer_save_area;
113   tree rtl_expr_chain;
114   rtx last_parm_insn;
115   tree context_display;
116   tree trampoline_list;
117   int function_call_count;
118   struct temp_slot *temp_slots;
119   int temp_slot_level;
120   int target_temp_slot_level;
121   int var_temp_slot_level;
122   int instrument_entry_exit;
123   /* This slot is initialized as 0 and is added to
124      during the nested function.  */
125   struct var_refs_queue *fixup_var_refs_queue;
126   CUMULATIVE_ARGS args_info;
127
128   /* For expr.c.  */
129   rtx pending_chain;
130   int pending_stack_adjust;
131   int inhibit_defer_pop;
132   rtx saveregs_value;
133   rtx apply_args_value;
134   rtx forced_labels;
135   int check_memory_usage;
136
137   /* For emit-rtl.c.  */
138   int reg_rtx_no;
139   int first_label_num;
140   rtx first_insn;
141   rtx last_insn;
142   tree sequence_rtl_expr;
143   struct sequence_stack *sequence_stack;
144   int cur_insn_uid;
145   int last_linenum;
146   char *last_filename;
147   char *regno_pointer_flag;
148   char *regno_pointer_align;
149   int regno_pointer_flag_length;
150   rtx *regno_reg_rtx;
151
152   /* For stor-layout.c.  */
153   tree permanent_type_chain;
154   tree temporary_type_chain;
155   tree permanent_type_end;
156   tree temporary_type_end;
157   tree pending_sizes;
158   int immediate_size_expand;
159
160   /* For tree.c.  */
161   int all_types_permanent;
162   struct momentary_level *momentary_stack;
163   char *maybepermanent_firstobj;
164   char *temporary_firstobj;
165   char *momentary_firstobj;
166   char *momentary_function_firstobj;
167   struct obstack *current_obstack;
168   struct obstack *function_obstack;
169   struct obstack *function_maybepermanent_obstack;
170   struct obstack *expression_obstack;
171   struct obstack *saveable_obstack;
172   struct obstack *rtl_obstack;
173   struct simple_obstack_stack *inline_obstacks;
174
175   /* For integrate.c.  */
176   int uses_const_pool;
177
178   /* For md files.  */
179   int uses_pic_offset_table;
180   /* tm.h can use this to store whatever it likes.  */
181   struct machine_function *machine;
182
183   /* For reorg.  */
184   rtx epilogue_delay_list;
185
186   /* For varasm.  */
187   struct constant_descriptor **const_rtx_hash_table;
188   struct pool_sym **const_rtx_sym_hash_table;
189   struct pool_constant *first_pool, *last_pool;
190   int pool_offset;
191   rtx const_double_chain;
192 };
193
194 extern struct function *current_function;
195 extern struct function *all_functions;
196
197 /* The FUNCTION_DECL for an inline function currently being expanded.  */
198 extern tree inline_function_decl;
199
200 /* Label that will go on parm cleanup code, if any.
201    Jumping to this label runs cleanup code for parameters, if
202    such code must be run.  Following this code is the logical return label.  */
203
204 extern rtx cleanup_label;
205
206 /* Label that will go on function epilogue.
207    Jumping to this label serves as a "return" instruction
208    on machines which require execution of the epilogue on all returns.  */
209
210 extern rtx return_label;
211
212 /* Offset to end of allocated area of stack frame.
213    If stack grows down, this is the address of the last stack slot allocated.
214    If stack grows up, this is the address for the next slot.  */
215 extern HOST_WIDE_INT frame_offset;
216
217 /* Label to jump back to for tail recursion, or 0 if we have
218    not yet needed one for this function.  */
219 extern rtx tail_recursion_label;
220
221 /* Place after which to insert the tail_recursion_label if we need one.  */
222 extern rtx tail_recursion_reentry;
223
224 /* Location at which to save the argument pointer if it will need to be
225    referenced.  There are two cases where this is done: if nonlocal gotos
226    exist, or if vars whose is an offset from the argument pointer will be
227    needed by inner routines.  */
228
229 extern rtx arg_pointer_save_area;
230
231 /* Chain of all RTL_EXPRs that have insns in them.  */
232 extern tree rtl_expr_chain;
233
234 /* List (chain of EXPR_LISTs) of all stack slots in this function.
235    Made for the sake of unshare_all_rtl.  */
236 extern rtx stack_slot_list;
237
238 /* Given a function decl for a containing function,
239    return the `struct function' for it.  */
240 struct function *find_function_data PROTO((tree));
241
242 /* Pointer to chain of `struct function' for containing functions.  */
243 extern struct function *outer_function_chain;
244
245 /* Put all this function's BLOCK nodes into a vector and return it.
246    Also store in each NOTE for the beginning or end of a block
247    the index of that block in the vector.  */
248 extern tree *identify_blocks PROTO((tree, rtx));
249
250 /* Return size needed for stack frame based on slots so far allocated.
251    This size counts from zero.  It is not rounded to STACK_BOUNDARY;
252    the caller may have to do that.  */
253 extern HOST_WIDE_INT get_frame_size PROTO((void));
254
255 /* These variables hold pointers to functions to
256    save and restore machine-specific data,
257    in push_function_context and pop_function_context.  */
258 extern void (*save_machine_status) PROTO((struct function *));
259 extern void (*restore_machine_status) PROTO((struct function *));
260
261 /* Save and restore status information for a nested function.  */
262 extern void save_tree_status            PROTO((struct function *, tree));
263 extern void restore_tree_status         PROTO((struct function *, tree));
264 extern void save_varasm_status          PROTO((struct function *, tree));
265 extern void restore_varasm_status       PROTO((struct function *));
266 extern void save_expr_status            PROTO((struct function *));
267 extern void restore_expr_status         PROTO((struct function *));
268 extern void save_emit_status            PROTO((struct function *));
269 extern void restore_emit_status         PROTO((struct function *));
270 extern void save_storage_status         PROTO((struct function *));
271 extern void restore_storage_status      PROTO((struct function *));
272
273 extern rtx get_first_block_beg          PROTO((void));
274
275 #ifdef rtx
276 #undef rtx
277 #endif
278
279 #ifdef tree
280 #undef tree
281 #endif