OSDN Git Service

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