OSDN Git Service

* Makefile.in: Add function.h to BASIC_BLOCK_H. Remove all
[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 void cfg_remove_useless_stmts (void);
526 extern basic_block label_to_block_fn (struct function *, tree);
527 #define label_to_block(t) (label_to_block_fn (cfun, t))
528 extern void bsi_insert_on_edge (edge, tree);
529 extern basic_block bsi_insert_on_edge_immediate (edge, tree);
530 extern void bsi_commit_one_edge_insert (edge, basic_block *);
531 extern void bsi_commit_edge_inserts (void);
532 extern void notice_special_calls (tree);
533 extern void clear_special_calls (void);
534 extern void verify_stmts (void);
535 extern tree tree_block_label (basic_block);
536 extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
537 extern bool tree_duplicate_sese_region (edge, edge, basic_block *, unsigned,
538                                         basic_block *);
539 extern void add_phi_args_after_copy_bb (basic_block);
540 extern void add_phi_args_after_copy (basic_block *, unsigned);
541 extern void rewrite_to_new_ssa_names_bb (basic_block, struct htab *);
542 extern void rewrite_to_new_ssa_names (basic_block *, unsigned, htab_t);
543 extern void allocate_ssa_names (bitmap, struct htab **);
544 extern bool tree_purge_dead_eh_edges (basic_block);
545 extern bool tree_purge_all_dead_eh_edges (bitmap);
546 extern tree gimplify_val (block_stmt_iterator *, tree, tree);
547 extern tree gimplify_build1 (block_stmt_iterator *, enum tree_code,
548                              tree, tree);
549 extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
550                              tree, tree, tree);
551 extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
552                              tree, tree, tree, tree);
553
554 /* In tree-pretty-print.c.  */
555 extern void dump_generic_bb (FILE *, basic_block, int, int);
556
557 /* In tree-dfa.c  */
558 extern var_ann_t create_var_ann (tree);
559 extern stmt_ann_t create_stmt_ann (tree);
560 extern tree_ann_t create_tree_ann (tree);
561 extern void reserve_phi_args_for_new_edge (basic_block);
562 extern tree create_phi_node (tree, basic_block);
563 extern void add_phi_arg (tree, tree, edge);
564 extern void remove_phi_args (edge);
565 extern void remove_phi_node (tree, tree);
566 extern tree find_phi_node_for (basic_block, tree, tree *);
567 extern tree phi_reverse (tree);
568 extern void dump_dfa_stats (FILE *);
569 extern void debug_dfa_stats (void);
570 extern void debug_referenced_vars (void);
571 extern void dump_referenced_vars (FILE *);
572 extern void dump_variable (FILE *, tree);
573 extern void debug_variable (tree);
574 extern tree get_virtual_var (tree);
575 extern void add_referenced_tmp_var (tree);
576 extern void mark_new_vars_to_rename (tree);
577 extern void find_new_referenced_vars (tree *);
578
579 extern tree make_rename_temp (tree, const char *);
580
581 /* In gimple-low.c  */
582 extern void record_vars (tree);
583 extern bool block_may_fallthru (tree block);
584
585 typedef tree tree_on_heap;
586 DEF_VEC_MALLOC_P (tree_on_heap);
587
588 /* In tree-ssa-alias.c  */
589 extern void dump_may_aliases_for (FILE *, tree);
590 extern void debug_may_aliases_for (tree);
591 extern void dump_alias_info (FILE *);
592 extern void debug_alias_info (void);
593 extern void dump_points_to_info (FILE *);
594 extern void debug_points_to_info (void);
595 extern void dump_points_to_info_for (FILE *, tree);
596 extern void debug_points_to_info_for (tree);
597 extern bool may_be_aliased (tree);
598 extern struct ptr_info_def *get_ptr_info (tree);
599 extern void add_type_alias (tree, tree);
600 extern void count_uses_and_derefs (tree, tree, unsigned *, unsigned *, bool *);
601 static inline subvar_t get_subvars_for_var (tree);
602 static inline bool ref_contains_array_ref (tree);
603 extern tree okay_component_ref_for_subvars (tree, HOST_WIDE_INT *,
604                                             HOST_WIDE_INT *);
605 static inline bool var_can_have_subvars (tree);
606 static inline bool overlap_subvar (HOST_WIDE_INT, HOST_WIDE_INT,
607                                    subvar_t, bool *);
608
609 /* Call-back function for walk_use_def_chains().  At each reaching
610    definition, a function with this prototype is called.  */
611 typedef bool (*walk_use_def_chains_fn) (tree, tree, void *);
612
613
614 /* In tree-ssa.c  */
615 extern void init_tree_ssa (void);
616 extern void dump_tree_ssa (FILE *);
617 extern void debug_tree_ssa (void);
618 extern void debug_def_blocks (void);
619 extern void dump_tree_ssa_stats (FILE *);
620 extern void debug_tree_ssa_stats (void);
621 extern edge ssa_redirect_edge (edge, basic_block);
622 extern void flush_pending_stmts (edge);
623 extern bool tree_ssa_useless_type_conversion (tree);
624 extern bool tree_ssa_useless_type_conversion_1 (tree, tree);
625 extern void verify_ssa (bool);
626 extern void delete_tree_ssa (void);
627 extern void register_new_def (tree, VEC (tree_on_heap) **);
628 extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
629 extern bool stmt_references_memory_p (tree);
630
631 /* In tree-into-ssa.c  */
632 extern void rewrite_ssa_into_ssa (void);
633
634 void update_ssa (unsigned);
635 void register_new_name_mapping (tree, tree);
636 tree create_new_def_for (tree, tree, def_operand_p);
637 bool need_ssa_update_p (void);
638 bool name_registered_for_update_p (tree);
639 bitmap ssa_names_to_replace (void);
640 void release_ssa_name_after_update_ssa (tree name);
641 void dump_repl_tbl (FILE *);
642 void debug_repl_tbl (void);
643 void dump_names_replaced_by (FILE *, tree);
644 void debug_names_replaced_by (tree);
645 void compute_global_livein (bitmap, bitmap);
646 tree duplicate_ssa_name (tree, tree);
647 void mark_sym_for_renaming (tree);
648 void mark_set_for_renaming (bitmap);
649
650 /* In tree-ssa-ccp.c  */
651 bool fold_stmt (tree *);
652 tree widen_bitfield (tree, tree, tree);
653
654 /* In tree-vrp.c  */
655 value_range *get_value_range (tree);
656 void dump_value_range (FILE *, value_range *);
657 void debug_value_range (value_range *);
658 void dump_all_value_ranges (FILE *);
659 void debug_all_value_ranges (void);
660 bool expr_computes_nonzero (tree);
661
662 /* In tree-ssa-dom.c  */
663 extern void dump_dominator_optimization_stats (FILE *);
664 extern void debug_dominator_optimization_stats (void);
665 int loop_depth_of_name (tree);
666
667 /* In tree-ssa-copy.c  */
668 extern void propagate_value (use_operand_p, tree);
669 extern void propagate_tree_value (tree *, tree);
670 extern void replace_exp (use_operand_p, tree);
671 extern bool may_propagate_copy (tree, tree);
672 extern bool may_propagate_copy_into_asm (tree);
673
674 /* Description of number of iterations of a loop.  All the expressions inside
675    the structure can be evaluated at the end of the loop's preheader
676    (and due to ssa form, also anywhere inside the body of the loop).  */
677
678 struct tree_niter_desc
679 {
680   tree assumptions;     /* The boolean expression.  If this expression evaluates
681                            to false, then the other fields in this structure
682                            should not be used; there is no guarantee that they
683                            will be correct.  */
684   tree may_be_zero;     /* The boolean expression.  If it evaluates to true,
685                            the loop will exit in the first iteration (i.e.
686                            its latch will not be executed), even if the niter
687                            field says otherwise.  */
688   tree niter;           /* The expression giving the number of iterations of
689                            a loop (provided that assumptions == true and
690                            may_be_zero == false), more precisely the number
691                            of executions of the latch of the loop.  */
692   tree additional_info; /* The boolean expression.  Sometimes we use additional
693                            knowledge to simplify the other expressions
694                            contained in this structure (for example the
695                            knowledge about value ranges of operands on entry to
696                            the loop).  If this is a case, conjunction of such
697                            condition is stored in this field, so that we do not
698                            lose the information: for example if may_be_zero
699                            is (n <= 0) and niter is (unsigned) n, we know
700                            that the number of iterations is at most
701                            MAX_SIGNED_INT.  However if the (n <= 0) assumption
702                            is eliminated (by looking at the guard on entry of
703                            the loop), then the information would be lost.  */
704 };
705
706 /* In tree-vectorizer.c */
707 void vectorize_loops (struct loops *);
708
709 /* In tree-ssa-phiopt.c */
710 bool empty_block_p (basic_block);
711
712 /* In tree-ssa-loop*.c  */
713
714 void tree_ssa_lim (struct loops *);
715 void tree_ssa_unswitch_loops (struct loops *);
716 void canonicalize_induction_variables (struct loops *);
717 void tree_unroll_loops_completely (struct loops *);
718 void tree_ssa_iv_optimize (struct loops *);
719
720 bool number_of_iterations_exit (struct loop *, edge,
721                                 struct tree_niter_desc *niter);
722 tree find_loop_niter (struct loop *, edge *);
723 tree loop_niter_by_eval (struct loop *, edge);
724 tree find_loop_niter_by_eval (struct loop *, edge *);
725 void estimate_numbers_of_iterations (struct loops *);
726 tree can_count_iv_in_wider_type (struct loop *, tree, tree, tree, tree);
727 void free_numbers_of_iterations_estimates (struct loops *);
728 void rewrite_into_loop_closed_ssa (bitmap);
729 void verify_loop_closed_ssa (void);
730 void loop_commit_inserts (void);
731 bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
732 void create_iv (tree, tree, tree, struct loop *, block_stmt_iterator *, bool,
733                 tree *, tree *);
734 void split_loop_exit_edge (edge);
735 basic_block bsi_insert_on_edge_immediate_loop (edge, tree);
736 void standard_iv_increment_position (struct loop *, block_stmt_iterator *,
737                                      bool *);
738 basic_block ip_end_pos (struct loop *);
739 basic_block ip_normal_pos (struct loop *);
740 bool tree_duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
741                                          unsigned int, sbitmap,
742                                          edge, edge *,
743                                          unsigned int *, int);
744 struct loop *tree_ssa_loop_version (struct loops *, struct loop *, tree,
745                                     basic_block *);
746
747 /* In tree-ssa-loop-im.c  */
748 /* The possibilities of statement movement.  */
749
750 enum move_pos
751   {
752     MOVE_IMPOSSIBLE,            /* No movement -- side effect expression.  */
753     MOVE_PRESERVE_EXECUTION,    /* Must not cause the non-executed statement
754                                    become executed -- memory accesses, ... */
755     MOVE_POSSIBLE               /* Unlimited movement.  */
756   };
757 extern enum move_pos movement_possibility (tree);
758
759 /* In tree-flow-inline.h  */
760 static inline bool is_call_clobbered (tree);
761 static inline void mark_call_clobbered (tree);
762 static inline void set_is_used (tree);
763 static inline bool unmodifiable_var_p (tree);
764
765 /* In tree-eh.c  */
766 extern void make_eh_edges (tree);
767 extern bool tree_could_trap_p (tree);
768 extern bool tree_could_throw_p (tree);
769 extern bool tree_can_throw_internal (tree);
770 extern bool tree_can_throw_external (tree);
771 extern int lookup_stmt_eh_region (tree);
772 extern void add_stmt_to_eh_region (tree, int);
773 extern bool remove_stmt_from_eh_region (tree);
774 extern bool maybe_clean_eh_stmt (tree);
775
776 /* In tree-ssa-pre.c  */
777 void add_to_value (tree, tree);
778 void debug_value_expressions (tree);
779 void print_value_expressions (FILE *, tree);
780
781
782 /* In tree-vn.c  */
783 bool expressions_equal_p (tree, tree);
784 tree get_value_handle (tree);
785 hashval_t vn_compute (tree, hashval_t, vuse_optype);
786 tree vn_lookup_or_add (tree, vuse_optype);
787 void vn_add (tree, tree, vuse_optype);
788 tree vn_lookup (tree, vuse_optype);
789 void vn_init (void);
790 void vn_delete (void);
791
792 /* In tree-ssa-sink.c  */
793 bool is_hidden_global_store (tree);
794
795 /* In tree-sra.c  */
796 void insert_edge_copies (tree, basic_block);
797
798 /* In tree-loop-linear.c  */
799 extern void linear_transform_loops (struct loops *);
800
801 /* In tree-ssa-loop-ivopts.c  */
802 extern bool expr_invariant_in_loop_p (struct loop *, tree);
803 /* In gimplify.c  */
804
805 tree force_gimple_operand (tree, tree *, bool, tree);
806
807 #include "tree-flow-inline.h"
808
809 #endif /* _TREE_FLOW_H  */