OSDN Git Service

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