Record revision number.
[official-gcc.git] / gcc / tree-flow.h
blob88c1d0a55e6c0390a3e11fee145c1c4420035890
1 /* Data and Control Flow Analysis for Trees.
2 Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
3 Contributed by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA. */
22 #ifndef _TREE_FLOW_H
23 #define _TREE_FLOW_H 1
25 #include "bitmap.h"
26 #include "hard-reg-set.h"
27 #include "basic-block.h"
28 #include "hashtab.h"
29 #include "tree-gimple.h"
30 #include "tree-ssa-operands.h"
31 #include "cgraph.h"
32 #include "ipa-reference.h"
33 #include "ipa-prop.h"
35 /* Forward declare structures for the garbage collector GTY markers. */
36 #ifndef GCC_BASIC_BLOCK_H
37 struct edge_def;
38 typedef struct edge_def *edge;
39 struct basic_block_def;
40 typedef struct basic_block_def *basic_block;
41 #endif
43 struct ssa GTY(()) {
44 /* Array of all variables referenced in the function. */
45 htab_t GTY((param_is (struct int_tree_map))) x_referenced_vars;
46 /* A list of all the noreturn calls passed to modify_stmt.
47 cleanup_control_flow uses it to detect cases where a mid-block
48 indirect call has been turned into a noreturn call. When this
49 happens, all the instructions after the call are no longer
50 reachable and must be deleted as dead. */
51 VEC(tree,gc) *x_modified_noreturn_calls;
52 /* Array of all SSA_NAMEs used in the function. */
53 VEC(tree,gc) *x_ssa_names;
55 /* Artificial variable used to model the effects of function calls. */
56 tree x_global_var;
58 /* Call clobbered variables in the function. If bit I is set, then
59 REFERENCED_VARS (I) is call-clobbered. */
60 bitmap call_clobbered_vars;
62 /* Addressable variables in the function. If bit I is set, then
63 REFERENCED_VARS (I) has had its address taken. Note that
64 CALL_CLOBBERED_VARS and ADDRESSABLE_VARS are not related. An
65 addressable variable is not necessarily call-clobbered (e.g., a
66 local addressable whose address does not escape) and not all
67 call-clobbered variables are addressable (e.g., a local static
68 variable). */
69 bitmap addressable_vars;
71 /* 'true' after aliases have been computed (see compute_may_aliases). */
72 bool x_aliases_computed_p;
74 bool x_in_ssa_p;
76 /* Free list of SSA_NAMEs. */
77 tree x_free_ssanames;
79 /* Array for building all the def operands. */
80 VEC(tree,heap) * GTY((skip)) x_build_defs;
82 /* Array for building all the use operands. */
83 VEC(tree,heap) * GTY((skip)) x_build_uses;
85 /* Array for building all the v_may_def operands. */
86 VEC(tree,heap) * GTY((skip)) x_build_v_may_defs;
88 /* Array for building all the vuse operands. */
89 VEC(tree,heap) * GTY((skip)) x_build_vuses;
91 /* Array for building all the v_must_def operands. */
92 VEC(tree,heap) * GTY((skip)) x_build_v_must_defs;
94 struct ssa_operand_memory_d *x_operand_memory;
95 unsigned x_operand_memory_index;
97 bool ops_active;
99 struct def_optype_d * GTY((skip)) x_free_defs;
100 struct use_optype_d * GTY((skip)) x_free_uses;
101 struct vuse_optype_d * GTY((skip)) x_free_vuses;
102 struct maydef_optype_d * GTY((skip)) x_free_maydefs;
103 struct mustdef_optype_d * GTY((skip)) x_free_mustdefs;
105 /* Hashtable holding definition for symbol. If this field is not NULL, it
106 means that the first reference to this variable in the function is a
107 USE or a VUSE. In those cases, the SSA renamer creates an SSA name
108 for this variable with an empty defining statement. */
109 htab_t GTY((param_is (struct int_tree_map))) default_defs;
111 #define referenced_vars cfun->ssa->x_referenced_vars
112 #define ssa_names cfun->ssa->x_ssa_names
113 #define modified_noreturn_calls cfun->ssa->x_modified_noreturn_calls
114 #define global_var cfun->ssa->x_global_var
115 #define aliases_computed_p cfun->ssa->x_aliases_computed_p
116 #define in_ssa_p (cfun->ssa && cfun->ssa->x_in_ssa_p)
117 #define free_ssanames (cfun->ssa->x_free_ssanames)
119 #define build_defs (cfun->ssa->x_build_defs)
120 #define build_uses (cfun->ssa->x_build_uses)
121 #define build_v_may_defs (cfun->ssa->x_build_v_may_defs)
122 #define build_vuses (cfun->ssa->x_build_vuses)
123 #define build_v_must_defs (cfun->ssa->x_build_v_must_defs)
124 #define operand_memory (cfun->ssa->x_operand_memory)
125 #define operand_memory_index (cfun->ssa->x_operand_memory_index)
126 #define free_defs (cfun->ssa->x_free_defs)
127 #define free_uses (cfun->ssa->x_free_uses)
128 #define free_vuses (cfun->ssa->x_free_vuses)
129 #define free_maydefs (cfun->ssa->x_free_maydefs)
130 #define free_mustdefs (cfun->ssa->x_free_mustdefs)
132 typedef struct
134 htab_t htab;
135 PTR *slot;
136 PTR *limit;
137 } htab_iterator;
139 /* Iterate through the elements of hashtable HTAB, using htab_iterator ITER,
140 storing each element in RESULT, which is of type TYPE. */
141 #define FOR_EACH_HTAB_ELEMENT(HTAB, RESULT, TYPE, ITER) \
142 for (RESULT = (TYPE) first_htab_element (&(ITER), (HTAB)); \
143 !end_htab_p (&(ITER)); \
144 RESULT = (TYPE) next_htab_element (&(ITER)))
146 /*---------------------------------------------------------------------------
147 Attributes for SSA_NAMEs.
149 NOTE: These structures are stored in struct tree_ssa_name
150 but are only used by the tree optimizers, so it makes better sense
151 to declare them here to avoid recompiling unrelated files when
152 making changes.
153 ---------------------------------------------------------------------------*/
155 /* Aliasing information for SSA_NAMEs representing pointer variables. */
156 struct ptr_info_def GTY(())
158 /* Nonzero if points-to analysis couldn't determine where this pointer
159 is pointing to. */
160 unsigned int pt_anything : 1;
162 /* Nonzero if the value of this pointer escapes the current function. */
163 unsigned int value_escapes_p : 1;
165 /* Nonzero if this pointer is dereferenced. */
166 unsigned int is_dereferenced : 1;
168 /* Nonzero if this pointer points to a global variable. */
169 unsigned int pt_global_mem : 1;
171 /* Nonzero if this pointer points to NULL. */
172 unsigned int pt_null : 1;
174 /* Set of variables that this pointer may point to. */
175 bitmap pt_vars;
177 /* If this pointer has been dereferenced, and points-to information is
178 more precise than type-based aliasing, indirect references to this
179 pointer will be represented by this memory tag, instead of the type
180 tag computed by TBAA. */
181 tree name_mem_tag;
185 /*---------------------------------------------------------------------------
186 Tree annotations stored in tree_common.ann
187 ---------------------------------------------------------------------------*/
188 enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, STMT_ANN };
190 struct tree_ann_common_d GTY(())
192 /* Annotation type. */
193 enum tree_ann_type type;
195 /* Auxiliary info specific to a pass. At all times, this
196 should either point to valid data or be NULL. */
197 PTR GTY ((skip (""))) aux;
199 /* The value handle for this expression. Used by GVN-PRE. */
200 tree GTY((skip)) value_handle;
203 /* It is advantageous to avoid things like life analysis for variables which
204 do not need PHI nodes. This enum describes whether or not a particular
205 variable may need a PHI node. */
207 enum need_phi_state {
208 /* This is the default. If we are still in this state after finding
209 all the definition and use sites, then we will assume the variable
210 needs PHI nodes. This is probably an overly conservative assumption. */
211 NEED_PHI_STATE_UNKNOWN,
213 /* This state indicates that we have seen one or more sets of the
214 variable in a single basic block and that the sets dominate all
215 uses seen so far. If after finding all definition and use sites
216 we are still in this state, then the variable does not need any
217 PHI nodes. */
218 NEED_PHI_STATE_NO,
220 /* This state indicates that we have either seen multiple definitions of
221 the variable in multiple blocks, or that we encountered a use in a
222 block that was not dominated by the block containing the set(s) of
223 this variable. This variable is assumed to need PHI nodes. */
224 NEED_PHI_STATE_MAYBE
228 /* When computing aliasing information, we represent the memory pointed-to
229 by pointers with artificial variables called "memory tags" (MT). There
230 are two kinds of tags: type and name. Type tags (TMT) are used in
231 type-based alias analysis, they represent all the pointed-to locations
232 and variables of the same alias set class. Name tags (NMT) are used in
233 flow-sensitive points-to alias analysis, they represent the variables
234 and memory locations pointed-to by a specific SSA_NAME pointer. */
235 enum mem_tag_kind {
236 /* This variable is not a memory tag. */
237 NOT_A_TAG,
239 /* This variable is a type memory tag (TMT). */
240 TYPE_TAG,
242 /* This variable is a name memory tag (NMT). */
243 NAME_TAG,
245 /* This variable represents a structure field. */
246 STRUCT_FIELD
249 struct subvar;
250 typedef struct subvar *subvar_t;
252 /* This structure represents a fake sub-variable for a structure field. */
253 struct subvar GTY(())
255 /* Fake variable. */
256 tree var;
258 /* Offset inside structure. */
259 unsigned HOST_WIDE_INT offset;
261 /* Size of the field. */
262 unsigned HOST_WIDE_INT size;
264 /* Next subvar for this structure. */
265 subvar_t next;
268 struct var_ann_d GTY(())
270 struct tree_ann_common_d common;
272 /* Used by the out of SSA pass to determine whether this variable has
273 been seen yet or not. */
274 unsigned out_of_ssa_tag : 1;
276 /* Used when building root_var structures in tree_ssa_live.[ch]. */
277 unsigned root_var_processed : 1;
279 /* If nonzero, this variable is a memory tag. */
280 ENUM_BITFIELD (mem_tag_kind) mem_tag_kind : 2;
282 /* Nonzero if this variable is an alias tag that represents references to
283 other variables (i.e., this variable appears in the MAY_ALIASES array
284 of other variables). */
285 unsigned is_alias_tag : 1;
287 /* Nonzero if this variable was used after SSA optimizations were
288 applied. We set this when translating out of SSA form. */
289 unsigned used : 1;
291 /* This field indicates whether or not the variable may need PHI nodes.
292 See the enum's definition for more detailed information about the
293 states. */
294 ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
296 /* Used during operand processing to determine if this variable is already
297 in the vuse list. */
298 unsigned in_vuse_list : 1;
300 /* Used during operand processing to determine if this variable is already
301 in the v_may_def list. */
302 unsigned in_v_may_def_list : 1;
304 /* An artificial variable representing the memory location pointed-to by
305 all the pointers that TBAA (type-based alias analysis) considers
306 to be aliased. If the variable is not a pointer or if it is never
307 dereferenced, this must be NULL. */
308 tree type_mem_tag;
310 /* Variables that may alias this variable. */
311 varray_type may_aliases;
313 /* Used when going out of SSA form to indicate which partition this
314 variable represents storage for. */
315 unsigned partition;
317 /* Used by the root-var object in tree-ssa-live.[ch]. */
318 unsigned root_index;
320 /* During into-ssa and the dominator optimizer, this field holds the
321 current version of this variable (an SSA_NAME). */
322 tree current_def;
324 /* Pointer to the structure that contains the sets of global
325 variables modified by function calls. This field is only used
326 for FUNCTION_DECLs. */
327 ipa_reference_vars_info_t GTY ((skip)) reference_vars_info;
329 /* Relevant only for FUNCTION_DECL. Pointer to array of enums
330 that for each pair of function's formal parameters contains
331 their aliasing as culculated by ipaa. */
332 enum alias_info_d * GTY ((skip)) ipa_alias;
334 /* If this variable is a structure, this fields holds a list of
335 symbols representing each of the fields of the structure. */
336 subvar_t subvars;
340 typedef struct immediate_use_iterator_d
342 ssa_use_operand_t *imm_use;
343 ssa_use_operand_t *end_p;
344 ssa_use_operand_t iter_node;
345 } imm_use_iterator;
348 /* Use this iterator when simply looking at stmts. Adding, deleting or
349 modifying stmts will cause this iterator to malfunction. */
351 #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR) \
352 for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR)); \
353 !end_readonly_imm_use_p (&(ITER)); \
354 (DEST) = next_readonly_imm_use (&(ITER)))
357 #define FOR_EACH_IMM_USE_SAFE(DEST, ITER, SSAVAR) \
358 for ((DEST) = first_safe_imm_use (&(ITER), (SSAVAR)); \
359 !end_safe_imm_use_p (&(ITER)); \
360 (DEST) = next_safe_imm_use (&(ITER)))
362 #define BREAK_FROM_SAFE_IMM_USE(ITER) \
364 end_safe_imm_use_traverse (&(ITER)); \
365 break; \
368 struct stmt_ann_d GTY(())
370 struct tree_ann_common_d common;
372 /* Nonzero if the statement has been modified (meaning that the operands
373 need to be scanned again). */
374 unsigned modified : 1;
376 /* Nonzero if the statement makes aliased loads. */
377 unsigned makes_aliased_loads : 1;
379 /* Nonzero if the statement makes aliased stores. */
380 unsigned makes_aliased_stores : 1;
382 /* Nonzero if the statement makes references to volatile storage. */
383 unsigned has_volatile_ops : 1;
385 /* Nonzero if the statement makes a function call that may clobber global
386 and local addressable variables. */
387 unsigned makes_clobbering_call : 1;
389 /* Basic block that contains this statement. */
390 basic_block bb;
392 /* Operand cache for stmt. */
393 struct stmt_operands_d GTY ((skip (""))) operands;
395 /* Set of variables that have had their address taken in the statement. */
396 bitmap addresses_taken;
398 /* Unique identifier for this statement. These ID's are to be created
399 by each pass on an as-needed basis in any order convenient for the
400 pass which needs statement UIDs. */
401 unsigned int uid;
403 /* Linked list of histograms for value-based profiling. This is really a
404 struct histogram_value*. We use void* to avoid having to export that
405 everywhere, and to avoid having to put it in GC memory. */
407 void * GTY ((skip (""))) histograms;
410 union tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
412 struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
413 struct var_ann_d GTY((tag ("VAR_ANN"))) decl;
414 struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
417 typedef union tree_ann_d *tree_ann_t;
418 typedef struct var_ann_d *var_ann_t;
419 typedef struct stmt_ann_d *stmt_ann_t;
421 static inline tree_ann_t tree_ann (tree);
422 static inline tree_ann_t get_tree_ann (tree);
423 static inline var_ann_t var_ann (tree);
424 static inline var_ann_t get_var_ann (tree);
425 static inline stmt_ann_t stmt_ann (tree);
426 static inline stmt_ann_t get_stmt_ann (tree);
427 static inline enum tree_ann_type ann_type (tree_ann_t);
428 static inline basic_block bb_for_stmt (tree);
429 extern void set_bb_for_stmt (tree, basic_block);
430 static inline bool noreturn_call_p (tree);
431 static inline void update_stmt (tree);
432 static inline bool stmt_modified_p (tree);
433 static inline varray_type may_aliases (tree);
434 static inline int get_lineno (tree);
435 static inline const char *get_filename (tree);
436 static inline bool is_exec_stmt (tree);
437 static inline bool is_label_stmt (tree);
438 static inline bitmap addresses_taken (tree);
440 /*---------------------------------------------------------------------------
441 Structure representing predictions in tree level.
442 ---------------------------------------------------------------------------*/
443 struct edge_prediction GTY((chain_next ("%h.next")))
445 struct edge_prediction *next;
446 edge edge;
447 enum br_predictor predictor;
448 int probability;
451 /* Accessors for basic block annotations. */
452 static inline tree phi_nodes (basic_block);
453 static inline void set_phi_nodes (basic_block, tree);
455 /*---------------------------------------------------------------------------
456 Global declarations
457 ---------------------------------------------------------------------------*/
458 struct int_tree_map GTY(())
461 unsigned int uid;
462 tree to;
465 extern unsigned int int_tree_map_hash (const void *);
466 extern int int_tree_map_eq (const void *, const void *);
468 typedef struct
470 htab_iterator hti;
471 } referenced_var_iterator;
474 /* This macro loops over all the referenced vars, one at a time, putting the
475 current var in VAR. Note: You are not allowed to add referenced variables
476 to the hashtable while using this macro. Doing so may cause it to behave
477 erratically. */
479 #define FOR_EACH_REFERENCED_VAR(VAR, ITER) \
480 for ((VAR) = first_referenced_var (&(ITER)); \
481 !end_referenced_vars_p (&(ITER)); \
482 (VAR) = next_referenced_var (&(ITER)))
485 typedef struct
487 int i;
488 } safe_referenced_var_iterator;
490 /* This macro loops over all the referenced vars, one at a time, putting the
491 current var in VAR. You are allowed to add referenced variables during the
492 execution of this macro, however, the macro will not iterate over them. It
493 requires a temporary vector of trees, VEC, whose lifetime is controlled by
494 the caller. The purpose of the vector is to temporarily store the
495 referenced_variables hashtable so that adding referenced variables does not
496 affect the hashtable. */
498 #define FOR_EACH_REFERENCED_VAR_SAFE(VAR, VEC, ITER) \
499 for ((ITER).i = 0, fill_referenced_var_vec (&(VEC)); \
500 VEC_iterate (tree, (VEC), (ITER).i, (VAR)); \
501 (ITER).i++)
503 extern tree referenced_var_lookup (unsigned int);
504 extern tree referenced_var_lookup_if_exists (unsigned int);
505 #define num_referenced_vars htab_elements (referenced_vars)
506 #define referenced_var(i) referenced_var_lookup (i)
508 #define num_ssa_names (VEC_length (tree, ssa_names))
509 #define ssa_name(i) (VEC_index (tree, ssa_names, (i)))
511 /* Macros for showing usage statistics. */
512 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
513 ? (x) \
514 : ((x) < 1024*1024*10 \
515 ? (x) / 1024 \
516 : (x) / (1024*1024))))
518 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
520 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
522 /*---------------------------------------------------------------------------
523 Block iterators
524 ---------------------------------------------------------------------------*/
526 typedef struct {
527 tree_stmt_iterator tsi;
528 basic_block bb;
529 } block_stmt_iterator;
531 static inline block_stmt_iterator bsi_start (basic_block);
532 static inline block_stmt_iterator bsi_last (basic_block);
533 static inline block_stmt_iterator bsi_after_labels (basic_block);
534 block_stmt_iterator bsi_for_stmt (tree);
535 static inline bool bsi_end_p (block_stmt_iterator);
536 static inline void bsi_next (block_stmt_iterator *);
537 static inline void bsi_prev (block_stmt_iterator *);
538 static inline tree bsi_stmt (block_stmt_iterator);
539 static inline tree * bsi_stmt_ptr (block_stmt_iterator);
541 extern void bsi_remove (block_stmt_iterator *);
542 extern void bsi_move_before (block_stmt_iterator *, block_stmt_iterator *);
543 extern void bsi_move_after (block_stmt_iterator *, block_stmt_iterator *);
544 extern void bsi_move_to_bb_end (block_stmt_iterator *, basic_block);
546 enum bsi_iterator_update
548 /* Note that these are intentionally in the same order as TSI_FOO. They
549 mean exactly the same as their TSI_* counterparts. */
550 BSI_NEW_STMT,
551 BSI_SAME_STMT,
552 BSI_CHAIN_START,
553 BSI_CHAIN_END,
554 BSI_CONTINUE_LINKING
557 extern void bsi_insert_before (block_stmt_iterator *, tree,
558 enum bsi_iterator_update);
559 extern void bsi_insert_after (block_stmt_iterator *, tree,
560 enum bsi_iterator_update);
562 extern void bsi_replace (const block_stmt_iterator *, tree, bool);
564 /*---------------------------------------------------------------------------
565 Function prototypes
566 ---------------------------------------------------------------------------*/
567 /* In tree-cfg.c */
569 /* Location to track pending stmt for edge insertion. */
570 #define PENDING_STMT(e) ((e)->insns.t)
572 extern void delete_tree_cfg_annotations (void);
573 extern void disband_implicit_edges (void);
574 extern bool stmt_ends_bb_p (tree);
575 extern bool is_ctrl_stmt (tree);
576 extern bool is_ctrl_altering_stmt (tree);
577 extern bool computed_goto_p (tree);
578 extern bool simple_goto_p (tree);
579 extern void tree_dump_bb (basic_block, FILE *, int);
580 extern void debug_tree_bb (basic_block);
581 extern basic_block debug_tree_bb_n (int);
582 extern void dump_tree_cfg (FILE *, int);
583 extern void debug_tree_cfg (int);
584 extern void dump_cfg_stats (FILE *);
585 extern void debug_cfg_stats (void);
586 extern void debug_loop_ir (void);
587 extern void print_loop_ir (FILE *);
588 extern void cleanup_dead_labels (void);
589 extern void group_case_labels (void);
590 extern tree first_stmt (basic_block);
591 extern tree last_stmt (basic_block);
592 extern tree *last_stmt_ptr (basic_block);
593 extern tree last_and_only_stmt (basic_block);
594 extern edge find_taken_edge (basic_block, tree);
595 extern basic_block label_to_block_fn (struct function *, tree);
596 #define label_to_block(t) (label_to_block_fn (cfun, t))
597 extern void bsi_insert_on_edge (edge, tree);
598 extern basic_block bsi_insert_on_edge_immediate (edge, tree);
599 extern void bsi_commit_one_edge_insert (edge, basic_block *);
600 extern void bsi_commit_edge_inserts (void);
601 extern void notice_special_calls (tree);
602 extern void clear_special_calls (void);
603 extern void verify_stmts (void);
604 extern tree tree_block_label (basic_block);
605 extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
606 extern bool tree_duplicate_sese_region (edge, edge, basic_block *, unsigned,
607 basic_block *);
608 extern void add_phi_args_after_copy_bb (basic_block);
609 extern void add_phi_args_after_copy (basic_block *, unsigned);
610 extern bool tree_purge_dead_eh_edges (basic_block);
611 extern bool tree_purge_all_dead_eh_edges (bitmap);
612 extern tree gimplify_val (block_stmt_iterator *, tree, tree);
613 extern tree gimplify_build1 (block_stmt_iterator *, enum tree_code,
614 tree, tree);
615 extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
616 tree, tree, tree);
617 extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
618 tree, tree, tree, tree);
619 extern void init_empty_tree_cfg (void);
620 extern void fold_cond_expr_cond (void);
621 extern void replace_uses_by (tree, tree);
622 extern void start_recording_case_labels (void);
623 extern void end_recording_case_labels (void);
625 /* In tree-cfgcleanup.c */
626 extern bool cleanup_tree_cfg (void);
627 extern void cleanup_tree_cfg_loop (void);
629 /* In tree-pretty-print.c. */
630 extern void dump_generic_bb (FILE *, basic_block, int, int);
632 /* In tree-dfa.c */
633 extern var_ann_t create_var_ann (tree);
634 extern stmt_ann_t create_stmt_ann (tree);
635 extern tree_ann_t create_tree_ann (tree);
636 extern void reserve_phi_args_for_new_edge (basic_block);
637 extern tree create_phi_node (tree, basic_block);
638 extern void add_phi_arg (tree, tree, edge);
639 extern void remove_phi_args (edge);
640 extern void remove_phi_node (tree, tree);
641 extern tree phi_reverse (tree);
642 extern void dump_dfa_stats (FILE *);
643 extern void debug_dfa_stats (void);
644 extern void debug_referenced_vars (void);
645 extern void dump_referenced_vars (FILE *);
646 extern void dump_variable (FILE *, tree);
647 extern void debug_variable (tree);
648 extern void dump_subvars_for (FILE *, tree);
649 extern void debug_subvars_for (tree);
650 extern tree get_virtual_var (tree);
651 extern void add_referenced_tmp_var (tree);
652 extern void mark_new_vars_to_rename (tree);
653 extern void find_new_referenced_vars (tree *);
655 extern tree make_rename_temp (tree, const char *);
656 extern void set_default_def (tree, tree);
657 extern tree default_def (tree);
658 extern tree default_def_fn (struct function *, tree);
660 /* In gimple-low.c */
661 extern void record_vars (tree);
662 extern bool block_may_fallthru (tree block);
664 /* In tree-ssa-alias.c */
665 extern void dump_may_aliases_for (FILE *, tree);
666 extern void debug_may_aliases_for (tree);
667 extern void dump_alias_info (FILE *);
668 extern void debug_alias_info (void);
669 extern void dump_points_to_info (FILE *);
670 extern void debug_points_to_info (void);
671 extern void dump_points_to_info_for (FILE *, tree);
672 extern void debug_points_to_info_for (tree);
673 extern bool may_be_aliased (tree);
674 extern bool is_aliased_with (tree, tree);
675 extern struct ptr_info_def *get_ptr_info (tree);
676 extern void add_type_alias (tree, tree);
677 extern void new_type_alias (tree, tree);
678 extern void count_uses_and_derefs (tree, tree, unsigned *, unsigned *, bool *);
679 static inline subvar_t get_subvars_for_var (tree);
680 static inline tree get_subvar_at (tree, unsigned HOST_WIDE_INT);
681 static inline bool ref_contains_array_ref (tree);
682 static inline bool ref_contains_indirect_ref (tree);
683 extern tree okay_component_ref_for_subvars (tree, unsigned HOST_WIDE_INT *,
684 unsigned HOST_WIDE_INT *);
685 static inline bool var_can_have_subvars (tree);
686 static inline bool overlap_subvar (unsigned HOST_WIDE_INT,
687 unsigned HOST_WIDE_INT,
688 subvar_t, bool *);
690 /* Call-back function for walk_use_def_chains(). At each reaching
691 definition, a function with this prototype is called. */
692 typedef bool (*walk_use_def_chains_fn) (tree, tree, void *);
695 /* In tree-ssa.c */
696 extern void init_tree_ssa (void);
697 extern edge ssa_redirect_edge (edge, basic_block);
698 extern void flush_pending_stmts (edge);
699 extern bool tree_ssa_useless_type_conversion (tree);
700 extern bool tree_ssa_useless_type_conversion_1 (tree, tree);
701 extern void verify_ssa (bool);
702 extern void delete_tree_ssa (void);
703 extern void register_new_def (tree, VEC(tree,heap) **);
704 extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
705 extern bool stmt_references_memory_p (tree);
707 /* In tree-into-ssa.c */
708 void update_ssa (unsigned);
709 void delete_update_ssa (void);
710 void register_new_name_mapping (tree, tree);
711 tree create_new_def_for (tree, tree, def_operand_p);
712 bool need_ssa_update_p (void);
713 bool name_registered_for_update_p (tree);
714 bitmap ssa_names_to_replace (void);
715 void release_ssa_name_after_update_ssa (tree name);
716 void compute_global_livein (bitmap, bitmap);
717 tree duplicate_ssa_name (tree, tree);
718 void mark_sym_for_renaming (tree);
719 void mark_set_for_renaming (bitmap);
720 tree get_current_def (tree);
721 void set_current_def (tree, tree);
723 /* In tree-ssa-ccp.c */
724 bool fold_stmt (tree *);
725 bool fold_stmt_inplace (tree);
726 tree widen_bitfield (tree, tree, tree);
728 /* In tree-vrp.c */
729 tree vrp_evaluate_conditional (tree, bool);
730 void simplify_stmt_using_ranges (tree);
732 /* In tree-ssa-dom.c */
733 extern void dump_dominator_optimization_stats (FILE *);
734 extern void debug_dominator_optimization_stats (void);
735 int loop_depth_of_name (tree);
737 /* In tree-ssa-copy.c */
738 extern void merge_alias_info (tree, tree);
739 extern void propagate_value (use_operand_p, tree);
740 extern void propagate_tree_value (tree *, tree);
741 extern void replace_exp (use_operand_p, tree);
742 extern bool may_propagate_copy (tree, tree);
743 extern bool may_propagate_copy_into_asm (tree);
745 /* Description of number of iterations of a loop. All the expressions inside
746 the structure can be evaluated at the end of the loop's preheader
747 (and due to ssa form, also anywhere inside the body of the loop). */
749 struct tree_niter_desc
751 tree assumptions; /* The boolean expression. If this expression evaluates
752 to false, then the other fields in this structure
753 should not be used; there is no guarantee that they
754 will be correct. */
755 tree may_be_zero; /* The boolean expression. If it evaluates to true,
756 the loop will exit in the first iteration (i.e.
757 its latch will not be executed), even if the niter
758 field says otherwise. */
759 tree niter; /* The expression giving the number of iterations of
760 a loop (provided that assumptions == true and
761 may_be_zero == false), more precisely the number
762 of executions of the latch of the loop. */
763 tree additional_info; /* The boolean expression. Sometimes we use additional
764 knowledge to simplify the other expressions
765 contained in this structure (for example the
766 knowledge about value ranges of operands on entry to
767 the loop). If this is a case, conjunction of such
768 condition is stored in this field, so that we do not
769 lose the information: for example if may_be_zero
770 is (n <= 0) and niter is (unsigned) n, we know
771 that the number of iterations is at most
772 MAX_SIGNED_INT. However if the (n <= 0) assumption
773 is eliminated (by looking at the guard on entry of
774 the loop), then the information would be lost. */
777 /* In tree-vectorizer.c */
778 void vectorize_loops (struct loops *);
780 /* In tree-ssa-phiopt.c */
781 bool empty_block_p (basic_block);
783 /* In tree-ssa-loop*.c */
785 void tree_ssa_lim (struct loops *);
786 void tree_ssa_unswitch_loops (struct loops *);
787 void canonicalize_induction_variables (struct loops *);
788 void tree_unroll_loops_completely (struct loops *, bool);
789 void remove_empty_loops (struct loops *);
790 void tree_ssa_iv_optimize (struct loops *);
792 bool number_of_iterations_exit (struct loop *, edge,
793 struct tree_niter_desc *niter, bool);
794 tree find_loop_niter (struct loop *, edge *);
795 tree loop_niter_by_eval (struct loop *, edge);
796 tree find_loop_niter_by_eval (struct loop *, edge *);
797 void estimate_numbers_of_iterations (struct loops *);
798 bool scev_probably_wraps_p (tree, tree, tree, tree, struct loop *, bool *,
799 bool *);
800 tree convert_step (struct loop *, tree, tree, tree, tree);
801 void free_numbers_of_iterations_estimates (struct loops *);
802 void free_numbers_of_iterations_estimates_loop (struct loop *);
803 void rewrite_into_loop_closed_ssa (bitmap, unsigned);
804 void verify_loop_closed_ssa (void);
805 void loop_commit_inserts (void);
806 bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
807 void create_iv (tree, tree, tree, struct loop *, block_stmt_iterator *, bool,
808 tree *, tree *);
809 void split_loop_exit_edge (edge);
810 void compute_phi_arg_on_exit (edge, tree, tree);
811 unsigned force_expr_to_var_cost (tree);
812 basic_block bsi_insert_on_edge_immediate_loop (edge, tree);
813 void standard_iv_increment_position (struct loop *, block_stmt_iterator *,
814 bool *);
815 basic_block ip_end_pos (struct loop *);
816 basic_block ip_normal_pos (struct loop *);
817 bool tree_duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
818 unsigned int, sbitmap,
819 edge, edge *,
820 unsigned int *, int);
821 struct loop *tree_ssa_loop_version (struct loops *, struct loop *, tree,
822 basic_block *);
823 tree expand_simple_operations (tree);
824 void substitute_in_loop_info (struct loop *, tree, tree);
825 edge single_dom_exit (struct loop *);
827 /* In tree-ssa-loop-im.c */
828 /* The possibilities of statement movement. */
830 enum move_pos
832 MOVE_IMPOSSIBLE, /* No movement -- side effect expression. */
833 MOVE_PRESERVE_EXECUTION, /* Must not cause the non-executed statement
834 become executed -- memory accesses, ... */
835 MOVE_POSSIBLE /* Unlimited movement. */
837 extern enum move_pos movement_possibility (tree);
839 /* In tree-flow-inline.h */
840 static inline bool is_call_clobbered (tree);
841 static inline void mark_call_clobbered (tree);
842 static inline void set_is_used (tree);
843 static inline bool unmodifiable_var_p (tree);
845 /* In tree-eh.c */
846 extern void make_eh_edges (tree);
847 extern bool tree_could_trap_p (tree);
848 extern bool tree_could_throw_p (tree);
849 extern bool tree_can_throw_internal (tree);
850 extern bool tree_can_throw_external (tree);
851 extern int lookup_stmt_eh_region (tree);
852 extern void add_stmt_to_eh_region (tree, int);
853 extern bool remove_stmt_from_eh_region (tree);
854 extern bool maybe_clean_or_replace_eh_stmt (tree, tree);
856 /* In tree-ssa-pre.c */
857 void add_to_value (tree, tree);
858 void debug_value_expressions (tree);
859 void print_value_expressions (FILE *, tree);
862 /* In tree-vn.c */
863 bool expressions_equal_p (tree, tree);
864 tree get_value_handle (tree);
865 hashval_t vn_compute (tree, hashval_t, tree);
866 tree vn_lookup_or_add (tree, tree);
867 void vn_add (tree, tree, tree);
868 tree vn_lookup (tree, tree);
869 void vn_init (void);
870 void vn_delete (void);
872 /* In tree-ssa-sink.c */
873 bool is_hidden_global_store (tree);
875 /* In tree-sra.c */
876 void insert_edge_copies (tree, basic_block);
877 void sra_insert_before (block_stmt_iterator *, tree);
878 void sra_insert_after (block_stmt_iterator *, tree);
879 void sra_init_cache (void);
880 bool sra_type_can_be_decomposed_p (tree);
882 /* In tree-loop-linear.c */
883 extern void linear_transform_loops (struct loops *);
885 /* In tree-ssa-loop-ivopts.c */
886 bool expr_invariant_in_loop_p (struct loop *, tree);
887 bool multiplier_allowed_in_address_p (HOST_WIDE_INT);
888 unsigned multiply_by_cost (HOST_WIDE_INT, enum machine_mode);
890 /* In tree-ssa-threadupdate.c. */
891 extern bool thread_through_all_blocks (bitmap);
893 /* In gimplify.c */
894 tree force_gimple_operand (tree, tree *, bool, tree);
895 tree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree);
897 /* In tree-ssa-structalias.c */
898 bool find_what_p_points_to (tree);
900 /* In tree-ssa-address.c */
902 /* Affine combination of trees. We keep track of at most MAX_AFF_ELTS elements
903 to make things simpler; this is sufficient in most cases. */
905 #define MAX_AFF_ELTS 8
907 struct affine_tree_combination
909 /* Type of the result of the combination. */
910 tree type;
912 /* Mask modulo that the operations are performed. */
913 unsigned HOST_WIDE_INT mask;
915 /* Constant offset. */
916 unsigned HOST_WIDE_INT offset;
918 /* Number of elements of the combination. */
919 unsigned n;
921 /* Elements and their coefficients. */
922 tree elts[MAX_AFF_ELTS];
923 unsigned HOST_WIDE_INT coefs[MAX_AFF_ELTS];
925 /* Remainder of the expression. */
926 tree rest;
929 /* Description of a memory address. */
931 struct mem_address
933 tree symbol, base, index, step, offset;
936 tree create_mem_ref (block_stmt_iterator *, tree,
937 struct affine_tree_combination *);
938 rtx addr_for_mem_ref (struct mem_address *, bool);
939 void get_address_description (tree, struct mem_address *);
940 tree maybe_fold_tmr (tree);
941 /* This structure is simply used during pushing fields onto the fieldstack
942 to track the offset of the field, since bitpos_of_field gives it relative
943 to its immediate containing type, and we want it relative to the ultimate
944 containing object. */
946 struct fieldoff
948 tree field;
949 HOST_WIDE_INT offset;
951 typedef struct fieldoff fieldoff_s;
953 DEF_VEC_O(fieldoff_s);
954 DEF_VEC_ALLOC_O(fieldoff_s,heap);
955 int push_fields_onto_fieldstack (tree, VEC(fieldoff_s,heap) **,
956 HOST_WIDE_INT, bool *);
957 void sort_fieldstack (VEC(fieldoff_s,heap) *);
959 #include "tree-flow-inline.h"
961 #endif /* _TREE_FLOW_H */