OSDN Git Service

* Makefile.in (LIBGCOV): Add _gcov_interval_profiler,
[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 /* True if the code is in ssa form.  */
42 extern bool in_ssa_p;
43
44 /*---------------------------------------------------------------------------
45                       Attributes for SSA_NAMEs.
46   
47   NOTE: These structures are stored in struct tree_ssa_name
48   but are only used by the tree optimizers, so it makes better sense
49   to declare them here to avoid recompiling unrelated files when
50   making changes.
51 ---------------------------------------------------------------------------*/
52
53 /* Aliasing information for SSA_NAMEs representing pointer variables.  */
54 struct ptr_info_def GTY(())
55 {
56   /* Nonzero if points-to analysis couldn't determine where this pointer
57      is pointing to.  */
58   unsigned int pt_anything : 1;
59
60   /* Nonzero if this pointer is the result of a call to malloc.  */
61   unsigned int pt_malloc : 1;
62
63   /* Nonzero if the value of this pointer escapes the current function.  */
64   unsigned int value_escapes_p : 1;
65
66   /* Nonzero if this pointer is dereferenced.  */
67   unsigned int is_dereferenced : 1;
68
69   /* Nonzero if this pointer points to a global variable.  */
70   unsigned int pt_global_mem : 1;
71
72   /* Nonzero if this pointer points to NULL.  */
73   unsigned int pt_null : 1;
74
75   /* Set of variables that this pointer may point to.  */
76   bitmap pt_vars;
77
78   /* If this pointer has been dereferenced, and points-to information is
79      more precise than type-based aliasing, indirect references to this
80      pointer will be represented by this memory tag, instead of the type
81      tag computed by TBAA.  */
82   tree name_mem_tag;
83 };
84
85
86 /* Types of value ranges.  */
87 enum value_range_type { VR_UNDEFINED, VR_RANGE, VR_ANTI_RANGE, VR_VARYING };
88
89
90 /* Ranges of values that can be associated with an SSA_NAME after VRP
91    has executed.  */
92 struct value_range_def GTY(())
93 {
94   /* Lattice value represented by this range.  */
95   enum value_range_type type;
96
97   /* Minimum and maximum values represented by this range.  These
98      values are _CST nodes that should be interpreted as follows:
99
100         - If TYPE == VR_UNDEFINED then MIN and MAX must be NULL.
101
102         - If TYPE == VR_RANGE then MIN holds the minimum value and
103           MAX holds the maximum value of the range [MIN, MAX].
104
105         - If TYPE == ANTI_RANGE the variable is known to NOT
106           take any values in the range [MIN, MAX].  */
107   tree min;
108   tree max;
109 };
110
111 typedef struct value_range_def value_range;
112
113
114 /*---------------------------------------------------------------------------
115                    Tree annotations stored in tree_common.ann
116 ---------------------------------------------------------------------------*/
117 enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, STMT_ANN };
118
119 struct tree_ann_common_d GTY(())
120 {
121   /* Annotation type.  */
122   enum tree_ann_type type;
123
124  /* Auxiliary info specific to a pass.  At all times, this
125     should either point to valid data or be NULL.  */
126   PTR GTY ((skip (""))) aux;
127
128   /* The value handle for this expression.  Used by GVN-PRE.  */
129   tree GTY((skip)) value_handle;
130 };
131
132 /* It is advantageous to avoid things like life analysis for variables which
133    do not need PHI nodes.  This enum describes whether or not a particular
134    variable may need a PHI node.  */
135
136 enum need_phi_state {
137   /* This is the default.  If we are still in this state after finding
138      all the definition and use sites, then we will assume the variable
139      needs PHI nodes.  This is probably an overly conservative assumption.  */
140   NEED_PHI_STATE_UNKNOWN,
141
142   /* This state indicates that we have seen one or more sets of the 
143      variable in a single basic block and that the sets dominate all
144      uses seen so far.  If after finding all definition and use sites
145      we are still in this state, then the variable does not need any
146      PHI nodes.  */
147   NEED_PHI_STATE_NO,
148
149   /* This state indicates that we have either seen multiple definitions of
150      the variable in multiple blocks, or that we encountered a use in a
151      block that was not dominated by the block containing the set(s) of
152      this variable.  This variable is assumed to need PHI nodes.  */
153   NEED_PHI_STATE_MAYBE
154 };
155
156
157 /* When computing aliasing information, we represent the memory pointed-to
158    by pointers with artificial variables called "memory tags" (MT).  There
159    are two kinds of tags: type and name.  Type tags (TMT) are used in
160    type-based alias analysis, they represent all the pointed-to locations
161    and variables of the same alias set class.  Name tags (NMT) are used in
162    flow-sensitive points-to alias analysis, they represent the variables
163    and memory locations pointed-to by a specific SSA_NAME pointer.  */
164 enum mem_tag_kind {
165   /* This variable is not a memory tag.  */
166   NOT_A_TAG,
167
168   /* This variable is a type memory tag (TMT).  */
169   TYPE_TAG,
170
171   /* This variable is a name memory tag (NMT).  */
172   NAME_TAG,
173
174   /* This variable represents a structure field.  */
175   STRUCT_FIELD
176 };
177 struct subvar;
178 typedef struct subvar *subvar_t;
179
180 /* This structure represents a fake sub-variable for a structure field.  */
181
182 struct subvar GTY(())
183 {
184   /* Fake variable name */
185   tree var;
186   /* Offset inside structure.  */
187   HOST_WIDE_INT offset;
188   /* Size of field.  */
189   HOST_WIDE_INT size;
190   /* Next subvar for this structure.  */
191   subvar_t next;
192 };
193
194 struct var_ann_d GTY(())
195 {
196   struct tree_ann_common_d common;
197
198   /* Used by the out of SSA pass to determine whether this variable has
199      been seen yet or not.  */
200   unsigned out_of_ssa_tag : 1;
201
202   /* Used when building root_var structures in tree_ssa_live.[ch].  */
203   unsigned root_var_processed : 1;
204
205   /* If nonzero, this variable is a memory tag.  */
206   ENUM_BITFIELD (mem_tag_kind) mem_tag_kind : 2;
207
208   /* Nonzero if this variable is an alias tag that represents references to
209      other variables (i.e., this variable appears in the MAY_ALIASES array
210      of other variables).  */
211   unsigned is_alias_tag : 1;
212
213   /* Nonzero if this variable was used after SSA optimizations were
214      applied.  We set this when translating out of SSA form.  */
215   unsigned used : 1;
216
217   /* This field indicates whether or not the variable may need PHI nodes.
218      See the enum's definition for more detailed information about the
219      states.  */
220   ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
221
222   /* Used during operand processing to determine if this variable is already 
223      in the vuse list.  */
224   unsigned in_vuse_list : 1;
225
226   /* Used during operand processing to determine if this variable is already 
227      in the v_may_def list.  */
228   unsigned in_v_may_def_list : 1;
229
230   /* An artificial variable representing the memory location pointed-to by
231      all the pointers that TBAA (type-based alias analysis) considers
232      to be aliased.  If the variable is not a pointer or if it is never
233      dereferenced, this must be NULL.  */
234   tree type_mem_tag;
235
236   /* Variables that may alias this variable.  */
237   varray_type may_aliases;
238
239   /* Unique ID of this variable.  */
240   size_t uid;
241
242   /* Used when going out of SSA form to indicate which partition this
243      variable represents storage for.  */
244   unsigned partition;
245
246   /* Used by the root-var object in tree-ssa-live.[ch].  */
247   unsigned root_index;
248
249   /* Default definition for this symbol.  If this field is not NULL, it
250      means that the first reference to this variable in the function is a
251      USE or a VUSE.  In those cases, the SSA renamer creates an SSA name
252      for this variable with an empty defining statement.  */
253   tree default_def;
254
255   /* During into-ssa and the dominator optimizer, this field holds the
256      current version of this variable (an SSA_NAME). 
257
258      This was previously two varrays (one in into-ssa the other in the
259      dominator optimizer).  That is wasteful, particularly since the
260      dominator optimizer calls into-ssa resulting in having two varrays
261      live at the same time and this can happen for each call to the
262      dominator optimizer.  */
263   tree current_def;
264   
265   subvar_t subvars;
266 };
267
268
269 typedef struct immediate_use_iterator_d
270 {
271   ssa_imm_use_t *imm_use;
272   ssa_imm_use_t *end_p;
273   ssa_imm_use_t iter_node;
274 } imm_use_iterator;
275
276
277 /* Use this iterator when simply looking at stmts.  Adding, deleting or
278    modifying stmts will cause this iterator to malfunction.  */
279
280 #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR)                       \
281   for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR));     \
282        !end_readonly_imm_use_p (&(ITER));                       \
283        (DEST) = next_readonly_imm_use (&(ITER)))
284   
285
286 #define FOR_EACH_IMM_USE_SAFE(DEST, ITER, SSAVAR)               \
287   for ((DEST) = first_safe_imm_use (&(ITER), (SSAVAR));         \
288        !end_safe_imm_use_p (&(ITER));                           \
289        (DEST) = next_safe_imm_use (&(ITER)))
290
291 #define BREAK_FROM_SAFE_IMM_USE(ITER)                           \
292    {                                                            \
293      end_safe_imm_use_traverse (&(ITER));                       \
294      break;                                                     \
295    }
296
297 struct stmt_ann_d GTY(())
298 {
299   struct tree_ann_common_d common;
300
301   /* Nonzero if the statement has been modified (meaning that the operands
302      need to be scanned again).  */
303   unsigned modified : 1;
304
305   /* Nonzero if the statement makes aliased loads.  */
306   unsigned makes_aliased_loads : 1;
307
308   /* Nonzero if the statement makes aliased stores.  */
309   unsigned makes_aliased_stores : 1;
310
311   /* Nonzero if the statement makes references to volatile storage.  */
312   unsigned has_volatile_ops : 1;
313
314   /* Nonzero if the statement makes a function call that may clobber global
315      and local addressable variables.  */
316   unsigned makes_clobbering_call : 1;
317
318   /* Basic block that contains this statement.  */
319   basic_block GTY ((skip (""))) bb;
320
321   /* Operand cache for stmt.  */
322   struct stmt_operands_d operands;
323
324   /* Set of variables that have had their address taken in the statement.  */
325   bitmap addresses_taken;
326
327   /* Unique identifier for this statement.  These ID's are to be created
328      by each pass on an as-needed basis in any order convenient for the
329      pass which needs statement UIDs.  */
330   unsigned int uid;
331
332   /* Linked list of histograms for value-based profiling.  This is really a
333      struct histogram_value*.  We use void* to avoid having to export that
334      everywhere, and to avoid having to put it in GC memory.  */
335   
336   void * GTY ((skip (""))) histograms;
337 };
338
339 union tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
340 {
341   struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
342   struct var_ann_d GTY((tag ("VAR_ANN"))) decl;
343   struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
344 };
345
346 extern GTY(()) VEC(tree,gc) *modified_noreturn_calls;
347
348 typedef union tree_ann_d *tree_ann_t;
349 typedef struct var_ann_d *var_ann_t;
350 typedef struct stmt_ann_d *stmt_ann_t;
351
352 static inline tree_ann_t tree_ann (tree);
353 static inline tree_ann_t get_tree_ann (tree);
354 static inline var_ann_t var_ann (tree);
355 static inline var_ann_t get_var_ann (tree);
356 static inline stmt_ann_t stmt_ann (tree);
357 static inline stmt_ann_t get_stmt_ann (tree);
358 static inline enum tree_ann_type ann_type (tree_ann_t);
359 static inline basic_block bb_for_stmt (tree);
360 extern void set_bb_for_stmt (tree, basic_block);
361 static inline bool noreturn_call_p (tree);
362 static inline void update_stmt (tree);
363 static inline bool stmt_modified_p (tree);
364 static inline varray_type may_aliases (tree);
365 static inline int get_lineno (tree);
366 static inline const char *get_filename (tree);
367 static inline bool is_exec_stmt (tree);
368 static inline bool is_label_stmt (tree);
369 static inline v_may_def_optype get_v_may_def_ops (stmt_ann_t);
370 static inline vuse_optype get_vuse_ops (stmt_ann_t);
371 static inline use_optype get_use_ops (stmt_ann_t);
372 static inline def_optype get_def_ops (stmt_ann_t);
373 static inline bitmap addresses_taken (tree);
374 static inline void set_default_def (tree, tree);
375 static inline tree default_def (tree);
376
377 /*---------------------------------------------------------------------------
378                   Structure representing predictions in tree level.
379 ---------------------------------------------------------------------------*/
380 struct edge_prediction GTY((chain_next ("%h.next")))
381 {
382   struct edge_prediction *next;
383   edge edge;
384   enum br_predictor predictor;
385   int probability;
386 };
387
388 /*---------------------------------------------------------------------------
389                   Block annotations stored in basic_block.tree_annotations
390 ---------------------------------------------------------------------------*/
391 struct bb_ann_d GTY(())
392 {
393   /* Chain of PHI nodes for this block.  */
394   tree phi_nodes;
395
396   /* Nonzero if this block contains an escape point (see is_escape_site).  */
397   unsigned has_escape_site : 1;
398
399   /* Nonzero if one or more incoming edges to this block should be threaded
400      to an outgoing edge of this block.  */
401   unsigned incoming_edge_threaded : 1;
402
403   struct edge_prediction *predictions;
404 };
405
406 typedef struct bb_ann_d *bb_ann_t;
407
408 /* Accessors for basic block annotations.  */
409 static inline bb_ann_t bb_ann (basic_block);
410 static inline tree phi_nodes (basic_block);
411 static inline void set_phi_nodes (basic_block, tree);
412
413 /*---------------------------------------------------------------------------
414                               Global declarations
415 ---------------------------------------------------------------------------*/
416 /* Array of all variables referenced in the function.  */
417 extern GTY(()) varray_type referenced_vars;
418
419 #define num_referenced_vars VARRAY_ACTIVE_SIZE (referenced_vars)
420 #define referenced_var(i) VARRAY_TREE (referenced_vars, i)
421
422 /* Array of all SSA_NAMEs used in the function.  */
423 extern GTY(()) varray_type ssa_names;
424
425 #define num_ssa_names VARRAY_ACTIVE_SIZE (ssa_names)
426 #define ssa_name(i) VARRAY_TREE (ssa_names, i)
427
428 /* Artificial variable used to model the effects of function calls.  */
429 extern GTY(()) tree global_var;
430
431 /* Call clobbered variables in the function.  If bit I is set, then
432    REFERENCED_VARS (I) is call-clobbered.  */
433 extern bitmap call_clobbered_vars;
434
435 /* Addressable variables in the function.  If bit I is set, then
436    REFERENCED_VARS (I) has had its address taken.  */
437 extern bitmap addressable_vars;
438
439 /* 'true' after aliases have been computed (see compute_may_aliases).  */
440 extern bool aliases_computed_p;
441
442 /* Macros for showing usage statistics.  */
443 #define SCALE(x) ((unsigned long) ((x) < 1024*10        \
444                   ? (x)                                 \
445                   : ((x) < 1024*1024*10                 \
446                      ? (x) / 1024                       \
447                      : (x) / (1024*1024))))
448
449 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
450
451 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
452
453 /*---------------------------------------------------------------------------
454                               Block iterators
455 ---------------------------------------------------------------------------*/
456
457 typedef struct {
458   tree_stmt_iterator tsi;
459   basic_block bb;
460 } block_stmt_iterator;
461
462 static inline block_stmt_iterator bsi_start (basic_block);
463 static inline block_stmt_iterator bsi_last (basic_block);
464 static inline block_stmt_iterator bsi_after_labels (basic_block);
465 block_stmt_iterator bsi_for_stmt (tree);
466 static inline bool bsi_end_p (block_stmt_iterator);
467 static inline void bsi_next (block_stmt_iterator *);
468 static inline void bsi_prev (block_stmt_iterator *);
469 static inline tree bsi_stmt (block_stmt_iterator);
470 static inline tree * bsi_stmt_ptr (block_stmt_iterator);
471
472 extern void bsi_remove (block_stmt_iterator *);
473 extern void bsi_move_before (block_stmt_iterator *, block_stmt_iterator *);
474 extern void bsi_move_after (block_stmt_iterator *, block_stmt_iterator *);
475 extern void bsi_move_to_bb_end (block_stmt_iterator *, basic_block);
476
477 enum bsi_iterator_update
478 {
479   /* Note that these are intentionally in the same order as TSI_FOO.  They
480      mean exactly the same as their TSI_* counterparts.  */
481   BSI_NEW_STMT,
482   BSI_SAME_STMT,
483   BSI_CHAIN_START,
484   BSI_CHAIN_END,
485   BSI_CONTINUE_LINKING
486 };
487
488 extern void bsi_insert_before (block_stmt_iterator *, tree,
489                                enum bsi_iterator_update);
490 extern void bsi_insert_after (block_stmt_iterator *, tree,
491                               enum bsi_iterator_update);
492
493 extern void bsi_replace (const block_stmt_iterator *, tree, bool);
494
495 /*---------------------------------------------------------------------------
496                               Function prototypes
497 ---------------------------------------------------------------------------*/
498 /* In tree-cfg.c  */
499
500 /* Location to track pending stmt for edge insertion.  */
501 #define PENDING_STMT(e) ((e)->insns.t)
502
503 extern void delete_tree_cfg_annotations (void);
504 extern void disband_implicit_edges (void);
505 extern bool stmt_ends_bb_p (tree);
506 extern bool is_ctrl_stmt (tree);
507 extern bool is_ctrl_altering_stmt (tree);
508 extern bool computed_goto_p (tree);
509 extern bool simple_goto_p (tree);
510 extern void tree_dump_bb (basic_block, FILE *, int);
511 extern void debug_tree_bb (basic_block);
512 extern basic_block debug_tree_bb_n (int);
513 extern void dump_tree_cfg (FILE *, int);
514 extern void debug_tree_cfg (int);
515 extern void dump_cfg_stats (FILE *);
516 extern void debug_cfg_stats (void);
517 extern void debug_loop_ir (void);
518 extern void print_loop_ir (FILE *);
519 extern void cleanup_dead_labels (void);
520 extern void group_case_labels (void);
521 extern bool cleanup_tree_cfg (void);
522 extern void cleanup_tree_cfg_loop (void);
523 extern tree first_stmt (basic_block);
524 extern tree last_stmt (basic_block);
525 extern tree *last_stmt_ptr (basic_block);
526 extern tree last_and_only_stmt (basic_block);
527 extern edge find_taken_edge (basic_block, tree);
528 extern basic_block label_to_block_fn (struct function *, tree);
529 #define label_to_block(t) (label_to_block_fn (cfun, t))
530 extern void bsi_insert_on_edge (edge, tree);
531 extern basic_block bsi_insert_on_edge_immediate (edge, tree);
532 extern void bsi_commit_one_edge_insert (edge, basic_block *);
533 extern void bsi_commit_edge_inserts (void);
534 extern void notice_special_calls (tree);
535 extern void clear_special_calls (void);
536 extern void verify_stmts (void);
537 extern tree tree_block_label (basic_block);
538 extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
539 extern bool tree_duplicate_sese_region (edge, edge, basic_block *, unsigned,
540                                         basic_block *);
541 extern void add_phi_args_after_copy_bb (basic_block);
542 extern void add_phi_args_after_copy (basic_block *, unsigned);
543 extern void rewrite_to_new_ssa_names_bb (basic_block, struct htab *);
544 extern void rewrite_to_new_ssa_names (basic_block *, unsigned, htab_t);
545 extern void allocate_ssa_names (bitmap, struct htab **);
546 extern bool tree_purge_dead_eh_edges (basic_block);
547 extern bool tree_purge_all_dead_eh_edges (bitmap);
548 extern tree gimplify_val (block_stmt_iterator *, tree, tree);
549 extern tree gimplify_build1 (block_stmt_iterator *, enum tree_code,
550                              tree, tree);
551 extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
552                              tree, tree, tree);
553 extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
554                              tree, tree, tree, tree);
555
556 /* In tree-pretty-print.c.  */
557 extern void dump_generic_bb (FILE *, basic_block, int, int);
558
559 /* In tree-dfa.c  */
560 extern var_ann_t create_var_ann (tree);
561 extern stmt_ann_t create_stmt_ann (tree);
562 extern tree_ann_t create_tree_ann (tree);
563 extern void reserve_phi_args_for_new_edge (basic_block);
564 extern tree create_phi_node (tree, basic_block);
565 extern void add_phi_arg (tree, tree, edge);
566 extern void remove_phi_args (edge);
567 extern void remove_phi_node (tree, tree);
568 extern tree find_phi_node_for (basic_block, tree, tree *);
569 extern tree phi_reverse (tree);
570 extern void dump_dfa_stats (FILE *);
571 extern void debug_dfa_stats (void);
572 extern void debug_referenced_vars (void);
573 extern void dump_referenced_vars (FILE *);
574 extern void dump_variable (FILE *, tree);
575 extern void debug_variable (tree);
576 extern tree get_virtual_var (tree);
577 extern void add_referenced_tmp_var (tree);
578 extern void mark_new_vars_to_rename (tree);
579 extern void find_new_referenced_vars (tree *);
580
581 extern tree make_rename_temp (tree, const char *);
582
583 /* In gimple-low.c  */
584 extern void record_vars (tree);
585 extern bool block_may_fallthru (tree block);
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,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
803 /* In gimplify.c  */
804 tree force_gimple_operand (tree, tree *, bool, tree);
805 tree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree);
806
807 #include "tree-flow-inline.h"
808
809 #endif /* _TREE_FLOW_H  */