OSDN Git Service

* Makefile.in (tree-ssa-alias.o): Depend on tree-ssa-structalias.h
[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, 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, 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 typedef struct
45 {
46   htab_t htab;
47   PTR *slot;
48   PTR *limit;
49 } htab_iterator;
50
51 /* Iterate through the elements of hashtable HTAB, using htab_iterator ITER,
52    storing each element in RESULT, which is of type TYPE.  */
53 #define FOR_EACH_HTAB_ELEMENT(HTAB, RESULT, TYPE, ITER) \
54   for (RESULT = (TYPE) first_htab_element (&(ITER), (HTAB)); \
55         !end_htab_p (&(ITER)); \
56         RESULT = (TYPE) next_htab_element (&(ITER)))
57
58 /*---------------------------------------------------------------------------
59                       Attributes for SSA_NAMEs.
60   
61   NOTE: These structures are stored in struct tree_ssa_name
62   but are only used by the tree optimizers, so it makes better sense
63   to declare them here to avoid recompiling unrelated files when
64   making changes.
65 ---------------------------------------------------------------------------*/
66
67 /* Aliasing information for SSA_NAMEs representing pointer variables.  */
68 struct ptr_info_def GTY(())
69 {
70   /* Nonzero if points-to analysis couldn't determine where this pointer
71      is pointing to.  */
72   unsigned int pt_anything : 1;
73
74   /* Nonzero if the value of this pointer escapes the current function.  */
75   unsigned int value_escapes_p : 1;
76
77   /* Nonzero if this pointer is dereferenced.  */
78   unsigned int is_dereferenced : 1;
79
80   /* Nonzero if this pointer points to a global variable.  */
81   unsigned int pt_global_mem : 1;
82
83   /* Nonzero if this pointer points to NULL.  */
84   unsigned int pt_null : 1;
85
86   /* Set of variables that this pointer may point to.  */
87   bitmap pt_vars;
88
89   /* If this pointer has been dereferenced, and points-to information is
90      more precise than type-based aliasing, indirect references to this
91      pointer will be represented by this memory tag, instead of the type
92      tag computed by TBAA.  */
93   tree name_mem_tag;
94 };
95
96
97 /*---------------------------------------------------------------------------
98                    Tree annotations stored in tree_common.ann
99 ---------------------------------------------------------------------------*/
100 enum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, STMT_ANN };
101
102 struct tree_ann_common_d GTY(())
103 {
104   /* Annotation type.  */
105   enum tree_ann_type type;
106
107  /* Auxiliary info specific to a pass.  At all times, this
108     should either point to valid data or be NULL.  */ 
109   PTR GTY ((skip (""))) aux; 
110
111   /* The value handle for this expression.  Used by GVN-PRE.  */
112   tree GTY((skip)) value_handle;
113 };
114
115 /* It is advantageous to avoid things like life analysis for variables which
116    do not need PHI nodes.  This enum describes whether or not a particular
117    variable may need a PHI node.  */
118
119 enum need_phi_state {
120   /* This is the default.  If we are still in this state after finding
121      all the definition and use sites, then we will assume the variable
122      needs PHI nodes.  This is probably an overly conservative assumption.  */
123   NEED_PHI_STATE_UNKNOWN,
124
125   /* This state indicates that we have seen one or more sets of the 
126      variable in a single basic block and that the sets dominate all
127      uses seen so far.  If after finding all definition and use sites
128      we are still in this state, then the variable does not need any
129      PHI nodes.  */
130   NEED_PHI_STATE_NO,
131
132   /* This state indicates that we have either seen multiple definitions of
133      the variable in multiple blocks, or that we encountered a use in a
134      block that was not dominated by the block containing the set(s) of
135      this variable.  This variable is assumed to need PHI nodes.  */
136   NEED_PHI_STATE_MAYBE
137 };
138
139
140 /* When computing aliasing information, we represent the memory pointed-to
141    by pointers with artificial variables called "memory tags" (MT).  There
142    are two kinds of tags: type and name.  Type tags (TMT) are used in
143    type-based alias analysis, they represent all the pointed-to locations
144    and variables of the same alias set class.  Name tags (NMT) are used in
145    flow-sensitive points-to alias analysis, they represent the variables
146    and memory locations pointed-to by a specific SSA_NAME pointer.  */
147 enum mem_tag_kind {
148   /* This variable is not a memory tag.  */
149   NOT_A_TAG,
150
151   /* This variable is a type memory tag (TMT).  */
152   TYPE_TAG,
153
154   /* This variable is a name memory tag (NMT).  */
155   NAME_TAG,
156
157   /* This variable represents a structure field.  */
158   STRUCT_FIELD
159 };
160
161 struct subvar;
162 typedef struct subvar *subvar_t;
163
164 /* This structure represents a fake sub-variable for a structure field.  */
165 struct subvar GTY(())
166 {
167   /* Fake variable.  */
168   tree var;
169
170   /* Offset inside structure.  */
171   unsigned HOST_WIDE_INT offset;
172
173   /* Size of the field.  */
174   unsigned HOST_WIDE_INT size;
175
176   /* Next subvar for this structure.  */
177   subvar_t next;
178 };
179
180 struct var_ann_d GTY(())
181 {
182   struct tree_ann_common_d common;
183
184   /* Used by the out of SSA pass to determine whether this variable has
185      been seen yet or not.  */
186   unsigned out_of_ssa_tag : 1;
187
188   /* Used when building root_var structures in tree_ssa_live.[ch].  */
189   unsigned root_var_processed : 1;
190
191   /* If nonzero, this variable is a memory tag.  */
192   ENUM_BITFIELD (mem_tag_kind) mem_tag_kind : 2;
193
194   /* Nonzero if this variable is an alias tag that represents references to
195      other variables (i.e., this variable appears in the MAY_ALIASES array
196      of other variables).  */
197   unsigned is_alias_tag : 1;
198
199   /* Nonzero if this variable was used after SSA optimizations were
200      applied.  We set this when translating out of SSA form.  */
201   unsigned used : 1;
202
203   /* This field indicates whether or not the variable may need PHI nodes.
204      See the enum's definition for more detailed information about the
205      states.  */
206   ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
207
208   /* Used during operand processing to determine if this variable is already 
209      in the vuse list.  */
210   unsigned in_vuse_list : 1;
211
212   /* Used during operand processing to determine if this variable is already 
213      in the v_may_def list.  */
214   unsigned in_v_may_def_list : 1;
215
216   /* An artificial variable representing the memory location pointed-to by
217      all the pointers that TBAA (type-based alias analysis) considers
218      to be aliased.  If the variable is not a pointer or if it is never
219      dereferenced, this must be NULL.  */
220   tree type_mem_tag;
221
222   /* Variables that may alias this variable.  */
223   varray_type may_aliases;
224
225   /* Used when going out of SSA form to indicate which partition this
226      variable represents storage for.  */
227   unsigned partition;
228
229   /* Used by the root-var object in tree-ssa-live.[ch].  */
230   unsigned root_index;
231
232   /* Default definition for this symbol.  If this field is not NULL, it
233      means that the first reference to this variable in the function is a
234      USE or a VUSE.  In those cases, the SSA renamer creates an SSA name
235      for this variable with an empty defining statement.  */
236   tree default_def;
237
238   /* During into-ssa and the dominator optimizer, this field holds the
239      current version of this variable (an SSA_NAME).  */
240   tree current_def;
241   
242   /* If this variable is a structure, this fields holds a list of
243      symbols representing each of the fields of the structure.  */
244   subvar_t subvars;
245 };
246
247
248 typedef struct immediate_use_iterator_d
249 {
250   ssa_use_operand_t *imm_use;
251   ssa_use_operand_t *end_p;
252   ssa_use_operand_t iter_node;
253 } imm_use_iterator;
254
255
256 /* Use this iterator when simply looking at stmts.  Adding, deleting or
257    modifying stmts will cause this iterator to malfunction.  */
258
259 #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR)                       \
260   for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR));     \
261        !end_readonly_imm_use_p (&(ITER));                       \
262        (DEST) = next_readonly_imm_use (&(ITER)))
263   
264
265 #define FOR_EACH_IMM_USE_SAFE(DEST, ITER, SSAVAR)               \
266   for ((DEST) = first_safe_imm_use (&(ITER), (SSAVAR));         \
267        !end_safe_imm_use_p (&(ITER));                           \
268        (DEST) = next_safe_imm_use (&(ITER)))
269
270 #define BREAK_FROM_SAFE_IMM_USE(ITER)                           \
271    {                                                            \
272      end_safe_imm_use_traverse (&(ITER));                       \
273      break;                                                     \
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 bb;
299
300   /* Operand cache for stmt.  */
301   struct stmt_operands_d GTY ((skip (""))) operands;
302
303   /* Set of variables that have had their address taken in the statement.  */
304   bitmap addresses_taken;
305
306   /* Unique identifier for this statement.  These ID's are to be created
307      by each pass on an as-needed basis in any order convenient for the
308      pass which needs statement UIDs.  */
309   unsigned int uid;
310
311   /* Linked list of histograms for value-based profiling.  This is really a
312      struct histogram_value*.  We use void* to avoid having to export that
313      everywhere, and to avoid having to put it in GC memory.  */
314   
315   void * GTY ((skip (""))) histograms;
316 };
317
318 union tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
319 {
320   struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
321   struct var_ann_d GTY((tag ("VAR_ANN"))) decl;
322   struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
323 };
324
325 extern GTY(()) VEC(tree,gc) *modified_noreturn_calls;
326
327 typedef union tree_ann_d *tree_ann_t;
328 typedef struct var_ann_d *var_ann_t;
329 typedef struct stmt_ann_d *stmt_ann_t;
330
331 static inline tree_ann_t tree_ann (tree);
332 static inline tree_ann_t get_tree_ann (tree);
333 static inline var_ann_t var_ann (tree);
334 static inline var_ann_t get_var_ann (tree);
335 static inline stmt_ann_t stmt_ann (tree);
336 static inline stmt_ann_t get_stmt_ann (tree);
337 static inline enum tree_ann_type ann_type (tree_ann_t);
338 static inline basic_block bb_for_stmt (tree);
339 extern void set_bb_for_stmt (tree, basic_block);
340 static inline bool noreturn_call_p (tree);
341 static inline void update_stmt (tree);
342 static inline bool stmt_modified_p (tree);
343 static inline varray_type may_aliases (tree);
344 static inline int get_lineno (tree);
345 static inline const char *get_filename (tree);
346 static inline bool is_exec_stmt (tree);
347 static inline bool is_label_stmt (tree);
348 static inline bitmap addresses_taken (tree);
349 static inline void set_default_def (tree, tree);
350 static inline tree default_def (tree);
351
352 /*---------------------------------------------------------------------------
353                   Structure representing predictions in tree level.
354 ---------------------------------------------------------------------------*/
355 struct edge_prediction GTY((chain_next ("%h.next")))
356 {
357   struct edge_prediction *next;
358   edge edge;
359   enum br_predictor predictor;
360   int probability;
361 };
362
363 /* Accessors for basic block annotations.  */
364 static inline tree phi_nodes (basic_block);
365 static inline void set_phi_nodes (basic_block, tree);
366
367 /*---------------------------------------------------------------------------
368                               Global declarations
369 ---------------------------------------------------------------------------*/
370 struct int_tree_map GTY(())
371 {
372   
373   unsigned int uid;
374   tree to;
375 };
376
377 extern unsigned int int_tree_map_hash (const void *);
378 extern int int_tree_map_eq (const void *, const void *);
379
380 typedef struct 
381 {
382   htab_iterator hti;
383 } referenced_var_iterator;
384
385
386 #define FOR_EACH_REFERENCED_VAR(VAR, ITER) \
387   for ((VAR) = first_referenced_var (&(ITER)); \
388        !end_referenced_vars_p (&(ITER)); \
389        (VAR) = next_referenced_var (&(ITER))) 
390
391 /* Array of all variables referenced in the function.  */
392 extern GTY((param_is (struct int_tree_map))) htab_t referenced_vars;
393
394 extern tree referenced_var_lookup (unsigned int);
395 #define num_referenced_vars htab_elements (referenced_vars)
396 #define referenced_var(i) referenced_var_lookup (i)
397
398 /* Array of all SSA_NAMEs used in the function.  */
399 extern GTY(()) VEC(tree,gc) *ssa_names;
400
401 #define num_ssa_names (VEC_length (tree, ssa_names))
402 #define ssa_name(i) (VEC_index (tree, ssa_names, (i)))
403
404 /* Artificial variable used to model the effects of function calls.  */
405 extern GTY(()) tree global_var;
406
407 /* Call clobbered variables in the function.  If bit I is set, then
408    REFERENCED_VARS (I) is call-clobbered.  */
409 extern bitmap call_clobbered_vars;
410
411 /* Addressable variables in the function.  If bit I is set, then
412    REFERENCED_VARS (I) has had its address taken.  */
413 extern bitmap addressable_vars;
414
415 /* 'true' after aliases have been computed (see compute_may_aliases).  */
416 extern bool aliases_computed_p;
417
418 /* Macros for showing usage statistics.  */
419 #define SCALE(x) ((unsigned long) ((x) < 1024*10        \
420                   ? (x)                                 \
421                   : ((x) < 1024*1024*10                 \
422                      ? (x) / 1024                       \
423                      : (x) / (1024*1024))))
424
425 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
426
427 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
428
429 /*---------------------------------------------------------------------------
430                               Block iterators
431 ---------------------------------------------------------------------------*/
432
433 typedef struct {
434   tree_stmt_iterator tsi;
435   basic_block bb;
436 } block_stmt_iterator;
437
438 static inline block_stmt_iterator bsi_start (basic_block);
439 static inline block_stmt_iterator bsi_last (basic_block);
440 static inline block_stmt_iterator bsi_after_labels (basic_block);
441 block_stmt_iterator bsi_for_stmt (tree);
442 static inline bool bsi_end_p (block_stmt_iterator);
443 static inline void bsi_next (block_stmt_iterator *);
444 static inline void bsi_prev (block_stmt_iterator *);
445 static inline tree bsi_stmt (block_stmt_iterator);
446 static inline tree * bsi_stmt_ptr (block_stmt_iterator);
447
448 extern void bsi_remove (block_stmt_iterator *);
449 extern void bsi_move_before (block_stmt_iterator *, block_stmt_iterator *);
450 extern void bsi_move_after (block_stmt_iterator *, block_stmt_iterator *);
451 extern void bsi_move_to_bb_end (block_stmt_iterator *, basic_block);
452
453 enum bsi_iterator_update
454 {
455   /* Note that these are intentionally in the same order as TSI_FOO.  They
456      mean exactly the same as their TSI_* counterparts.  */
457   BSI_NEW_STMT,
458   BSI_SAME_STMT,
459   BSI_CHAIN_START,
460   BSI_CHAIN_END,
461   BSI_CONTINUE_LINKING
462 };
463
464 extern void bsi_insert_before (block_stmt_iterator *, tree,
465                                enum bsi_iterator_update);
466 extern void bsi_insert_after (block_stmt_iterator *, tree,
467                               enum bsi_iterator_update);
468
469 extern void bsi_replace (const block_stmt_iterator *, tree, bool);
470
471 /*---------------------------------------------------------------------------
472                               Function prototypes
473 ---------------------------------------------------------------------------*/
474 /* In tree-cfg.c  */
475
476 /* Location to track pending stmt for edge insertion.  */
477 #define PENDING_STMT(e) ((e)->insns.t)
478
479 extern void delete_tree_cfg_annotations (void);
480 extern void disband_implicit_edges (void);
481 extern bool stmt_ends_bb_p (tree);
482 extern bool is_ctrl_stmt (tree);
483 extern bool is_ctrl_altering_stmt (tree);
484 extern bool computed_goto_p (tree);
485 extern bool simple_goto_p (tree);
486 extern void tree_dump_bb (basic_block, FILE *, int);
487 extern void debug_tree_bb (basic_block);
488 extern basic_block debug_tree_bb_n (int);
489 extern void dump_tree_cfg (FILE *, int);
490 extern void debug_tree_cfg (int);
491 extern void dump_cfg_stats (FILE *);
492 extern void debug_cfg_stats (void);
493 extern void debug_loop_ir (void);
494 extern void print_loop_ir (FILE *);
495 extern void cleanup_dead_labels (void);
496 extern void group_case_labels (void);
497 extern tree first_stmt (basic_block);
498 extern tree last_stmt (basic_block);
499 extern tree *last_stmt_ptr (basic_block);
500 extern tree last_and_only_stmt (basic_block);
501 extern edge find_taken_edge (basic_block, tree);
502 extern basic_block label_to_block_fn (struct function *, tree);
503 #define label_to_block(t) (label_to_block_fn (cfun, t))
504 extern void bsi_insert_on_edge (edge, tree);
505 extern basic_block bsi_insert_on_edge_immediate (edge, tree);
506 extern void bsi_commit_one_edge_insert (edge, basic_block *);
507 extern void bsi_commit_edge_inserts (void);
508 extern void notice_special_calls (tree);
509 extern void clear_special_calls (void);
510 extern void verify_stmts (void);
511 extern tree tree_block_label (basic_block);
512 extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
513 extern bool tree_duplicate_sese_region (edge, edge, basic_block *, unsigned,
514                                         basic_block *);
515 extern void add_phi_args_after_copy_bb (basic_block);
516 extern void add_phi_args_after_copy (basic_block *, unsigned);
517 extern bool tree_purge_dead_eh_edges (basic_block);
518 extern bool tree_purge_all_dead_eh_edges (bitmap);
519 extern tree gimplify_val (block_stmt_iterator *, tree, tree);
520 extern tree gimplify_build1 (block_stmt_iterator *, enum tree_code,
521                              tree, tree);
522 extern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
523                              tree, tree, tree);
524 extern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
525                              tree, tree, tree, tree);
526 extern void init_empty_tree_cfg (void);
527 extern void fold_cond_expr_cond (void);
528 extern void replace_uses_by (tree, tree);
529 extern void start_recording_case_labels (void);
530 extern void end_recording_case_labels (void);
531
532 /* In tree-cfgcleanup.c  */
533 extern bool cleanup_tree_cfg (void);
534 extern void cleanup_tree_cfg_loop (void);
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 tree phi_reverse (tree);
549 extern void dump_dfa_stats (FILE *);
550 extern void debug_dfa_stats (void);
551 extern void debug_referenced_vars (void);
552 extern void dump_referenced_vars (FILE *);
553 extern void dump_variable (FILE *, tree);
554 extern void debug_variable (tree);
555 extern void dump_subvars_for (FILE *, tree);
556 extern void debug_subvars_for (tree);
557 extern tree get_virtual_var (tree);
558 extern void add_referenced_tmp_var (tree);
559 extern void mark_new_vars_to_rename (tree);
560 extern void find_new_referenced_vars (tree *);
561
562 extern tree make_rename_temp (tree, const char *);
563
564 /* In gimple-low.c  */
565 extern void record_vars (tree);
566 extern bool block_may_fallthru (tree block);
567
568 /* In tree-ssa-alias.c  */
569 extern void dump_may_aliases_for (FILE *, tree);
570 extern void debug_may_aliases_for (tree);
571 extern void dump_alias_info (FILE *);
572 extern void debug_alias_info (void);
573 extern void dump_points_to_info (FILE *);
574 extern void debug_points_to_info (void);
575 extern void dump_points_to_info_for (FILE *, tree);
576 extern void debug_points_to_info_for (tree);
577 extern bool may_be_aliased (tree);
578 extern struct ptr_info_def *get_ptr_info (tree);
579 extern void add_type_alias (tree, tree);
580 extern void new_type_alias (tree, tree);
581 extern void count_uses_and_derefs (tree, tree, unsigned *, unsigned *, bool *);
582 static inline subvar_t get_subvars_for_var (tree);
583 static inline tree get_subvar_at (tree, unsigned HOST_WIDE_INT);
584 static inline bool ref_contains_array_ref (tree);
585 extern tree okay_component_ref_for_subvars (tree, unsigned HOST_WIDE_INT *,
586                                             unsigned HOST_WIDE_INT *);
587 static inline bool var_can_have_subvars (tree);
588 static inline bool overlap_subvar (unsigned HOST_WIDE_INT,
589                                    unsigned HOST_WIDE_INT,
590                                    subvar_t, bool *);
591
592 /* Call-back function for walk_use_def_chains().  At each reaching
593    definition, a function with this prototype is called.  */
594 typedef bool (*walk_use_def_chains_fn) (tree, tree, void *);
595
596
597 /* In tree-ssa.c  */
598 extern void init_tree_ssa (void);
599 extern edge ssa_redirect_edge (edge, basic_block);
600 extern void flush_pending_stmts (edge);
601 extern bool tree_ssa_useless_type_conversion (tree);
602 extern bool tree_ssa_useless_type_conversion_1 (tree, tree);
603 extern void verify_ssa (bool);
604 extern void delete_tree_ssa (void);
605 extern void register_new_def (tree, VEC(tree,heap) **);
606 extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
607 extern bool stmt_references_memory_p (tree);
608
609 /* In tree-into-ssa.c  */
610 void update_ssa (unsigned);
611 void delete_update_ssa (void);
612 void register_new_name_mapping (tree, tree);
613 tree create_new_def_for (tree, tree, def_operand_p);
614 bool need_ssa_update_p (void);
615 bool name_registered_for_update_p (tree);
616 bitmap ssa_names_to_replace (void);
617 void release_ssa_name_after_update_ssa (tree name);
618 void compute_global_livein (bitmap, bitmap);
619 tree duplicate_ssa_name (tree, tree);
620 void mark_sym_for_renaming (tree);
621 void mark_set_for_renaming (bitmap);
622 tree get_current_def (tree);
623 void set_current_def (tree, tree);
624
625 /* In tree-ssa-ccp.c  */
626 bool fold_stmt (tree *);
627 bool fold_stmt_inplace (tree);
628 tree widen_bitfield (tree, tree, tree);
629
630 /* In tree-vrp.c  */
631 bool expr_computes_nonzero (tree);
632 tree vrp_evaluate_conditional (tree, bool);
633 void simplify_stmt_using_ranges (tree);
634
635 /* In tree-ssa-dom.c  */
636 extern void dump_dominator_optimization_stats (FILE *);
637 extern void debug_dominator_optimization_stats (void);
638 int loop_depth_of_name (tree);
639
640 /* In tree-ssa-copy.c  */
641 extern void propagate_value (use_operand_p, tree);
642 extern void propagate_tree_value (tree *, tree);
643 extern void replace_exp (use_operand_p, tree);
644 extern bool may_propagate_copy (tree, tree);
645 extern bool may_propagate_copy_into_asm (tree);
646
647 /* Description of number of iterations of a loop.  All the expressions inside
648    the structure can be evaluated at the end of the loop's preheader
649    (and due to ssa form, also anywhere inside the body of the loop).  */
650
651 struct tree_niter_desc
652 {
653   tree assumptions;     /* The boolean expression.  If this expression evaluates
654                            to false, then the other fields in this structure
655                            should not be used; there is no guarantee that they
656                            will be correct.  */
657   tree may_be_zero;     /* The boolean expression.  If it evaluates to true,
658                            the loop will exit in the first iteration (i.e.
659                            its latch will not be executed), even if the niter
660                            field says otherwise.  */
661   tree niter;           /* The expression giving the number of iterations of
662                            a loop (provided that assumptions == true and
663                            may_be_zero == false), more precisely the number
664                            of executions of the latch of the loop.  */
665   tree additional_info; /* The boolean expression.  Sometimes we use additional
666                            knowledge to simplify the other expressions
667                            contained in this structure (for example the
668                            knowledge about value ranges of operands on entry to
669                            the loop).  If this is a case, conjunction of such
670                            condition is stored in this field, so that we do not
671                            lose the information: for example if may_be_zero
672                            is (n <= 0) and niter is (unsigned) n, we know
673                            that the number of iterations is at most
674                            MAX_SIGNED_INT.  However if the (n <= 0) assumption
675                            is eliminated (by looking at the guard on entry of
676                            the loop), then the information would be lost.  */
677 };
678
679 /* In tree-vectorizer.c */
680 void vectorize_loops (struct loops *);
681
682 /* In tree-ssa-phiopt.c */
683 bool empty_block_p (basic_block);
684
685 /* In tree-ssa-loop*.c  */
686
687 void tree_ssa_lim (struct loops *);
688 void tree_ssa_unswitch_loops (struct loops *);
689 void canonicalize_induction_variables (struct loops *);
690 void tree_unroll_loops_completely (struct loops *, bool);
691 void tree_ssa_iv_optimize (struct loops *);
692
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 bool scev_probably_wraps_p (tree, tree, tree, tree, struct loop *, bool *);
700 tree convert_step (struct loop *, tree, tree, tree, tree);
701 void free_numbers_of_iterations_estimates (struct loops *);
702 void rewrite_into_loop_closed_ssa (bitmap, unsigned);
703 void verify_loop_closed_ssa (void);
704 void loop_commit_inserts (void);
705 bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
706 void create_iv (tree, tree, tree, struct loop *, block_stmt_iterator *, bool,
707                 tree *, tree *);
708 void split_loop_exit_edge (edge);
709 basic_block bsi_insert_on_edge_immediate_loop (edge, tree);
710 void standard_iv_increment_position (struct loop *, block_stmt_iterator *,
711                                      bool *);
712 basic_block ip_end_pos (struct loop *);
713 basic_block ip_normal_pos (struct loop *);
714 bool tree_duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
715                                          unsigned int, sbitmap,
716                                          edge, edge *,
717                                          unsigned int *, int);
718 struct loop *tree_ssa_loop_version (struct loops *, struct loop *, tree,
719                                     basic_block *);
720 tree expand_simple_operations (tree);
721 void substitute_in_loop_info (struct loop *, tree, tree);
722
723 /* In tree-ssa-loop-im.c  */
724 /* The possibilities of statement movement.  */
725
726 enum move_pos
727   {
728     MOVE_IMPOSSIBLE,            /* No movement -- side effect expression.  */
729     MOVE_PRESERVE_EXECUTION,    /* Must not cause the non-executed statement
730                                    become executed -- memory accesses, ... */
731     MOVE_POSSIBLE               /* Unlimited movement.  */
732   };
733 extern enum move_pos movement_possibility (tree);
734
735 /* In tree-flow-inline.h  */
736 static inline bool is_call_clobbered (tree);
737 static inline void mark_call_clobbered (tree);
738 static inline void set_is_used (tree);
739 static inline bool unmodifiable_var_p (tree);
740
741 /* In tree-eh.c  */
742 extern void make_eh_edges (tree);
743 extern bool tree_could_trap_p (tree);
744 extern bool tree_could_throw_p (tree);
745 extern bool tree_can_throw_internal (tree);
746 extern bool tree_can_throw_external (tree);
747 extern int lookup_stmt_eh_region (tree);
748 extern void add_stmt_to_eh_region (tree, int);
749 extern bool remove_stmt_from_eh_region (tree);
750 extern bool maybe_clean_or_replace_eh_stmt (tree, tree);
751
752 /* In tree-ssa-pre.c  */
753 void add_to_value (tree, tree);
754 void debug_value_expressions (tree);
755 void print_value_expressions (FILE *, tree);
756
757
758 /* In tree-vn.c  */
759 bool expressions_equal_p (tree, tree);
760 tree get_value_handle (tree);
761 hashval_t vn_compute (tree, hashval_t, tree);
762 tree vn_lookup_or_add (tree, tree);
763 void vn_add (tree, tree, tree);
764 tree vn_lookup (tree, tree);
765 void vn_init (void);
766 void vn_delete (void);
767
768 /* In tree-ssa-sink.c  */
769 bool is_hidden_global_store (tree);
770
771 /* In tree-sra.c  */
772 void insert_edge_copies (tree, basic_block);
773
774 /* In tree-loop-linear.c  */
775 extern void linear_transform_loops (struct loops *);
776
777 /* In tree-ssa-loop-ivopts.c  */
778 bool expr_invariant_in_loop_p (struct loop *, tree);
779 bool multiplier_allowed_in_address_p (HOST_WIDE_INT);
780 unsigned multiply_by_cost (HOST_WIDE_INT, enum machine_mode);
781
782 /* In tree-ssa-threadupdate.c.  */
783 extern bool thread_through_all_blocks (bitmap);
784
785 /* In gimplify.c  */
786 tree force_gimple_operand (tree, tree *, bool, tree);
787 tree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree);
788
789 /* In tree-ssa-structalias.c */
790 bool find_what_p_points_to (tree);
791
792 /* In tree-ssa-address.c  */
793
794 /* Affine combination of trees.  We keep track of at most MAX_AFF_ELTS elements
795    to make things simpler; this is sufficient in most cases.  */
796
797 #define MAX_AFF_ELTS 8
798
799 struct affine_tree_combination
800 {
801   /* Type of the result of the combination.  */
802   tree type;
803
804   /* Mask modulo that the operations are performed.  */
805   unsigned HOST_WIDE_INT mask;
806
807   /* Constant offset.  */
808   unsigned HOST_WIDE_INT offset;
809
810   /* Number of elements of the combination.  */
811   unsigned n;
812
813   /* Elements and their coefficients.  */
814   tree elts[MAX_AFF_ELTS];
815   unsigned HOST_WIDE_INT coefs[MAX_AFF_ELTS];
816
817   /* Remainder of the expression.  */
818   tree rest;
819 };
820
821 /* Description of a memory address.  */
822
823 struct mem_address
824 {
825   tree symbol, base, index, step, offset;
826 };
827
828 tree create_mem_ref (block_stmt_iterator *, tree, 
829                      struct affine_tree_combination *);
830 rtx addr_for_mem_ref (struct mem_address *, bool);
831 void get_address_description (tree, struct mem_address *);
832 tree maybe_fold_tmr (tree);
833 /* This structure is simply used during pushing fields onto the fieldstack
834    to track the offset of the field, since bitpos_of_field gives it relative
835    to its immediate containing type, and we want it relative to the ultimate
836    containing object.  */
837
838 struct fieldoff
839 {
840   tree field;
841   HOST_WIDE_INT offset;  
842 };
843 typedef struct fieldoff fieldoff_s;
844
845 DEF_VEC_O(fieldoff_s);
846 DEF_VEC_ALLOC_O(fieldoff_s,heap);
847 int push_fields_onto_fieldstack (tree, VEC(fieldoff_s,heap) **,
848                                  HOST_WIDE_INT, bool *);
849 void sort_fieldstack (VEC(fieldoff_s,heap) *);
850
851 #include "tree-flow-inline.h"
852
853 #endif /* _TREE_FLOW_H  */