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