2005-04-08 Kelley Cook <kcook@gcc.gnu.org>
[official-gcc.git] / gcc / tree-flow.h
blob00a1af7d564013a732e17360e50db58fb8361cbf
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, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, 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"
33 /* Forward declare structures for the garbage collector GTY markers. */
34 #ifndef GCC_BASIC_BLOCK_H
35 struct edge_def;
36 typedef struct edge_def *edge;
37 struct basic_block_def;
38 typedef struct basic_block_def *basic_block;
39 #endif
41 /*---------------------------------------------------------------------------
42 Attributes for SSA_NAMEs.
44 NOTE: These structures are stored in struct tree_ssa_name
45 but are only used by the tree optimizers, so it makes better sense
46 to declare them here to avoid recompiling unrelated files when
47 making changes.
48 ---------------------------------------------------------------------------*/
50 /* Aliasing information for SSA_NAMEs representing pointer variables. */
51 struct ptr_info_def GTY(())
53 /* Nonzero if points-to analysis couldn't determine where this pointer
54 is pointing to. */
55 unsigned int pt_anything : 1;
57 /* Nonzero if this pointer is the result of a call to malloc. */
58 unsigned int pt_malloc : 1;
60 /* Nonzero if the value of this pointer escapes the current function. */
61 unsigned int value_escapes_p : 1;
63 /* Nonzero if this pointer is dereferenced. */
64 unsigned int is_dereferenced : 1;
66 /* Nonzero if this pointer points to a global variable. */
67 unsigned int pt_global_mem : 1;
69 /* Nonzero if this pointer points to NULL. */
70 unsigned int pt_null : 1;
72 /* Set of variables that this pointer may point to. */
73 bitmap pt_vars;
75 /* If this pointer has been dereferenced, and points-to information is
76 more precise than type-based aliasing, indirect references to this
77 pointer will be represented by this memory tag, instead of the type
78 tag computed by TBAA. */
79 tree name_mem_tag;
83 /*---------------------------------------------------------------------------
84 Tree annotations stored in tree_common.ann
85 ---------------------------------------------------------------------------*/
86 enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, STMT_ANN };
88 struct tree_ann_common_d GTY(())
90 /* Annotation type. */
91 enum tree_ann_type type;
93 /* Auxiliary info specific to a pass. At all times, this
94 should either point to valid data or be NULL. */
95 PTR GTY ((skip (""))) aux;
97 /* The value handle for this expression. Used by GVN-PRE. */
98 tree GTY((skip)) value_handle;
101 /* It is advantageous to avoid things like life analysis for variables which
102 do not need PHI nodes. This enum describes whether or not a particular
103 variable may need a PHI node. */
105 enum need_phi_state {
106 /* This is the default. If we are still in this state after finding
107 all the definition and use sites, then we will assume the variable
108 needs PHI nodes. This is probably an overly conservative assumption. */
109 NEED_PHI_STATE_UNKNOWN,
111 /* This state indicates that we have seen one or more sets of the
112 variable in a single basic block and that the sets dominate all
113 uses seen so far. If after finding all definition and use sites
114 we are still in this state, then the variable does not need any
115 PHI nodes. */
116 NEED_PHI_STATE_NO,
118 /* This state indicates that we have either seen multiple definitions of
119 the variable in multiple blocks, or that we encountered a use in a
120 block that was not dominated by the block containing the set(s) of
121 this variable. This variable is assumed to need PHI nodes. */
122 NEED_PHI_STATE_MAYBE
126 /* When computing aliasing information, we represent the memory pointed-to
127 by pointers with artificial variables called "memory tags" (MT). There
128 are two kinds of tags: type and name. Type tags (TMT) are used in
129 type-based alias analysis, they represent all the pointed-to locations
130 and variables of the same alias set class. Name tags (NMT) are used in
131 flow-sensitive points-to alias analysis, they represent the variables
132 and memory locations pointed-to by a specific SSA_NAME pointer. */
133 enum mem_tag_kind {
134 /* This variable is not a memory tag. */
135 NOT_A_TAG,
137 /* This variable is a type memory tag (TMT). */
138 TYPE_TAG,
140 /* This variable is a name memory tag (NMT). */
141 NAME_TAG,
143 /* This variable represents a structure field. */
144 STRUCT_FIELD
146 struct subvar;
147 typedef struct subvar *subvar_t;
149 /* This structure represents a fake sub-variable for a structure field. */
151 struct subvar GTY(())
153 /* Fake variable name */
154 tree var;
155 /* Offset inside structure. */
156 HOST_WIDE_INT offset;
157 /* Size of field. */
158 HOST_WIDE_INT size;
159 /* Next subvar for this structure. */
160 subvar_t next;
163 struct var_ann_d GTY(())
165 struct tree_ann_common_d common;
167 /* Used by the out of SSA pass to determine whether this variable has
168 been seen yet or not. */
169 unsigned out_of_ssa_tag : 1;
171 /* Used when building root_var structures in tree_ssa_live.[ch]. */
172 unsigned root_var_processed : 1;
174 /* If nonzero, this variable is a memory tag. */
175 ENUM_BITFIELD (mem_tag_kind) mem_tag_kind : 2;
177 /* Nonzero if this variable is an alias tag that represents references to
178 other variables (i.e., this variable appears in the MAY_ALIASES array
179 of other variables). */
180 unsigned is_alias_tag : 1;
182 /* Nonzero if this variable was used after SSA optimizations were
183 applied. We set this when translating out of SSA form. */
184 unsigned used : 1;
186 /* This field indicates whether or not the variable may need PHI nodes.
187 See the enum's definition for more detailed information about the
188 states. */
189 ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
191 /* Used during operand processing to determine if this variable is already
192 in the vuse list. */
193 unsigned in_vuse_list : 1;
195 /* Used during operand processing to determine if this variable is already
196 in the v_may_def list. */
197 unsigned in_v_may_def_list : 1;
199 /* An artificial variable representing the memory location pointed-to by
200 all the pointers that TBAA (type-based alias analysis) considers
201 to be aliased. If the variable is not a pointer or if it is never
202 dereferenced, this must be NULL. */
203 tree type_mem_tag;
205 /* Variables that may alias this variable. */
206 varray_type may_aliases;
208 /* Unique ID of this variable. */
209 size_t uid;
211 /* Used when going out of SSA form to indicate which partition this
212 variable represents storage for. */
213 unsigned partition;
215 /* Used by the root-var object in tree-ssa-live.[ch]. */
216 unsigned root_index;
218 /* Default definition for this symbol. If this field is not NULL, it
219 means that the first reference to this variable in the function is a
220 USE or a VUSE. In those cases, the SSA renamer creates an SSA name
221 for this variable with an empty defining statement. */
222 tree default_def;
224 /* During into-ssa and the dominator optimizer, this field holds the
225 current version of this variable (an SSA_NAME).
227 This was previously two varrays (one in into-ssa the other in the
228 dominator optimizer). That is wasteful, particularly since the
229 dominator optimizer calls into-ssa resulting in having two varrays
230 live at the same time and this can happen for each call to the
231 dominator optimizer. */
232 tree current_def;
234 subvar_t subvars;
238 typedef struct immediate_use_iterator_d
240 ssa_imm_use_t *imm_use;
241 ssa_imm_use_t *end_p;
242 ssa_imm_use_t iter_node;
243 } imm_use_iterator;
246 /* Use this iterator when simply looking at stmts. Adding, deleting or
247 modifying stmts will cause this iterator to malfunction. */
249 #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR) \
250 for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR)); \
251 !end_readonly_imm_use_p (&(ITER)); \
252 (DEST) = next_readonly_imm_use (&(ITER)))
255 #define FOR_EACH_IMM_USE_SAFE(DEST, ITER, SSAVAR) \
256 for ((DEST) = first_safe_imm_use (&(ITER), (SSAVAR)); \
257 !end_safe_imm_use_p (&(ITER)); \
258 (DEST) = next_safe_imm_use (&(ITER)))
260 #define BREAK_FROM_SAFE_IMM_USE(ITER) \
262 end_safe_imm_use_traverse (&(ITER)); \
263 break; \
266 struct stmt_ann_d GTY(())
268 struct tree_ann_common_d common;
270 /* Nonzero if the statement has been modified (meaning that the operands
271 need to be scanned again). */
272 unsigned modified : 1;
274 /* Nonzero if the statement makes aliased loads. */
275 unsigned makes_aliased_loads : 1;
277 /* Nonzero if the statement makes aliased stores. */
278 unsigned makes_aliased_stores : 1;
280 /* Nonzero if the statement makes references to volatile storage. */
281 unsigned has_volatile_ops : 1;
283 /* Nonzero if the statement makes a function call that may clobber global
284 and local addressable variables. */
285 unsigned makes_clobbering_call : 1;
287 /* Basic block that contains this statement. */
288 basic_block GTY ((skip (""))) bb;
290 /* Operand cache for stmt. */
291 struct stmt_operands_d operands;
293 /* Set of variables that have had their address taken in the statement. */
294 bitmap addresses_taken;
296 /* Unique identifier for this statement. These ID's are to be created
297 by each pass on an as-needed basis in any order convenient for the
298 pass which needs statement UIDs. */
299 unsigned int uid;
301 /* Linked list of histograms for value-based profiling. This is really a
302 struct histogram_value*. We use void* to avoid having to export that
303 everywhere, and to avoid having to put it in GC memory. */
305 void * GTY ((skip (""))) histograms;
308 union tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
310 struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
311 struct var_ann_d GTY((tag ("VAR_ANN"))) decl;
312 struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
315 extern GTY(()) VEC(tree) *modified_noreturn_calls;
317 typedef union tree_ann_d *tree_ann_t;
318 typedef struct var_ann_d *var_ann_t;
319 typedef struct stmt_ann_d *stmt_ann_t;
321 static inline tree_ann_t tree_ann (tree);
322 static inline tree_ann_t get_tree_ann (tree);
323 static inline var_ann_t var_ann (tree);
324 static inline var_ann_t get_var_ann (tree);
325 static inline stmt_ann_t stmt_ann (tree);
326 static inline stmt_ann_t get_stmt_ann (tree);
327 static inline enum tree_ann_type ann_type (tree_ann_t);
328 static inline basic_block bb_for_stmt (tree);
329 extern void set_bb_for_stmt (tree, basic_block);
330 static inline bool noreturn_call_p (tree);
331 static inline void update_stmt (tree);
332 static inline bool stmt_modified_p (tree);
333 static inline varray_type may_aliases (tree);
334 static inline int get_lineno (tree);
335 static inline const char *get_filename (tree);
336 static inline bool is_exec_stmt (tree);
337 static inline bool is_label_stmt (tree);
338 static inline v_may_def_optype get_v_may_def_ops (stmt_ann_t);
339 static inline vuse_optype get_vuse_ops (stmt_ann_t);
340 static inline use_optype get_use_ops (stmt_ann_t);
341 static inline def_optype get_def_ops (stmt_ann_t);
342 static inline bitmap addresses_taken (tree);
343 static inline void set_default_def (tree, tree);
344 static inline tree default_def (tree);
346 /*---------------------------------------------------------------------------
347 Structure representing predictions in tree level.
348 ---------------------------------------------------------------------------*/
349 struct edge_prediction GTY((chain_next ("%h.next")))
351 struct edge_prediction *next;
352 edge edge;
353 enum br_predictor predictor;
354 int probability;
357 /*---------------------------------------------------------------------------
358 Block annotations stored in basic_block.tree_annotations
359 ---------------------------------------------------------------------------*/
360 struct bb_ann_d GTY(())
362 /* Chain of PHI nodes for this block. */
363 tree phi_nodes;
365 /* Nonzero if this block contains an escape point (see is_escape_site). */
366 unsigned has_escape_site : 1;
368 /* Nonzero if one or more incoming edges to this block should be threaded
369 to an outgoing edge of this block. */
370 unsigned incoming_edge_threaded : 1;
372 struct edge_prediction *predictions;
375 typedef struct bb_ann_d *bb_ann_t;
377 /* Accessors for basic block annotations. */
378 static inline bb_ann_t bb_ann (basic_block);
379 static inline tree phi_nodes (basic_block);
380 static inline void set_phi_nodes (basic_block, tree);
382 /*---------------------------------------------------------------------------
383 Global declarations
384 ---------------------------------------------------------------------------*/
385 /* Array of all variables referenced in the function. */
386 extern GTY(()) varray_type referenced_vars;
388 #define num_referenced_vars VARRAY_ACTIVE_SIZE (referenced_vars)
389 #define referenced_var(i) VARRAY_TREE (referenced_vars, i)
391 /* Array of all SSA_NAMEs used in the function. */
392 extern GTY(()) varray_type ssa_names;
394 #define num_ssa_names VARRAY_ACTIVE_SIZE (ssa_names)
395 #define ssa_name(i) VARRAY_TREE (ssa_names, i)
397 /* Artificial variable used to model the effects of function calls. */
398 extern GTY(()) tree global_var;
400 /* Call clobbered variables in the function. If bit I is set, then
401 REFERENCED_VARS (I) is call-clobbered. */
402 extern bitmap call_clobbered_vars;
404 /* Addressable variables in the function. If bit I is set, then
405 REFERENCED_VARS (I) has had its address taken. */
406 extern bitmap addressable_vars;
408 /* 'true' after aliases have been computed (see compute_may_aliases). */
409 extern bool aliases_computed_p;
411 /* Macros for showing usage statistics. */
412 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
413 ? (x) \
414 : ((x) < 1024*1024*10 \
415 ? (x) / 1024 \
416 : (x) / (1024*1024))))
418 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
420 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
422 /*---------------------------------------------------------------------------
423 Block iterators
424 ---------------------------------------------------------------------------*/
426 typedef struct {
427 tree_stmt_iterator tsi;
428 basic_block bb;
429 } block_stmt_iterator;
431 static inline block_stmt_iterator bsi_start (basic_block);
432 static inline block_stmt_iterator bsi_last (basic_block);
433 static inline block_stmt_iterator bsi_after_labels (basic_block);
434 block_stmt_iterator bsi_for_stmt (tree);
435 static inline bool bsi_end_p (block_stmt_iterator);
436 static inline void bsi_next (block_stmt_iterator *);
437 static inline void bsi_prev (block_stmt_iterator *);
438 static inline tree bsi_stmt (block_stmt_iterator);
439 static inline tree * bsi_stmt_ptr (block_stmt_iterator);
441 extern void bsi_remove (block_stmt_iterator *);
442 extern void bsi_move_before (block_stmt_iterator *, block_stmt_iterator *);
443 extern void bsi_move_after (block_stmt_iterator *, block_stmt_iterator *);
444 extern void bsi_move_to_bb_end (block_stmt_iterator *, basic_block);
446 enum bsi_iterator_update
448 /* Note that these are intentionally in the same order as TSI_FOO. They
449 mean exactly the same as their TSI_* counterparts. */
450 BSI_NEW_STMT,
451 BSI_SAME_STMT,
452 BSI_CHAIN_START,
453 BSI_CHAIN_END,
454 BSI_CONTINUE_LINKING
457 extern void bsi_insert_before (block_stmt_iterator *, tree,
458 enum bsi_iterator_update);
459 extern void bsi_insert_after (block_stmt_iterator *, tree,
460 enum bsi_iterator_update);
462 extern void bsi_replace (const block_stmt_iterator *, tree, bool);
464 /*---------------------------------------------------------------------------
465 Function prototypes
466 ---------------------------------------------------------------------------*/
467 /* In tree-cfg.c */
469 /* Location to track pending stmt for edge insertion. */
470 #define PENDING_STMT(e) ((e)->insns.t)
472 extern void delete_tree_cfg_annotations (void);
473 extern void disband_implicit_edges (void);
474 extern bool stmt_ends_bb_p (tree);
475 extern bool is_ctrl_stmt (tree);
476 extern bool is_ctrl_altering_stmt (tree);
477 extern bool computed_goto_p (tree);
478 extern bool simple_goto_p (tree);
479 extern void tree_dump_bb (basic_block, FILE *, int);
480 extern void debug_tree_bb (basic_block);
481 extern basic_block debug_tree_bb_n (int);
482 extern void dump_tree_cfg (FILE *, int);
483 extern void debug_tree_cfg (int);
484 extern void dump_cfg_stats (FILE *);
485 extern void debug_cfg_stats (void);
486 extern void debug_loop_ir (void);
487 extern void print_loop_ir (FILE *);
488 extern void cleanup_dead_labels (void);
489 extern void group_case_labels (void);
490 extern bool cleanup_tree_cfg (void);
491 extern void cleanup_tree_cfg_loop (void);
492 extern tree first_stmt (basic_block);
493 extern tree last_stmt (basic_block);
494 extern tree *last_stmt_ptr (basic_block);
495 extern tree last_and_only_stmt (basic_block);
496 extern edge find_taken_edge (basic_block, tree);
497 extern void cfg_remove_useless_stmts (void);
498 extern basic_block label_to_block (tree);
499 extern void bsi_insert_on_edge (edge, tree);
500 extern basic_block bsi_insert_on_edge_immediate (edge, tree);
501 extern void bsi_commit_one_edge_insert (edge, basic_block *);
502 extern void bsi_commit_edge_inserts (void);
503 extern void notice_special_calls (tree);
504 extern void clear_special_calls (void);
505 extern void verify_stmts (void);
506 extern tree tree_block_label (basic_block);
507 extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
508 extern bool tree_duplicate_sese_region (edge, edge, basic_block *, unsigned,
509 basic_block *);
510 extern void add_phi_args_after_copy_bb (basic_block);
511 extern void add_phi_args_after_copy (basic_block *, unsigned);
512 extern void rewrite_to_new_ssa_names_bb (basic_block, struct htab *);
513 extern void rewrite_to_new_ssa_names (basic_block *, unsigned, htab_t);
514 extern void allocate_ssa_names (bitmap, struct htab **);
515 extern bool tree_purge_dead_eh_edges (basic_block);
516 extern bool tree_purge_all_dead_eh_edges (bitmap);
517 extern tree gimplify_val (block_stmt_iterator *, tree, tree);
518 extern tree gimplify_build1 (block_stmt_iterator *, enum tree_code,
519 tree, tree);
520 extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
521 tree, tree, tree);
522 extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
523 tree, tree, tree, tree);
525 /* In tree-pretty-print.c. */
526 extern void dump_generic_bb (FILE *, basic_block, int, int);
528 /* In tree-dfa.c */
529 extern var_ann_t create_var_ann (tree);
530 extern stmt_ann_t create_stmt_ann (tree);
531 extern tree_ann_t create_tree_ann (tree);
532 extern void reserve_phi_args_for_new_edge (basic_block);
533 extern tree create_phi_node (tree, basic_block);
534 extern void add_phi_arg (tree, tree, edge);
535 extern void remove_phi_args (edge);
536 extern void remove_phi_node (tree, tree);
537 extern void remove_all_phi_nodes_for (bitmap);
538 extern tree phi_reverse (tree);
539 extern void dump_dfa_stats (FILE *);
540 extern void debug_dfa_stats (void);
541 extern void debug_referenced_vars (void);
542 extern void dump_referenced_vars (FILE *);
543 extern void dump_variable (FILE *, tree);
544 extern void debug_variable (tree);
545 extern tree get_virtual_var (tree);
546 extern void add_referenced_tmp_var (tree);
547 extern void mark_new_vars_to_rename (tree, bitmap);
548 extern void find_new_referenced_vars (tree *);
549 void mark_call_clobbered_vars_to_rename (void);
551 extern tree make_rename_temp (tree, const char *);
553 /* In gimple-low.c */
554 extern void record_vars (tree);
555 extern bool block_may_fallthru (tree block);
557 typedef tree tree_on_heap;
558 DEF_VEC_MALLOC_P (tree_on_heap);
560 /* In tree-ssa-alias.c */
561 extern void dump_may_aliases_for (FILE *, tree);
562 extern void debug_may_aliases_for (tree);
563 extern void dump_alias_info (FILE *);
564 extern void debug_alias_info (void);
565 extern void dump_points_to_info (FILE *);
566 extern void debug_points_to_info (void);
567 extern void dump_points_to_info_for (FILE *, tree);
568 extern void debug_points_to_info_for (tree);
569 extern bool may_be_aliased (tree);
570 extern struct ptr_info_def *get_ptr_info (tree);
571 static inline subvar_t get_subvars_for_var (tree);
572 static inline bool ref_contains_array_ref (tree);
573 extern tree okay_component_ref_for_subvars (tree, HOST_WIDE_INT *,
574 HOST_WIDE_INT *);
575 static inline bool var_can_have_subvars (tree);
576 static inline bool overlap_subvar (HOST_WIDE_INT, HOST_WIDE_INT,
577 subvar_t, bool *);
579 /* Call-back function for walk_use_def_chains(). At each reaching
580 definition, a function with this prototype is called. */
581 typedef bool (*walk_use_def_chains_fn) (tree, tree, void *);
584 /* In tree-ssa.c */
585 extern void init_tree_ssa (void);
586 extern void dump_tree_ssa (FILE *);
587 extern void debug_tree_ssa (void);
588 extern void debug_def_blocks (void);
589 extern void dump_tree_ssa_stats (FILE *);
590 extern void debug_tree_ssa_stats (void);
591 extern edge ssa_redirect_edge (edge, basic_block);
592 extern void flush_pending_stmts (edge);
593 extern bool tree_ssa_useless_type_conversion (tree);
594 extern bool tree_ssa_useless_type_conversion_1 (tree, tree);
595 extern void verify_ssa (bool);
596 extern void delete_tree_ssa (void);
597 extern void register_new_def (tree, VEC (tree_on_heap) **);
598 extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
599 extern void kill_redundant_phi_nodes (void);
600 extern bool stmt_references_memory_p (tree);
602 /* In tree-into-ssa.c */
603 extern void rewrite_into_ssa (bool);
604 extern void rewrite_ssa_into_ssa (void);
605 extern void rewrite_def_def_chains (void);
607 void compute_global_livein (bitmap, bitmap);
608 tree duplicate_ssa_name (tree, tree);
610 /* In tree-ssa-ccp.c */
611 bool fold_stmt (tree *);
612 tree widen_bitfield (tree, tree, tree);
614 /* In tree-ssa-dom.c */
615 extern void dump_dominator_optimization_stats (FILE *);
616 extern void debug_dominator_optimization_stats (void);
618 /* In tree-ssa-copy.c */
619 extern void propagate_value (use_operand_p, tree);
620 extern void propagate_tree_value (tree *, tree);
621 extern void replace_exp (use_operand_p, tree);
622 extern bool may_propagate_copy (tree, tree);
623 extern bool may_propagate_copy_into_asm (tree);
625 /* Description of number of iterations of a loop. All the expressions inside
626 the structure can be evaluated at the end of the loop's preheader
627 (and due to ssa form, also anywhere inside the body of the loop). */
629 struct tree_niter_desc
631 tree assumptions; /* The boolean expression. If this expression evaluates
632 to false, then the other fields in this structure
633 should not be used; there is no guarantee that they
634 will be correct. */
635 tree may_be_zero; /* The boolean expression. If it evaluates to true,
636 the loop will exit in the first iteration (i.e.
637 its latch will not be executed), even if the niter
638 field says otherwise. */
639 tree niter; /* The expression giving the number of iterations of
640 a loop (provided that assumptions == true and
641 may_be_zero == false), more precisely the number
642 of executions of the latch of the loop. */
643 tree additional_info; /* The boolean expression. Sometimes we use additional
644 knowledge to simplify the other expressions
645 contained in this structure (for example the
646 knowledge about value ranges of operands on entry to
647 the loop). If this is a case, conjunction of such
648 condition is stored in this field, so that we do not
649 lose the information: for example if may_be_zero
650 is (n <= 0) and niter is (unsigned) n, we know
651 that the number of iterations is at most
652 MAX_SIGNED_INT. However if the (n <= 0) assumption
653 is eliminated (by looking at the guard on entry of
654 the loop), then the information would be lost. */
657 /* In tree-vectorizer.c */
658 void vectorize_loops (struct loops *);
660 /* In tree-ssa-phiopt.c */
661 bool empty_block_p (basic_block);
663 /* In tree-ssa-loop*.c */
665 void tree_ssa_lim (struct loops *);
666 void tree_ssa_unswitch_loops (struct loops *);
667 void canonicalize_induction_variables (struct loops *);
668 void tree_unroll_loops_completely (struct loops *);
669 void tree_ssa_iv_optimize (struct loops *);
671 bool number_of_iterations_exit (struct loop *, edge,
672 struct tree_niter_desc *niter);
673 tree find_loop_niter (struct loop *, edge *);
674 tree loop_niter_by_eval (struct loop *, edge);
675 tree find_loop_niter_by_eval (struct loop *, edge *);
676 void estimate_numbers_of_iterations (struct loops *);
677 tree can_count_iv_in_wider_type (struct loop *, tree, tree, tree, tree);
678 void free_numbers_of_iterations_estimates (struct loops *);
679 void rewrite_into_loop_closed_ssa (bitmap);
680 void verify_loop_closed_ssa (void);
681 void loop_commit_inserts (void);
682 bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
683 void create_iv (tree, tree, tree, struct loop *, block_stmt_iterator *, bool,
684 tree *, tree *);
685 void split_loop_exit_edge (edge);
686 basic_block bsi_insert_on_edge_immediate_loop (edge, tree);
687 void standard_iv_increment_position (struct loop *, block_stmt_iterator *,
688 bool *);
689 basic_block ip_end_pos (struct loop *);
690 basic_block ip_normal_pos (struct loop *);
691 bool tree_duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
692 unsigned int, sbitmap,
693 edge, edge *,
694 unsigned int *, int);
695 struct loop *tree_ssa_loop_version (struct loops *, struct loop *, tree,
696 basic_block *);
698 /* In tree-ssa-loop-im.c */
699 /* The possibilities of statement movement. */
701 enum move_pos
703 MOVE_IMPOSSIBLE, /* No movement -- side effect expression. */
704 MOVE_PRESERVE_EXECUTION, /* Must not cause the non-executed statement
705 become executed -- memory accesses, ... */
706 MOVE_POSSIBLE /* Unlimited movement. */
708 extern enum move_pos movement_possibility (tree);
710 /* In tree-flow-inline.h */
711 static inline bool is_call_clobbered (tree);
712 static inline void mark_call_clobbered (tree);
713 static inline void set_is_used (tree);
715 /* In tree-eh.c */
716 extern void make_eh_edges (tree);
717 extern bool tree_could_trap_p (tree);
718 extern bool tree_could_throw_p (tree);
719 extern bool tree_can_throw_internal (tree);
720 extern bool tree_can_throw_external (tree);
721 extern int lookup_stmt_eh_region (tree);
722 extern void add_stmt_to_eh_region (tree, int);
723 extern bool remove_stmt_from_eh_region (tree);
724 extern bool maybe_clean_eh_stmt (tree);
726 /* In tree-ssa-pre.c */
727 void add_to_value (tree, tree);
728 void debug_value_expressions (tree);
729 void print_value_expressions (FILE *, tree);
732 /* In tree-vn.c */
733 bool expressions_equal_p (tree, tree);
734 tree get_value_handle (tree);
735 hashval_t vn_compute (tree, hashval_t, vuse_optype);
736 tree vn_lookup_or_add (tree, vuse_optype);
737 void vn_add (tree, tree, vuse_optype);
738 tree vn_lookup (tree, vuse_optype);
739 void vn_init (void);
740 void vn_delete (void);
742 /* In tree-ssa-sink.c */
743 bool is_hidden_global_store (tree);
745 /* In tree-sra.c */
746 void insert_edge_copies (tree, basic_block);
748 /* In tree-loop-linear.c */
749 extern void linear_transform_loops (struct loops *);
751 /* In tree-ssa-loop-ivopts.c */
752 extern bool expr_invariant_in_loop_p (struct loop *, tree);
753 /* In gimplify.c */
755 tree force_gimple_operand (tree, tree *, bool, tree);
757 #include "tree-flow-inline.h"
759 #endif /* _TREE_FLOW_H */