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