OSDN Git Service

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