1 /* Data and Control Flow Analysis for Trees.
2 Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 Free Software Foundation, Inc.
4 Contributed by Diego Novillo <dnovillo@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
23 #define _TREE_FLOW_H 1
26 #include "hard-reg-set.h"
27 #include "basic-block.h"
30 #include "tree-ssa-operands.h"
32 #include "ipa-reference.h"
33 #include "tree-ssa-alias.h"
35 /* Forward declare structures for the garbage collector GTY markers. */
36 #ifndef GCC_BASIC_BLOCK_H
38 typedef struct edge_def
*edge
;
39 struct basic_block_def
;
40 typedef struct basic_block_def
*basic_block
;
42 struct static_var_ann_d
;
45 /* Gimple dataflow datastructure. All publicly available fields shall have
46 gimple_ accessor defined in tree-flow-inline.h, all publicly modifiable
47 fields should have gimple_set accessor. */
48 struct gimple_df
GTY(())
50 /* Array of all variables referenced in the function. */
51 htab_t
GTY((param_is (union tree_node
))) referenced_vars
;
53 /* A vector of all the noreturn calls passed to modify_stmt.
54 cleanup_control_flow uses it to detect cases where a mid-block
55 indirect call has been turned into a noreturn call. When this
56 happens, all the instructions after the call are no longer
57 reachable and must be deleted as dead. */
58 VEC(gimple
,gc
) *modified_noreturn_calls
;
60 /* Array of all SSA_NAMEs used in the function. */
61 VEC(tree
,gc
) *ssa_names
;
63 /* Artificial variable used for the virtual operand FUD chain. */
66 /* Artificial variable used to model the effects of nonlocal
70 /* The PTA solution for the ESCAPED artificial variable. */
71 struct pt_solution escaped
;
73 /* The PTA solution for the CALLUSED artificial variable. */
74 struct pt_solution callused
;
76 /* Free list of SSA_NAMEs. */
79 /* Hashtable holding definition for symbol. If this field is not NULL, it
80 means that the first reference to this variable in the function is a
81 USE or a VUSE. In those cases, the SSA renamer creates an SSA name
82 for this variable with an empty defining statement. */
83 htab_t
GTY((param_is (union tree_node
))) default_defs
;
85 /* Symbols whose SSA form needs to be updated or created for the first
87 bitmap syms_to_rename
;
89 /* True if the code is in ssa form. */
90 unsigned int in_ssa_p
: 1;
92 struct ssa_operands ssa_operands
;
95 /* Accessors for internal use only. Generic code should use abstraction
96 provided by tree-flow-inline.h or specific modules. */
97 #define FREE_SSANAMES(fun) (fun)->gimple_df->free_ssanames
98 #define SSANAMES(fun) (fun)->gimple_df->ssa_names
99 #define MODIFIED_NORETURN_CALLS(fun) (fun)->gimple_df->modified_noreturn_calls
100 #define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
101 #define SYMS_TO_RENAME(fun) (fun)->gimple_df->syms_to_rename
110 /* Iterate through the elements of hashtable HTAB, using htab_iterator ITER,
111 storing each element in RESULT, which is of type TYPE. */
112 #define FOR_EACH_HTAB_ELEMENT(HTAB, RESULT, TYPE, ITER) \
113 for (RESULT = (TYPE) first_htab_element (&(ITER), (HTAB)); \
114 !end_htab_p (&(ITER)); \
115 RESULT = (TYPE) next_htab_element (&(ITER)))
117 /*---------------------------------------------------------------------------
118 Attributes for SSA_NAMEs.
120 NOTE: These structures are stored in struct tree_ssa_name
121 but are only used by the tree optimizers, so it makes better sense
122 to declare them here to avoid recompiling unrelated files when
124 ---------------------------------------------------------------------------*/
126 /* Aliasing information for SSA_NAMEs representing pointer variables. */
127 struct ptr_info_def
GTY(())
129 /* The points-to solution, TBAA-pruned if the pointer is dereferenced. */
130 struct pt_solution pt
;
134 /*---------------------------------------------------------------------------
135 Tree annotations stored in tree_base.ann
136 ---------------------------------------------------------------------------*/
137 enum tree_ann_type
{ TREE_ANN_COMMON
, VAR_ANN
, FUNCTION_ANN
};
139 struct tree_ann_common_d
GTY(())
141 /* Annotation type. */
142 enum tree_ann_type type
;
144 /* Record EH region number into a statement tree created during RTL
145 expansion (see gimple_to_tree). */
148 /* Auxiliary info specific to a pass. At all times, this
149 should either point to valid data or be NULL. */
150 PTR
GTY ((skip (""))) aux
;
152 /* The value handle for this expression. Used by GVN-PRE. */
153 tree
GTY((skip
)) value_handle
;
155 /* Pointer to original GIMPLE statement. Used during RTL expansion
156 (see gimple_to_tree). */
160 /* It is advantageous to avoid things like life analysis for variables which
161 do not need PHI nodes. This enum describes whether or not a particular
162 variable may need a PHI node. */
164 enum need_phi_state
{
165 /* This is the default. If we are still in this state after finding
166 all the definition and use sites, then we will assume the variable
167 needs PHI nodes. This is probably an overly conservative assumption. */
168 NEED_PHI_STATE_UNKNOWN
,
170 /* This state indicates that we have seen one or more sets of the
171 variable in a single basic block and that the sets dominate all
172 uses seen so far. If after finding all definition and use sites
173 we are still in this state, then the variable does not need any
177 /* This state indicates that we have either seen multiple definitions of
178 the variable in multiple blocks, or that we encountered a use in a
179 block that was not dominated by the block containing the set(s) of
180 this variable. This variable is assumed to need PHI nodes. */
185 /* The "no alias" attribute allows alias analysis to make more
186 aggressive assumptions when assigning alias sets, computing
187 points-to information and memory partitions. These attributes
188 are the result of user annotations or flags (e.g.,
189 -fargument-noalias). */
191 /* Default state. No special assumptions can be made about this
195 /* The symbol does not alias with other symbols that have a
196 NO_ALIAS* attribute. */
199 /* The symbol does not alias with other symbols that have a
200 NO_ALIAS*, and it may not alias with global symbols. */
203 /* The symbol does not alias with any other symbols. */
208 struct var_ann_d
GTY(())
210 struct tree_ann_common_d common
;
212 /* Used by the out of SSA pass to determine whether this variable has
213 been seen yet or not. */
214 unsigned out_of_ssa_tag
: 1;
216 /* Used when building base variable structures in a var_map. */
217 unsigned base_var_processed
: 1;
219 /* Nonzero if this variable was used after SSA optimizations were
220 applied. We set this when translating out of SSA form. */
223 /* This field indicates whether or not the variable may need PHI nodes.
224 See the enum's definition for more detailed information about the
226 ENUM_BITFIELD (need_phi_state
) need_phi_state
: 2;
228 /* True for HEAP artificial variables. These variables represent
229 the memory area allocated by a call to malloc. */
230 unsigned is_heapvar
: 1;
232 /* This field describes several "no alias" attributes that some
233 symbols are known to have. See the enum's definition for more
234 information on each attribute. */
235 ENUM_BITFIELD (noalias_state
) noalias_state
: 2;
237 /* Used when going out of SSA form to indicate which partition this
238 variable represents storage for. */
241 /* Used by var_map for the base index of ssa base variables. */
244 /* During into-ssa and the dominator optimizer, this field holds the
245 current version of this variable (an SSA_NAME). */
249 /* Container for variable annotation used by hashtable for annotations for
251 struct static_var_ann_d
GTY(())
253 struct var_ann_d ann
;
257 struct function_ann_d
GTY(())
259 struct tree_ann_common_d common
;
263 /* Immediate use lists are used to directly access all uses for an SSA
264 name and get pointers to the statement for each use.
266 The structure ssa_use_operand_d consists of PREV and NEXT pointers
267 to maintain the list. A USE pointer, which points to address where
268 the use is located and a LOC pointer which can point to the
269 statement where the use is located, or, in the case of the root
270 node, it points to the SSA name itself.
272 The list is anchored by an occurrence of ssa_operand_d *in* the
273 ssa_name node itself (named 'imm_uses'). This node is uniquely
274 identified by having a NULL USE pointer. and the LOC pointer
275 pointing back to the ssa_name node itself. This node forms the
276 base for a circular list, and initially this is the only node in
279 Fast iteration allows each use to be examined, but does not allow
280 any modifications to the uses or stmts.
282 Normal iteration allows insertion, deletion, and modification. the
283 iterator manages this by inserting a marker node into the list
284 immediately before the node currently being examined in the list.
285 this marker node is uniquely identified by having null stmt *and* a
288 When iterating to the next use, the iteration routines check to see
289 if the node after the marker has changed. if it has, then the node
290 following the marker is now the next one to be visited. if not, the
291 marker node is moved past that node in the list (visualize it as
292 bumping the marker node through the list). this continues until
293 the marker node is moved to the original anchor position. the
294 marker node is then removed from the list.
296 If iteration is halted early, the marker node must be removed from
297 the list before continuing. */
298 typedef struct immediate_use_iterator_d
300 /* This is the current use the iterator is processing. */
301 ssa_use_operand_t
*imm_use
;
302 /* This marks the last use in the list (use node from SSA_NAME) */
303 ssa_use_operand_t
*end_p
;
304 /* This node is inserted and used to mark the end of the uses for a stmt. */
305 ssa_use_operand_t iter_node
;
306 /* This is the next ssa_name to visit. IMM_USE may get removed before
307 the next one is traversed to, so it must be cached early. */
308 ssa_use_operand_t
*next_imm_name
;
312 /* Use this iterator when simply looking at stmts. Adding, deleting or
313 modifying stmts will cause this iterator to malfunction. */
315 #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR) \
316 for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR)); \
317 !end_readonly_imm_use_p (&(ITER)); \
318 (DEST) = next_readonly_imm_use (&(ITER)))
320 /* Use this iterator to visit each stmt which has a use of SSAVAR. */
322 #define FOR_EACH_IMM_USE_STMT(STMT, ITER, SSAVAR) \
323 for ((STMT) = first_imm_use_stmt (&(ITER), (SSAVAR)); \
324 !end_imm_use_stmt_p (&(ITER)); \
325 (STMT) = next_imm_use_stmt (&(ITER)))
327 /* Use this to terminate the FOR_EACH_IMM_USE_STMT loop early. Failure to
328 do so will result in leaving a iterator marker node in the immediate
329 use list, and nothing good will come from that. */
330 #define BREAK_FROM_IMM_USE_STMT(ITER) \
332 end_imm_use_stmt_traverse (&(ITER)); \
337 /* Use this iterator in combination with FOR_EACH_IMM_USE_STMT to
338 get access to each occurrence of ssavar on the stmt returned by
339 that iterator.. for instance:
341 FOR_EACH_IMM_USE_STMT (stmt, iter, var)
343 FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
345 SET_USE (use_p, blah);
350 #define FOR_EACH_IMM_USE_ON_STMT(DEST, ITER) \
351 for ((DEST) = first_imm_use_on_stmt (&(ITER)); \
352 !end_imm_use_on_stmt_p (&(ITER)); \
353 (DEST) = next_imm_use_on_stmt (&(ITER)))
357 union tree_ann_d
GTY((desc ("ann_type ((tree_ann_t)&%h)")))
359 struct tree_ann_common_d
GTY((tag ("TREE_ANN_COMMON"))) common
;
360 struct var_ann_d
GTY((tag ("VAR_ANN"))) vdecl
;
361 struct function_ann_d
GTY((tag ("FUNCTION_ANN"))) fdecl
;
364 typedef union tree_ann_d
*tree_ann_t
;
365 typedef struct var_ann_d
*var_ann_t
;
366 typedef struct function_ann_d
*function_ann_t
;
367 typedef struct tree_ann_common_d
*tree_ann_common_t
;
369 static inline tree_ann_common_t
tree_common_ann (const_tree
);
370 static inline tree_ann_common_t
get_tree_common_ann (tree
);
371 static inline var_ann_t
var_ann (const_tree
);
372 static inline var_ann_t
get_var_ann (tree
);
373 static inline function_ann_t
function_ann (const_tree
);
374 static inline function_ann_t
get_function_ann (tree
);
375 static inline enum tree_ann_type
ann_type (tree_ann_t
);
376 static inline void update_stmt (gimple
);
377 static inline int get_lineno (const_gimple
);
379 /*---------------------------------------------------------------------------
380 Structure representing predictions in tree level.
381 ---------------------------------------------------------------------------*/
382 struct edge_prediction
GTY((chain_next ("%h.ep_next")))
384 struct edge_prediction
*ep_next
;
386 enum br_predictor ep_predictor
;
390 /* Accessors for basic block annotations. */
391 static inline gimple_seq
phi_nodes (const_basic_block
);
392 static inline void set_phi_nodes (basic_block
, gimple_seq
);
394 /*---------------------------------------------------------------------------
396 ---------------------------------------------------------------------------*/
397 struct int_tree_map
GTY(())
404 extern unsigned int int_tree_map_hash (const void *);
405 extern int int_tree_map_eq (const void *, const void *);
407 extern unsigned int uid_decl_map_hash (const void *);
408 extern int uid_decl_map_eq (const void *, const void *);
413 } referenced_var_iterator
;
416 /* This macro loops over all the referenced vars, one at a time, putting the
417 current var in VAR. Note: You are not allowed to add referenced variables
418 to the hashtable while using this macro. Doing so may cause it to behave
421 #define FOR_EACH_REFERENCED_VAR(VAR, ITER) \
422 for ((VAR) = first_referenced_var (&(ITER)); \
423 !end_referenced_vars_p (&(ITER)); \
424 (VAR) = next_referenced_var (&(ITER)))
430 } safe_referenced_var_iterator
;
432 /* This macro loops over all the referenced vars, one at a time, putting the
433 current var in VAR. You are allowed to add referenced variables during the
434 execution of this macro, however, the macro will not iterate over them. It
435 requires a temporary vector of trees, VEC, whose lifetime is controlled by
436 the caller. The purpose of the vector is to temporarily store the
437 referenced_variables hashtable so that adding referenced variables does not
438 affect the hashtable. */
440 #define FOR_EACH_REFERENCED_VAR_SAFE(VAR, VEC, ITER) \
441 for ((ITER).i = 0, fill_referenced_var_vec (&(VEC)); \
442 VEC_iterate (tree, (VEC), (ITER).i, (VAR)); \
445 extern tree
referenced_var_lookup (unsigned int);
446 extern bool referenced_var_check_and_insert (tree
);
447 #define num_referenced_vars htab_elements (gimple_referenced_vars (cfun))
448 #define referenced_var(i) referenced_var_lookup (i)
450 #define num_ssa_names (VEC_length (tree, cfun->gimple_df->ssa_names))
451 #define ssa_name(i) (VEC_index (tree, cfun->gimple_df->ssa_names, (i)))
453 /* Macros for showing usage statistics. */
454 #define SCALE(x) ((unsigned long) ((x) < 1024*10 \
456 : ((x) < 1024*1024*10 \
458 : (x) / (1024*1024))))
460 #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
462 #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
464 /*---------------------------------------------------------------------------
466 ---------------------------------------------------------------------------*/
468 /* Parallel region information. Every parallel and workshare
469 directive is enclosed between two markers, the OMP_* directive
470 and a corresponding OMP_RETURN statement. */
474 /* The enclosing region. */
475 struct omp_region
*outer
;
477 /* First child region. */
478 struct omp_region
*inner
;
480 /* Next peer region. */
481 struct omp_region
*next
;
483 /* Block containing the omp directive as its last stmt. */
486 /* Block containing the OMP_RETURN as its last stmt. */
489 /* Block containing the OMP_CONTINUE as its last stmt. */
492 /* If this is a combined parallel+workshare region, this is a list
493 of additional arguments needed by the combined parallel+workshare
497 /* The code for the omp directive of this region. */
498 enum gimple_code type
;
500 /* Schedule kind, only used for OMP_FOR type regions. */
501 enum omp_clause_schedule_kind sched_kind
;
503 /* True if this is a combined parallel+workshare region. */
504 bool is_combined_parallel
;
507 extern struct omp_region
*root_omp_region
;
508 extern struct omp_region
*new_omp_region (basic_block
, enum gimple_code
,
509 struct omp_region
*);
510 extern void free_omp_regions (void);
511 void omp_expand_local (basic_block
);
512 extern tree
find_omp_clause (tree
, enum omp_clause_code
);
513 tree
copy_var_decl (tree
, tree
, tree
);
515 /*---------------------------------------------------------------------------
517 ---------------------------------------------------------------------------*/
520 /* Location to track pending stmt for edge insertion. */
521 #define PENDING_STMT(e) ((e)->insns.g)
523 extern void delete_tree_cfg_annotations (void);
524 extern bool stmt_ends_bb_p (gimple
);
525 extern bool is_ctrl_stmt (gimple
);
526 extern bool is_ctrl_altering_stmt (gimple
);
527 extern bool simple_goto_p (gimple
);
528 extern bool stmt_can_make_abnormal_goto (gimple
);
529 extern basic_block
single_noncomplex_succ (basic_block bb
);
530 extern void gimple_dump_bb (basic_block
, FILE *, int, int);
531 extern void gimple_debug_bb (basic_block
);
532 extern basic_block
gimple_debug_bb_n (int);
533 extern void gimple_dump_cfg (FILE *, int);
534 extern void gimple_debug_cfg (int);
535 extern void dump_cfg_stats (FILE *);
536 extern void dot_cfg (void);
537 extern void debug_cfg_stats (void);
538 extern void debug_loops (int);
539 extern void debug_loop (struct loop
*, int);
540 extern void debug_loop_num (unsigned, int);
541 extern void print_loops (FILE *, int);
542 extern void print_loops_bb (FILE *, basic_block
, int, int);
543 extern void cleanup_dead_labels (void);
544 extern void group_case_labels (void);
545 extern gimple
first_stmt (basic_block
);
546 extern gimple
last_stmt (basic_block
);
547 extern gimple
last_and_only_stmt (basic_block
);
548 extern edge
find_taken_edge (basic_block
, tree
);
549 extern basic_block
label_to_block_fn (struct function
*, tree
);
550 #define label_to_block(t) (label_to_block_fn (cfun, t))
551 extern void notice_special_calls (gimple
);
552 extern void clear_special_calls (void);
553 extern void verify_stmts (void);
554 extern void verify_gimple (void);
555 extern void verify_types_in_gimple_seq (gimple_seq
);
556 extern tree
gimple_block_label (basic_block
);
557 extern void extract_true_false_edges_from_block (basic_block
, edge
*, edge
*);
558 extern bool gimple_duplicate_sese_region (edge
, edge
, basic_block
*, unsigned,
560 extern bool gimple_duplicate_sese_tail (edge
, edge
, basic_block
*, unsigned,
562 extern void gather_blocks_in_sese_region (basic_block entry
, basic_block exit
,
563 VEC(basic_block
,heap
) **bbs_p
);
564 extern void add_phi_args_after_copy_bb (basic_block
);
565 extern void add_phi_args_after_copy (basic_block
*, unsigned, edge
);
566 extern bool gimple_purge_dead_abnormal_call_edges (basic_block
);
567 extern bool gimple_purge_dead_eh_edges (basic_block
);
568 extern bool gimple_purge_all_dead_eh_edges (const_bitmap
);
569 extern tree
gimplify_build1 (gimple_stmt_iterator
*, enum tree_code
,
571 extern tree
gimplify_build2 (gimple_stmt_iterator
*, enum tree_code
,
573 extern tree
gimplify_build3 (gimple_stmt_iterator
*, enum tree_code
,
574 tree
, tree
, tree
, tree
);
575 extern void init_empty_tree_cfg (void);
576 extern void init_empty_tree_cfg_for_function (struct function
*);
577 extern void fold_cond_expr_cond (void);
578 extern void make_abnormal_goto_edges (basic_block
, bool);
579 extern void replace_uses_by (tree
, tree
);
580 extern void start_recording_case_labels (void);
581 extern void end_recording_case_labels (void);
582 extern basic_block
move_sese_region_to_fn (struct function
*, basic_block
,
584 void remove_edge_and_dominated_blocks (edge
);
585 void mark_virtual_ops_in_bb (basic_block
);
587 /* In tree-cfgcleanup.c */
588 extern bitmap cfgcleanup_altered_bbs
;
589 extern bool cleanup_tree_cfg (void);
591 /* In tree-pretty-print.c. */
592 extern void dump_generic_bb (FILE *, basic_block
, int, int);
593 extern int op_code_prio (enum tree_code
);
594 extern int op_prio (const_tree
);
595 extern const char *op_symbol_code (enum tree_code
);
598 extern var_ann_t
create_var_ann (tree
);
599 extern function_ann_t
create_function_ann (tree
);
600 extern void renumber_gimple_stmt_uids (void);
601 extern tree_ann_common_t
create_tree_common_ann (tree
);
602 extern void dump_dfa_stats (FILE *);
603 extern void debug_dfa_stats (void);
604 extern void debug_referenced_vars (void);
605 extern void dump_referenced_vars (FILE *);
606 extern void dump_variable (FILE *, tree
);
607 extern void debug_variable (tree
);
608 extern tree
get_virtual_var (tree
);
609 extern bool add_referenced_var (tree
);
610 extern void remove_referenced_var (tree
);
611 extern void mark_symbols_for_renaming (gimple
);
612 extern void find_new_referenced_vars (gimple
);
613 extern tree
make_rename_temp (tree
, const char *);
614 extern void set_default_def (tree
, tree
);
615 extern tree
gimple_default_def (struct function
*, tree
);
616 extern bool stmt_references_abnormal_ssa_name (gimple
);
617 extern tree
get_ref_base_and_extent (tree
, HOST_WIDE_INT
*,
618 HOST_WIDE_INT
*, HOST_WIDE_INT
*);
620 /* In tree-phinodes.c */
621 extern void reserve_phi_args_for_new_edge (basic_block
);
622 extern void add_phi_node_to_bb (gimple phi
, basic_block bb
);
623 extern gimple
make_phi_node (tree var
, int len
);
624 extern gimple
create_phi_node (tree
, basic_block
);
625 extern void add_phi_arg (gimple
, tree
, edge
);
626 extern void remove_phi_args (edge
);
627 extern void remove_phi_node (gimple_stmt_iterator
*, bool);
628 extern void remove_phi_nodes (basic_block
);
629 extern void init_phinodes (void);
630 extern void fini_phinodes (void);
631 extern void release_phi_node (gimple
);
632 #ifdef GATHER_STATISTICS
633 extern void phinodes_print_statistics (void);
636 /* In gimple-low.c */
637 extern void record_vars_into (tree
, tree
);
638 extern void record_vars (tree
);
639 extern bool block_may_fallthru (const_tree
);
640 extern bool gimple_seq_may_fallthru (gimple_seq
);
641 extern bool gimple_stmt_may_fallthru (gimple
);
646 /* Mapping for redirected edges. */
647 struct _edge_var_map
GTY(())
649 tree result
; /* PHI result. */
650 tree def
; /* PHI arg definition. */
652 typedef struct _edge_var_map edge_var_map
;
654 DEF_VEC_O(edge_var_map
);
655 DEF_VEC_ALLOC_O(edge_var_map
, heap
);
657 /* A vector of var maps. */
658 typedef VEC(edge_var_map
, heap
) *edge_var_map_vector
;
660 extern void init_tree_ssa (struct function
*);
661 extern void redirect_edge_var_map_add (edge
, tree
, tree
);
662 extern void redirect_edge_var_map_clear (edge
);
663 extern void redirect_edge_var_map_dup (edge
, edge
);
664 extern edge_var_map_vector
redirect_edge_var_map_vector (edge
);
665 extern void redirect_edge_var_map_destroy (void);
667 extern edge
ssa_redirect_edge (edge
, basic_block
);
668 extern void flush_pending_stmts (edge
);
669 extern void verify_ssa (bool);
670 extern void delete_tree_ssa (void);
671 extern bool ssa_undefined_value_p (tree
);
672 extern void execute_update_addresses_taken (bool);
674 /* Call-back function for walk_use_def_chains(). At each reaching
675 definition, a function with this prototype is called. */
676 typedef bool (*walk_use_def_chains_fn
) (tree
, gimple
, void *);
678 extern void walk_use_def_chains (tree
, walk_use_def_chains_fn
, void *, bool);
681 /* In tree-into-ssa.c */
682 void update_ssa (unsigned);
683 void delete_update_ssa (void);
684 void register_new_name_mapping (tree
, tree
);
685 tree
create_new_def_for (tree
, gimple
, def_operand_p
);
686 bool need_ssa_update_p (struct function
*);
687 bool name_mappings_registered_p (void);
688 bool name_registered_for_update_p (tree
);
689 bitmap
ssa_names_to_replace (void);
690 void release_ssa_name_after_update_ssa (tree
);
691 void compute_global_livein (bitmap
, bitmap
);
692 void mark_sym_for_renaming (tree
);
693 void mark_set_for_renaming (bitmap
);
694 tree
get_current_def (tree
);
695 void set_current_def (tree
, tree
);
697 /* In tree-ssanames.c */
698 extern void init_ssanames (struct function
*, int);
699 extern void fini_ssanames (void);
700 extern tree
make_ssa_name_fn (struct function
*, tree
, gimple
);
701 extern tree
duplicate_ssa_name (tree
, gimple
);
702 extern void duplicate_ssa_name_ptr_info (tree
, struct ptr_info_def
*);
703 extern void release_ssa_name (tree
);
704 extern void release_defs (gimple
);
705 extern void replace_ssa_name_symbol (tree
, tree
);
707 #ifdef GATHER_STATISTICS
708 extern void ssanames_print_statistics (void);
711 /* In tree-ssa-ccp.c */
712 bool fold_stmt (gimple_stmt_iterator
*);
713 bool fold_stmt_inplace (gimple
);
714 tree
get_symbol_constant_value (tree
);
715 tree
fold_const_aggregate_ref (tree
);
716 bool may_propagate_address_into_dereference (tree
, tree
);
720 tree
vrp_evaluate_conditional (enum tree_code
, tree
, tree
, gimple
);
721 bool simplify_stmt_using_ranges (gimple_stmt_iterator
*);
723 /* In tree-ssa-dom.c */
724 extern void dump_dominator_optimization_stats (FILE *);
725 extern void debug_dominator_optimization_stats (void);
726 int loop_depth_of_name (tree
);
727 tree
degenerate_phi_result (gimple
);
729 /* In tree-ssa-copy.c */
730 extern void merge_alias_info (tree
, tree
);
731 extern void propagate_value (use_operand_p
, tree
);
732 extern void propagate_tree_value (tree
*, tree
);
733 extern void propagate_tree_value_into_stmt (gimple_stmt_iterator
*, tree
);
734 extern void replace_exp (use_operand_p
, tree
);
735 extern bool may_propagate_copy (tree
, tree
);
736 extern bool may_propagate_copy_into_stmt (gimple
, tree
);
737 extern bool may_propagate_copy_into_asm (tree
);
743 /* Iv = BASE + STEP * i. */
746 /* True if this iv does not overflow. */
750 /* Description of number of iterations of a loop. All the expressions inside
751 the structure can be evaluated at the end of the loop's preheader
752 (and due to ssa form, also anywhere inside the body of the loop). */
754 struct tree_niter_desc
756 tree assumptions
; /* The boolean expression. If this expression evaluates
757 to false, then the other fields in this structure
758 should not be used; there is no guarantee that they
760 tree may_be_zero
; /* The boolean expression. If it evaluates to true,
761 the loop will exit in the first iteration (i.e.
762 its latch will not be executed), even if the niter
763 field says otherwise. */
764 tree niter
; /* The expression giving the number of iterations of
765 a loop (provided that assumptions == true and
766 may_be_zero == false), more precisely the number
767 of executions of the latch of the loop. */
768 double_int max
; /* The upper bound on the number of iterations of
771 /* The simplified shape of the exit condition. The loop exits if
772 CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
773 LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
774 LE_EXPR and negative if CMP is GE_EXPR. This information is used
775 by loop unrolling. */
781 /* In tree-vectorizer.c */
782 unsigned vectorize_loops (void);
783 extern bool vect_can_force_dr_alignment_p (const_tree
, unsigned int);
784 extern tree
get_vectype_for_scalar_type (tree
);
786 /* In tree-ssa-phiopt.c */
787 bool empty_block_p (basic_block
);
788 basic_block
*blocks_in_phiopt_order (void);
790 /* In tree-ssa-loop*.c */
792 void tree_ssa_lim (void);
793 unsigned int tree_ssa_unswitch_loops (void);
794 unsigned int canonicalize_induction_variables (void);
795 unsigned int tree_unroll_loops_completely (bool, bool);
796 unsigned int tree_ssa_prefetch_arrays (void);
797 unsigned int remove_empty_loops (void);
798 void tree_ssa_iv_optimize (void);
799 unsigned tree_predictive_commoning (void);
800 tree
canonicalize_loop_ivs (struct loop
*, htab_t
, tree
*);
801 bool parallelize_loops (void);
803 bool loop_only_exit_p (const struct loop
*, const_edge
);
804 bool number_of_iterations_exit (struct loop
*, edge
,
805 struct tree_niter_desc
*niter
, bool);
806 tree
find_loop_niter (struct loop
*, edge
*);
807 tree
loop_niter_by_eval (struct loop
*, edge
);
808 tree
find_loop_niter_by_eval (struct loop
*, edge
*);
809 void estimate_numbers_of_iterations (void);
810 bool scev_probably_wraps_p (tree
, tree
, gimple
, struct loop
*, bool);
811 bool convert_affine_scev (struct loop
*, tree
, tree
*, tree
*, gimple
, bool);
813 bool nowrap_type_p (tree
);
814 enum ev_direction
{EV_DIR_GROWS
, EV_DIR_DECREASES
, EV_DIR_UNKNOWN
};
815 enum ev_direction
scev_direction (const_tree
);
817 void free_numbers_of_iterations_estimates (void);
818 void free_numbers_of_iterations_estimates_loop (struct loop
*);
819 void rewrite_into_loop_closed_ssa (bitmap
, unsigned);
820 void verify_loop_closed_ssa (void);
821 bool for_each_index (tree
*, bool (*) (tree
, tree
*, void *), void *);
822 void create_iv (tree
, tree
, tree
, struct loop
*, gimple_stmt_iterator
*, bool,
824 basic_block
split_loop_exit_edge (edge
);
825 void standard_iv_increment_position (struct loop
*, gimple_stmt_iterator
*,
827 basic_block
ip_end_pos (struct loop
*);
828 basic_block
ip_normal_pos (struct loop
*);
829 bool gimple_duplicate_loop_to_header_edge (struct loop
*, edge
,
830 unsigned int, sbitmap
,
831 edge
, VEC (edge
, heap
) **,
833 struct loop
*slpeel_tree_duplicate_loop_to_edge_cfg (struct loop
*, edge
);
834 void rename_variables_in_loop (struct loop
*);
835 void rename_variables_in_bb (basic_block bb
);
836 struct loop
*tree_ssa_loop_version (struct loop
*, tree
,
838 tree
expand_simple_operations (tree
);
839 void substitute_in_loop_info (struct loop
*, tree
, tree
);
840 edge
single_dom_exit (struct loop
*);
841 bool can_unroll_loop_p (struct loop
*loop
, unsigned factor
,
842 struct tree_niter_desc
*niter
);
843 void tree_unroll_loop (struct loop
*, unsigned,
844 edge
, struct tree_niter_desc
*);
845 typedef void (*transform_callback
)(struct loop
*, void *);
846 void tree_transform_and_unroll_loop (struct loop
*, unsigned,
847 edge
, struct tree_niter_desc
*,
848 transform_callback
, void *);
849 bool contains_abnormal_ssa_name_p (tree
);
850 bool stmt_dominates_stmt_p (gimple
, gimple
);
851 void mark_virtual_ops_for_renaming (gimple
);
853 /* In tree-ssa-threadedge.c */
854 extern bool potentially_threadable_block (basic_block
);
855 extern void thread_across_edge (gimple
, edge
, bool,
856 VEC(tree
, heap
) **, tree (*) (gimple
, gimple
));
858 /* In tree-ssa-loop-im.c */
859 /* The possibilities of statement movement. */
863 MOVE_IMPOSSIBLE
, /* No movement -- side effect expression. */
864 MOVE_PRESERVE_EXECUTION
, /* Must not cause the non-executed statement
865 become executed -- memory accesses, ... */
866 MOVE_POSSIBLE
/* Unlimited movement. */
868 extern enum move_pos
movement_possibility (gimple
);
869 char *get_lsm_tmp_name (tree
, unsigned);
871 /* In tree-flow-inline.h */
872 static inline bool is_call_clobbered (const_tree
);
873 static inline void set_is_used (tree
);
874 static inline bool unmodifiable_var_p (const_tree
);
875 static inline bool ref_contains_array_ref (const_tree
);
876 static inline bool array_ref_contains_indirect_ref (const_tree
);
879 extern void make_eh_edges (gimple
);
880 extern bool tree_could_trap_p (tree
);
881 extern bool operation_could_trap_helper_p (enum tree_code
, bool, bool, bool,
883 extern bool operation_could_trap_p (enum tree_code
, bool, bool, tree
);
884 extern bool stmt_could_throw_p (gimple
);
885 extern bool tree_could_throw_p (tree
);
886 extern bool stmt_can_throw_internal (gimple
);
887 extern bool stmt_can_throw_external (gimple
);
888 extern void add_stmt_to_eh_region (gimple
, int);
889 extern bool remove_stmt_from_eh_region (gimple
);
890 extern bool maybe_clean_or_replace_eh_stmt (gimple
, gimple
);
891 extern void add_stmt_to_eh_region_fn (struct function
*, gimple
, int);
892 extern bool remove_stmt_from_eh_region_fn (struct function
*, gimple
);
893 extern int lookup_stmt_eh_region_fn (struct function
*, gimple
);
894 extern int lookup_expr_eh_region (tree
);
895 extern int lookup_stmt_eh_region (gimple
);
896 extern bool verify_eh_edges (gimple
);
899 /* In tree-ssa-pre.c */
901 void add_to_value (unsigned int, struct pre_expr_d
*);
902 void debug_value_expressions (unsigned int);
903 void print_value_expressions (FILE *, unsigned int);
907 tree
make_value_handle (tree
);
908 void set_value_handle (tree
, tree
);
909 bool expressions_equal_p (tree
, tree
);
910 void sort_vuses (VEC (tree
, gc
) *);
911 void sort_vuses_heap (VEC (tree
, heap
) *);
912 tree
vn_lookup_or_add (tree
);
913 tree
vn_lookup_or_add_with_stmt (tree
, gimple
);
914 tree
vn_lookup_or_add_with_vuses (tree
, VEC (tree
, gc
) *);
915 void vn_add (tree
, tree
);
916 void vn_add_with_vuses (tree
, tree
, VEC (tree
, gc
) *);
917 tree
vn_lookup_with_stmt (tree
, gimple
);
918 tree
vn_lookup (tree
);
919 tree
vn_lookup_with_vuses (tree
, VEC (tree
, gc
) *);
921 /* In tree-ssa-sink.c */
922 bool is_hidden_global_store (gimple
);
925 void insert_edge_copies_seq (gimple_seq
, basic_block
);
926 void sra_insert_before (gimple_stmt_iterator
*, gimple_seq
);
927 void sra_insert_after (gimple_stmt_iterator
*, gimple_seq
);
928 void sra_init_cache (void);
929 bool sra_type_can_be_decomposed_p (tree
);
931 /* In tree-loop-linear.c */
932 extern void linear_transform_loops (void);
933 extern unsigned perfect_loop_nest_depth (struct loop
*);
936 extern void graphite_transform_loops (void);
938 /* In tree-data-ref.c */
939 extern void tree_check_data_deps (void);
941 /* In tree-ssa-loop-ivopts.c */
942 bool expr_invariant_in_loop_p (struct loop
*, tree
);
943 bool stmt_invariant_in_loop_p (struct loop
*, gimple
);
944 bool multiplier_allowed_in_address_p (HOST_WIDE_INT
, enum machine_mode
);
945 unsigned multiply_by_cost (HOST_WIDE_INT
, enum machine_mode
, bool);
947 /* In tree-ssa-threadupdate.c. */
948 extern bool thread_through_all_blocks (bool);
949 extern void register_jump_thread (edge
, edge
);
952 tree
force_gimple_operand (tree
, gimple_seq
*, bool, tree
);
953 tree
force_gimple_operand_gsi (gimple_stmt_iterator
*, tree
, bool, tree
,
954 bool, enum gsi_iterator_update
);
955 tree
gimple_fold_indirect_ref (tree
);
956 void mark_addressable (tree
);
958 /* In tree-ssa-live.c */
959 extern void remove_unused_locals (void);
960 extern void dump_scope_blocks (FILE *, int);
962 /* In tree-ssa-address.c */
964 /* Description of a memory address. */
968 tree symbol
, base
, index
, step
, offset
;
971 struct affine_tree_combination
;
972 tree
create_mem_ref (gimple_stmt_iterator
*, tree
,
973 struct affine_tree_combination
*, bool);
974 rtx
addr_for_mem_ref (struct mem_address
*, bool);
975 void get_address_description (tree
, struct mem_address
*);
976 tree
maybe_fold_tmr (tree
);
978 unsigned int execute_fixup_cfg (void);
980 #include "tree-flow-inline.h"
982 void swap_tree_operands (gimple
, tree
*, tree
*);
984 int least_common_multiple (int, int);
986 #endif /* _TREE_FLOW_H */