OSDN Git Service

PR bootstrap/21215
[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   tree current_def;
258   
259   /* If this variable is a structure, this fields holds a list of
260      symbols representing each of the fields of the structure.  */
261   subvar_t subvars;
262 };
263
264
265 typedef struct immediate_use_iterator_d
266 {
267   ssa_imm_use_t *imm_use;
268   ssa_imm_use_t *end_p;
269   ssa_imm_use_t iter_node;
270 } imm_use_iterator;
271
272
273 /* Use this iterator when simply looking at stmts.  Adding, deleting or
274    modifying stmts will cause this iterator to malfunction.  */
275
276 #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR)                       \
277   for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR));     \
278        !end_readonly_imm_use_p (&(ITER));                       \
279        (DEST) = next_readonly_imm_use (&(ITER)))
280   
281
282 #define FOR_EACH_IMM_USE_SAFE(DEST, ITER, SSAVAR)               \
283   for ((DEST) = first_safe_imm_use (&(ITER), (SSAVAR));         \
284        !end_safe_imm_use_p (&(ITER));                           \
285        (DEST) = next_safe_imm_use (&(ITER)))
286
287 #define BREAK_FROM_SAFE_IMM_USE(ITER)                           \
288    {                                                            \
289      end_safe_imm_use_traverse (&(ITER));                       \
290      break;                                                     \
291    }
292
293 struct stmt_ann_d GTY(())
294 {
295   struct tree_ann_common_d common;
296
297   /* Nonzero if the statement has been modified (meaning that the operands
298      need to be scanned again).  */
299   unsigned modified : 1;
300
301   /* Nonzero if the statement makes aliased loads.  */
302   unsigned makes_aliased_loads : 1;
303
304   /* Nonzero if the statement makes aliased stores.  */
305   unsigned makes_aliased_stores : 1;
306
307   /* Nonzero if the statement makes references to volatile storage.  */
308   unsigned has_volatile_ops : 1;
309
310   /* Nonzero if the statement makes a function call that may clobber global
311      and local addressable variables.  */
312   unsigned makes_clobbering_call : 1;
313
314   /* Basic block that contains this statement.  */
315   basic_block GTY ((skip (""))) bb;
316
317   /* Operand cache for stmt.  */
318   struct stmt_operands_d operands;
319
320   /* Set of variables that have had their address taken in the statement.  */
321   bitmap addresses_taken;
322
323   /* Unique identifier for this statement.  These ID's are to be created
324      by each pass on an as-needed basis in any order convenient for the
325      pass which needs statement UIDs.  */
326   unsigned int uid;
327
328   /* Linked list of histograms for value-based profiling.  This is really a
329      struct histogram_value*.  We use void* to avoid having to export that
330      everywhere, and to avoid having to put it in GC memory.  */
331   
332   void * GTY ((skip (""))) histograms;
333 };
334
335 union tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
336 {
337   struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
338   struct var_ann_d GTY((tag ("VAR_ANN"))) decl;
339   struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
340 };
341
342 extern GTY(()) VEC(tree,gc) *modified_noreturn_calls;
343
344 typedef union tree_ann_d *tree_ann_t;
345 typedef struct var_ann_d *var_ann_t;
346 typedef struct stmt_ann_d *stmt_ann_t;
347
348 static inline tree_ann_t tree_ann (tree);
349 static inline tree_ann_t get_tree_ann (tree);
350 static inline var_ann_t var_ann (tree);
351 static inline var_ann_t get_var_ann (tree);
352 static inline stmt_ann_t stmt_ann (tree);
353 static inline stmt_ann_t get_stmt_ann (tree);
354 static inline enum tree_ann_type ann_type (tree_ann_t);
355 static inline basic_block bb_for_stmt (tree);
356 extern void set_bb_for_stmt (tree, basic_block);
357 static inline bool noreturn_call_p (tree);
358 static inline void update_stmt (tree);
359 static inline bool stmt_modified_p (tree);
360 static inline varray_type may_aliases (tree);
361 static inline int get_lineno (tree);
362 static inline const char *get_filename (tree);
363 static inline bool is_exec_stmt (tree);
364 static inline bool is_label_stmt (tree);
365 static inline v_may_def_optype get_v_may_def_ops (stmt_ann_t);
366 static inline vuse_optype get_vuse_ops (stmt_ann_t);
367 static inline use_optype get_use_ops (stmt_ann_t);
368 static inline def_optype get_def_ops (stmt_ann_t);
369 static inline bitmap addresses_taken (tree);
370 static inline void set_default_def (tree, tree);
371 static inline tree default_def (tree);
372
373 /*---------------------------------------------------------------------------
374                   Structure representing predictions in tree level.
375 ---------------------------------------------------------------------------*/
376 struct edge_prediction GTY((chain_next ("%h.next")))
377 {
378   struct edge_prediction *next;
379   edge edge;
380   enum br_predictor predictor;
381   int probability;
382 };
383
384 /*---------------------------------------------------------------------------
385                   Block annotations stored in basic_block.tree_annotations
386 ---------------------------------------------------------------------------*/
387 struct bb_ann_d GTY(())
388 {
389   /* Chain of PHI nodes for this block.  */
390   tree phi_nodes;
391
392   /* Nonzero if this block contains an escape point (see is_escape_site).  */
393   unsigned has_escape_site : 1;
394
395   /* Nonzero if one or more incoming edges to this block should be threaded
396      to an outgoing edge of this block.  */
397   unsigned incoming_edge_threaded : 1;
398
399   struct edge_prediction *predictions;
400 };
401
402 typedef struct bb_ann_d *bb_ann_t;
403
404 /* Accessors for basic block annotations.  */
405 static inline bb_ann_t bb_ann (basic_block);
406 static inline tree phi_nodes (basic_block);
407 static inline void set_phi_nodes (basic_block, tree);
408
409 /*---------------------------------------------------------------------------
410                               Global declarations
411 ---------------------------------------------------------------------------*/
412 /* Array of all variables referenced in the function.  */
413 extern GTY(()) varray_type referenced_vars;
414
415 #define num_referenced_vars VARRAY_ACTIVE_SIZE (referenced_vars)
416 #define referenced_var(i) VARRAY_TREE (referenced_vars, i)
417
418 /* Array of all SSA_NAMEs used in the function.  */
419 extern GTY(()) varray_type ssa_names;
420
421 #define num_ssa_names VARRAY_ACTIVE_SIZE (ssa_names)
422 #define ssa_name(i) VARRAY_TREE (ssa_names, i)
423
424 /* Artificial variable used to model the effects of function calls.  */
425 extern GTY(()) tree global_var;
426
427 /* Call clobbered variables in the function.  If bit I is set, then
428    REFERENCED_VARS (I) is call-clobbered.  */
429 extern bitmap call_clobbered_vars;
430
431 /* Addressable variables in the function.  If bit I is set, then
432    REFERENCED_VARS (I) has had its address taken.  */
433 extern bitmap addressable_vars;
434
435 /* 'true' after aliases have been computed (see compute_may_aliases).  */
436 extern bool aliases_computed_p;
437
438 /* Macros for showing usage statistics.  */
439 #define SCALE(x) ((unsigned long) ((x) < 1024*10        \
440                   ? (x)                                 \
441                   : ((x) < 1024*1024*10                 \
442                      ? (x) / 1024                       \
443                      : (x) / (1024*1024))))
444
445 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
446
447 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
448
449 /*---------------------------------------------------------------------------
450                               Block iterators
451 ---------------------------------------------------------------------------*/
452
453 typedef struct {
454   tree_stmt_iterator tsi;
455   basic_block bb;
456 } block_stmt_iterator;
457
458 static inline block_stmt_iterator bsi_start (basic_block);
459 static inline block_stmt_iterator bsi_last (basic_block);
460 static inline block_stmt_iterator bsi_after_labels (basic_block);
461 block_stmt_iterator bsi_for_stmt (tree);
462 static inline bool bsi_end_p (block_stmt_iterator);
463 static inline void bsi_next (block_stmt_iterator *);
464 static inline void bsi_prev (block_stmt_iterator *);
465 static inline tree bsi_stmt (block_stmt_iterator);
466 static inline tree * bsi_stmt_ptr (block_stmt_iterator);
467
468 extern void bsi_remove (block_stmt_iterator *);
469 extern void bsi_move_before (block_stmt_iterator *, block_stmt_iterator *);
470 extern void bsi_move_after (block_stmt_iterator *, block_stmt_iterator *);
471 extern void bsi_move_to_bb_end (block_stmt_iterator *, basic_block);
472
473 enum bsi_iterator_update
474 {
475   /* Note that these are intentionally in the same order as TSI_FOO.  They
476      mean exactly the same as their TSI_* counterparts.  */
477   BSI_NEW_STMT,
478   BSI_SAME_STMT,
479   BSI_CHAIN_START,
480   BSI_CHAIN_END,
481   BSI_CONTINUE_LINKING
482 };
483
484 extern void bsi_insert_before (block_stmt_iterator *, tree,
485                                enum bsi_iterator_update);
486 extern void bsi_insert_after (block_stmt_iterator *, tree,
487                               enum bsi_iterator_update);
488
489 extern void bsi_replace (const block_stmt_iterator *, tree, bool);
490
491 /*---------------------------------------------------------------------------
492                               Function prototypes
493 ---------------------------------------------------------------------------*/
494 /* In tree-cfg.c  */
495
496 /* Location to track pending stmt for edge insertion.  */
497 #define PENDING_STMT(e) ((e)->insns.t)
498
499 extern void delete_tree_cfg_annotations (void);
500 extern void disband_implicit_edges (void);
501 extern bool stmt_ends_bb_p (tree);
502 extern bool is_ctrl_stmt (tree);
503 extern bool is_ctrl_altering_stmt (tree);
504 extern bool computed_goto_p (tree);
505 extern bool simple_goto_p (tree);
506 extern void tree_dump_bb (basic_block, FILE *, int);
507 extern void debug_tree_bb (basic_block);
508 extern basic_block debug_tree_bb_n (int);
509 extern void dump_tree_cfg (FILE *, int);
510 extern void debug_tree_cfg (int);
511 extern void dump_cfg_stats (FILE *);
512 extern void debug_cfg_stats (void);
513 extern void debug_loop_ir (void);
514 extern void print_loop_ir (FILE *);
515 extern void cleanup_dead_labels (void);
516 extern void group_case_labels (void);
517 extern bool cleanup_tree_cfg (void);
518 extern void cleanup_tree_cfg_loop (void);
519 extern tree first_stmt (basic_block);
520 extern tree last_stmt (basic_block);
521 extern tree *last_stmt_ptr (basic_block);
522 extern tree last_and_only_stmt (basic_block);
523 extern edge find_taken_edge (basic_block, tree);
524 extern basic_block label_to_block_fn (struct function *, tree);
525 #define label_to_block(t) (label_to_block_fn (cfun, t))
526 extern void bsi_insert_on_edge (edge, tree);
527 extern basic_block bsi_insert_on_edge_immediate (edge, tree);
528 extern void bsi_commit_one_edge_insert (edge, basic_block *);
529 extern void bsi_commit_edge_inserts (void);
530 extern void notice_special_calls (tree);
531 extern void clear_special_calls (void);
532 extern void verify_stmts (void);
533 extern tree tree_block_label (basic_block);
534 extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
535 extern bool tree_duplicate_sese_region (edge, edge, basic_block *, unsigned,
536                                         basic_block *);
537 extern void add_phi_args_after_copy_bb (basic_block);
538 extern void add_phi_args_after_copy (basic_block *, unsigned);
539 extern bool tree_purge_dead_eh_edges (basic_block);
540 extern bool tree_purge_all_dead_eh_edges (bitmap);
541 extern tree gimplify_val (block_stmt_iterator *, tree, tree);
542 extern tree gimplify_build1 (block_stmt_iterator *, enum tree_code,
543                              tree, tree);
544 extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
545                              tree, tree, tree);
546 extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
547                              tree, tree, tree, tree);
548
549 /* In tree-pretty-print.c.  */
550 extern void dump_generic_bb (FILE *, basic_block, int, int);
551
552 /* In tree-dfa.c  */
553 extern var_ann_t create_var_ann (tree);
554 extern stmt_ann_t create_stmt_ann (tree);
555 extern tree_ann_t create_tree_ann (tree);
556 extern void reserve_phi_args_for_new_edge (basic_block);
557 extern tree create_phi_node (tree, basic_block);
558 extern void add_phi_arg (tree, tree, edge);
559 extern void remove_phi_args (edge);
560 extern void remove_phi_node (tree, tree);
561 extern tree phi_reverse (tree);
562 extern void dump_dfa_stats (FILE *);
563 extern void debug_dfa_stats (void);
564 extern void debug_referenced_vars (void);
565 extern void dump_referenced_vars (FILE *);
566 extern void dump_variable (FILE *, tree);
567 extern void debug_variable (tree);
568 extern tree get_virtual_var (tree);
569 extern void add_referenced_tmp_var (tree);
570 extern void mark_new_vars_to_rename (tree);
571 extern void find_new_referenced_vars (tree *);
572
573 extern tree make_rename_temp (tree, const char *);
574
575 /* In gimple-low.c  */
576 extern void record_vars (tree);
577 extern bool block_may_fallthru (tree block);
578
579 /* In tree-ssa-alias.c  */
580 extern void dump_may_aliases_for (FILE *, tree);
581 extern void debug_may_aliases_for (tree);
582 extern void dump_alias_info (FILE *);
583 extern void debug_alias_info (void);
584 extern void dump_points_to_info (FILE *);
585 extern void debug_points_to_info (void);
586 extern void dump_points_to_info_for (FILE *, tree);
587 extern void debug_points_to_info_for (tree);
588 extern bool may_be_aliased (tree);
589 extern struct ptr_info_def *get_ptr_info (tree);
590 extern void add_type_alias (tree, tree);
591 extern void count_uses_and_derefs (tree, tree, unsigned *, unsigned *, bool *);
592 static inline subvar_t get_subvars_for_var (tree);
593 static inline bool ref_contains_array_ref (tree);
594 extern tree okay_component_ref_for_subvars (tree, HOST_WIDE_INT *,
595                                             HOST_WIDE_INT *);
596 static inline bool var_can_have_subvars (tree);
597 static inline bool overlap_subvar (HOST_WIDE_INT, HOST_WIDE_INT,
598                                    subvar_t, bool *);
599
600 /* Call-back function for walk_use_def_chains().  At each reaching
601    definition, a function with this prototype is called.  */
602 typedef bool (*walk_use_def_chains_fn) (tree, tree, void *);
603
604
605 /* In tree-ssa.c  */
606 extern void init_tree_ssa (void);
607 extern edge ssa_redirect_edge (edge, basic_block);
608 extern void flush_pending_stmts (edge);
609 extern bool tree_ssa_useless_type_conversion (tree);
610 extern bool tree_ssa_useless_type_conversion_1 (tree, tree);
611 extern void verify_ssa (bool);
612 extern void delete_tree_ssa (void);
613 extern void register_new_def (tree, VEC(tree,heap) **);
614 extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
615 extern bool stmt_references_memory_p (tree);
616
617 /* In tree-into-ssa.c  */
618 void update_ssa (unsigned);
619 void delete_update_ssa (void);
620 void register_new_name_mapping (tree, tree);
621 tree create_new_def_for (tree, tree, def_operand_p);
622 bool need_ssa_update_p (void);
623 bool name_registered_for_update_p (tree);
624 bitmap ssa_names_to_replace (void);
625 void release_ssa_name_after_update_ssa (tree name);
626 void compute_global_livein (bitmap, bitmap);
627 tree duplicate_ssa_name (tree, tree);
628 void mark_sym_for_renaming (tree);
629 void mark_set_for_renaming (bitmap);
630 tree get_current_def (tree);
631 void set_current_def (tree, tree);
632
633 /* In tree-ssa-ccp.c  */
634 bool fold_stmt (tree *);
635 tree widen_bitfield (tree, tree, tree);
636
637 /* In tree-vrp.c  */
638 value_range *get_value_range (tree);
639 void dump_value_range (FILE *, value_range *);
640 void debug_value_range (value_range *);
641 void dump_all_value_ranges (FILE *);
642 void debug_all_value_ranges (void);
643 bool expr_computes_nonzero (tree);
644
645 /* In tree-ssa-dom.c  */
646 extern void dump_dominator_optimization_stats (FILE *);
647 extern void debug_dominator_optimization_stats (void);
648 int loop_depth_of_name (tree);
649
650 /* In tree-ssa-copy.c  */
651 extern void propagate_value (use_operand_p, tree);
652 extern void propagate_tree_value (tree *, tree);
653 extern void replace_exp (use_operand_p, tree);
654 extern bool may_propagate_copy (tree, tree);
655 extern bool may_propagate_copy_into_asm (tree);
656
657 /* Description of number of iterations of a loop.  All the expressions inside
658    the structure can be evaluated at the end of the loop's preheader
659    (and due to ssa form, also anywhere inside the body of the loop).  */
660
661 struct tree_niter_desc
662 {
663   tree assumptions;     /* The boolean expression.  If this expression evaluates
664                            to false, then the other fields in this structure
665                            should not be used; there is no guarantee that they
666                            will be correct.  */
667   tree may_be_zero;     /* The boolean expression.  If it evaluates to true,
668                            the loop will exit in the first iteration (i.e.
669                            its latch will not be executed), even if the niter
670                            field says otherwise.  */
671   tree niter;           /* The expression giving the number of iterations of
672                            a loop (provided that assumptions == true and
673                            may_be_zero == false), more precisely the number
674                            of executions of the latch of the loop.  */
675   tree additional_info; /* The boolean expression.  Sometimes we use additional
676                            knowledge to simplify the other expressions
677                            contained in this structure (for example the
678                            knowledge about value ranges of operands on entry to
679                            the loop).  If this is a case, conjunction of such
680                            condition is stored in this field, so that we do not
681                            lose the information: for example if may_be_zero
682                            is (n <= 0) and niter is (unsigned) n, we know
683                            that the number of iterations is at most
684                            MAX_SIGNED_INT.  However if the (n <= 0) assumption
685                            is eliminated (by looking at the guard on entry of
686                            the loop), then the information would be lost.  */
687 };
688
689 /* In tree-vectorizer.c */
690 void vectorize_loops (struct loops *);
691
692 /* In tree-ssa-phiopt.c */
693 bool empty_block_p (basic_block);
694
695 /* In tree-ssa-loop*.c  */
696
697 void tree_ssa_lim (struct loops *);
698 void tree_ssa_unswitch_loops (struct loops *);
699 void canonicalize_induction_variables (struct loops *);
700 void tree_unroll_loops_completely (struct loops *);
701 void tree_ssa_iv_optimize (struct loops *);
702
703 bool number_of_iterations_exit (struct loop *, edge,
704                                 struct tree_niter_desc *niter);
705 tree find_loop_niter (struct loop *, edge *);
706 tree loop_niter_by_eval (struct loop *, edge);
707 tree find_loop_niter_by_eval (struct loop *, edge *);
708 void estimate_numbers_of_iterations (struct loops *);
709 tree can_count_iv_in_wider_type (struct loop *, tree, tree, tree, tree);
710 void free_numbers_of_iterations_estimates (struct loops *);
711 void rewrite_into_loop_closed_ssa (bitmap, unsigned);
712 void verify_loop_closed_ssa (void);
713 void loop_commit_inserts (void);
714 bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
715 void create_iv (tree, tree, tree, struct loop *, block_stmt_iterator *, bool,
716                 tree *, tree *);
717 void split_loop_exit_edge (edge);
718 basic_block bsi_insert_on_edge_immediate_loop (edge, tree);
719 void standard_iv_increment_position (struct loop *, block_stmt_iterator *,
720                                      bool *);
721 basic_block ip_end_pos (struct loop *);
722 basic_block ip_normal_pos (struct loop *);
723 bool tree_duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
724                                          unsigned int, sbitmap,
725                                          edge, edge *,
726                                          unsigned int *, int);
727 struct loop *tree_ssa_loop_version (struct loops *, struct loop *, tree,
728                                     basic_block *);
729
730 /* In tree-ssa-loop-im.c  */
731 /* The possibilities of statement movement.  */
732
733 enum move_pos
734   {
735     MOVE_IMPOSSIBLE,            /* No movement -- side effect expression.  */
736     MOVE_PRESERVE_EXECUTION,    /* Must not cause the non-executed statement
737                                    become executed -- memory accesses, ... */
738     MOVE_POSSIBLE               /* Unlimited movement.  */
739   };
740 extern enum move_pos movement_possibility (tree);
741
742 /* In tree-flow-inline.h  */
743 static inline bool is_call_clobbered (tree);
744 static inline void mark_call_clobbered (tree);
745 static inline void set_is_used (tree);
746 static inline bool unmodifiable_var_p (tree);
747
748 /* In tree-eh.c  */
749 extern void make_eh_edges (tree);
750 extern bool tree_could_trap_p (tree);
751 extern bool tree_could_throw_p (tree);
752 extern bool tree_can_throw_internal (tree);
753 extern bool tree_can_throw_external (tree);
754 extern int lookup_stmt_eh_region (tree);
755 extern void add_stmt_to_eh_region (tree, int);
756 extern bool remove_stmt_from_eh_region (tree);
757 extern bool maybe_clean_eh_stmt (tree);
758
759 /* In tree-ssa-pre.c  */
760 void add_to_value (tree, tree);
761 void debug_value_expressions (tree);
762 void print_value_expressions (FILE *, tree);
763
764
765 /* In tree-vn.c  */
766 bool expressions_equal_p (tree, tree);
767 tree get_value_handle (tree);
768 hashval_t vn_compute (tree, hashval_t, vuse_optype);
769 tree vn_lookup_or_add (tree, vuse_optype);
770 void vn_add (tree, tree, vuse_optype);
771 tree vn_lookup (tree, vuse_optype);
772 void vn_init (void);
773 void vn_delete (void);
774
775 /* In tree-ssa-sink.c  */
776 bool is_hidden_global_store (tree);
777
778 /* In tree-sra.c  */
779 void insert_edge_copies (tree, basic_block);
780
781 /* In tree-loop-linear.c  */
782 extern void linear_transform_loops (struct loops *);
783
784 /* In tree-ssa-loop-ivopts.c  */
785 extern bool expr_invariant_in_loop_p (struct loop *, tree);
786
787 /* In gimplify.c  */
788 tree force_gimple_operand (tree, tree *, bool, tree);
789 tree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree);
790
791 #include "tree-flow-inline.h"
792
793 #endif /* _TREE_FLOW_H  */