OSDN Git Service

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