]> gcc.gnu.org Git - gcc.git/blame - gcc/tree-flow.h
tree-flow.h: Remove some prototypes.
[gcc.git] / gcc / tree-flow.h
CommitLineData
6de9cd9a 1/* Data and Control Flow Analysis for Trees.
d1e082c2 2 Copyright (C) 2001-2013 Free Software Foundation, Inc.
6de9cd9a
DN
3 Contributed by Diego Novillo <dnovillo@redhat.com>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9dcd6f09 9the Free Software Foundation; either version 3, or (at your option)
6de9cd9a
DN
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
9dcd6f09
NC
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
6de9cd9a
DN
20
21#ifndef _TREE_FLOW_H
22#define _TREE_FLOW_H 1
23
24#include "bitmap.h"
7a8cba34 25#include "sbitmap.h"
6de9cd9a
DN
26#include "basic-block.h"
27#include "hashtab.h"
726a989a 28#include "gimple.h"
6de9cd9a 29#include "tree-ssa-operands.h"
6674a6ce 30#include "cgraph.h"
ea900239 31#include "ipa-reference.h"
5006671f 32#include "tree-ssa-alias.h"
cf2d1b38
AM
33#include "tree-cfgcleanup.h"
34#include "tree-dfa.h"
35#include "tree-pretty-print.h"
36#include "gimple-low.h"
37#include "tree-into-ssa.h"
e9e0aa2c 38
0a35513e
AH
39/* This structure is used to map a gimple statement to a label,
40 or list of labels to represent transaction restart. */
41
42struct GTY(()) tm_restart_node {
43 gimple stmt;
44 tree label_or_list;
45};
46
2f8e468b
KH
47/* Gimple dataflow datastructure. All publicly available fields shall have
48 gimple_ accessor defined in tree-flow-inline.h, all publicly modifiable
5cd4ec7f 49 fields should have gimple_set accessor. */
d1b38208 50struct GTY(()) gimple_df {
726a989a 51 /* A vector of all the noreturn calls passed to modify_stmt.
5cd4ec7f
JH
52 cleanup_control_flow uses it to detect cases where a mid-block
53 indirect call has been turned into a noreturn call. When this
54 happens, all the instructions after the call are no longer
55 reachable and must be deleted as dead. */
9771b263 56 vec<gimple, va_gc> *modified_noreturn_calls;
38635499 57
5cd4ec7f 58 /* Array of all SSA_NAMEs used in the function. */
9771b263 59 vec<tree, va_gc> *ssa_names;
5cd4ec7f 60
5006671f
RG
61 /* Artificial variable used for the virtual operand FUD chain. */
62 tree vop;
5cd4ec7f 63
5006671f
RG
64 /* The PTA solution for the ESCAPED artificial variable. */
65 struct pt_solution escaped;
15c15196 66
55b34b5f
RG
67 /* A map of decls to artificial ssa-names that point to the partition
68 of the decl. */
69 struct pointer_map_t * GTY((skip(""))) decls_to_pointers;
70
5cd4ec7f 71 /* Free list of SSA_NAMEs. */
9771b263 72 vec<tree, va_gc> *free_ssanames;
5cd4ec7f
JH
73
74 /* Hashtable holding definition for symbol. If this field is not NULL, it
75 means that the first reference to this variable in the function is a
76 USE or a VUSE. In those cases, the SSA renamer creates an SSA name
77 for this variable with an empty defining statement. */
e445a2ff 78 htab_t GTY((param_is (union tree_node))) default_defs;
5cd4ec7f 79
13714310
RG
80 /* True if there are any symbols that need to be renamed. */
81 unsigned int ssa_renaming_needed : 1;
82
83 /* True if all virtual operands need to be renamed. */
84 unsigned int rename_vops : 1;
5cd4ec7f
JH
85
86 /* True if the code is in ssa form. */
87 unsigned int in_ssa_p : 1;
456cde30 88
25a6a873
RG
89 /* True if IPA points-to information was computed for this function. */
90 unsigned int ipa_pta : 1;
91
456cde30 92 struct ssa_operands ssa_operands;
0a35513e
AH
93
94 /* Map gimple stmt to tree label (or list of labels) for transaction
95 restart and abort. */
96 htab_t GTY ((param_is (struct tm_restart_node))) tm_restart;
5cd4ec7f
JH
97};
98
726a989a 99static inline int get_lineno (const_gimple);
6de9cd9a 100
6de9cd9a
DN
101/*---------------------------------------------------------------------------
102 Global declarations
103---------------------------------------------------------------------------*/
1aa67003 104struct int_tree_map {
a3648cfc
DB
105 unsigned int uid;
106 tree to;
107};
108
6de9cd9a
DN
109/* Macros for showing usage statistics. */
110#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
111 ? (x) \
112 : ((x) < 1024*1024*10 \
113 ? (x) / 1024 \
114 : (x) / (1024*1024))))
115
116#define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
117
118#define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
119
777f7f9a
RH
120/*---------------------------------------------------------------------------
121 OpenMP Region Tree
122---------------------------------------------------------------------------*/
123
124/* Parallel region information. Every parallel and workshare
125 directive is enclosed between two markers, the OMP_* directive
126 and a corresponding OMP_RETURN statement. */
127
128struct omp_region
129{
130 /* The enclosing region. */
131 struct omp_region *outer;
132
133 /* First child region. */
134 struct omp_region *inner;
135
136 /* Next peer region. */
137 struct omp_region *next;
138
139 /* Block containing the omp directive as its last stmt. */
140 basic_block entry;
141
142 /* Block containing the OMP_RETURN as its last stmt. */
143 basic_block exit;
144
145 /* Block containing the OMP_CONTINUE as its last stmt. */
146 basic_block cont;
147
148 /* If this is a combined parallel+workshare region, this is a list
149 of additional arguments needed by the combined parallel+workshare
150 library call. */
9771b263 151 vec<tree, va_gc> *ws_args;
777f7f9a
RH
152
153 /* The code for the omp directive of this region. */
726a989a 154 enum gimple_code type;
777f7f9a 155
21a66e91
JJ
156 /* Schedule kind, only used for OMP_FOR type regions. */
157 enum omp_clause_schedule_kind sched_kind;
158
777f7f9a
RH
159 /* True if this is a combined parallel+workshare region. */
160 bool is_combined_parallel;
161};
162
163extern struct omp_region *root_omp_region;
726a989a 164extern struct omp_region *new_omp_region (basic_block, enum gimple_code,
777f7f9a
RH
165 struct omp_region *);
166extern void free_omp_regions (void);
5f40b3cb 167void omp_expand_local (basic_block);
917948d3 168tree copy_var_decl (tree, tree, tree);
777f7f9a 169
6de9cd9a
DN
170/*---------------------------------------------------------------------------
171 Function prototypes
172---------------------------------------------------------------------------*/
173/* In tree-cfg.c */
174
175/* Location to track pending stmt for edge insertion. */
726a989a 176#define PENDING_STMT(e) ((e)->insns.g)
6de9cd9a 177
242229bb 178extern void delete_tree_cfg_annotations (void);
726a989a
RB
179extern bool stmt_ends_bb_p (gimple);
180extern bool is_ctrl_stmt (gimple);
181extern bool is_ctrl_altering_stmt (gimple);
182extern bool simple_goto_p (gimple);
183extern bool stmt_can_make_abnormal_goto (gimple);
bc23502b 184extern basic_block single_noncomplex_succ (basic_block bb);
a315c44c 185extern void gimple_dump_bb (FILE *, basic_block, int, int);
726a989a
RB
186extern void gimple_debug_bb (basic_block);
187extern basic_block gimple_debug_bb_n (int);
188extern void gimple_dump_cfg (FILE *, int);
189extern void gimple_debug_cfg (int);
6de9cd9a 190extern void dump_cfg_stats (FILE *);
0c8efed8 191extern void dot_cfg (void);
6de9cd9a 192extern void debug_cfg_stats (void);
0c8efed8
SP
193extern void debug_loops (int);
194extern void debug_loop (struct loop *, int);
7b3b6ae4
LC
195extern void debug (struct loop &ref);
196extern void debug (struct loop *ptr);
197extern void debug_verbose (struct loop &ref);
198extern void debug_verbose (struct loop *ptr);
0c8efed8
SP
199extern void debug_loop_num (unsigned, int);
200extern void print_loops (FILE *, int);
201extern void print_loops_bb (FILE *, basic_block, int, int);
165b54c3 202extern void cleanup_dead_labels (void);
238065a7 203extern void group_case_labels_stmt (gimple);
165b54c3 204extern void group_case_labels (void);
726a989a
RB
205extern gimple first_stmt (basic_block);
206extern gimple last_stmt (basic_block);
207extern gimple last_and_only_stmt (basic_block);
6de9cd9a 208extern edge find_taken_edge (basic_block, tree);
997de8ed
SB
209extern basic_block label_to_block_fn (struct function *, tree);
210#define label_to_block(t) (label_to_block_fn (cfun, t))
726a989a 211extern void notice_special_calls (gimple);
6de9cd9a 212extern void clear_special_calls (void);
34019e28
RG
213extern void verify_gimple_in_seq (gimple_seq);
214extern void verify_gimple_in_cfg (struct function *);
726a989a 215extern tree gimple_block_label (basic_block);
6de9cd9a 216extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
726a989a 217extern bool gimple_duplicate_sese_region (edge, edge, basic_block *, unsigned,
f14540b6 218 basic_block *, bool);
726a989a 219extern bool gimple_duplicate_sese_tail (edge, edge, basic_block *, unsigned,
5f40b3cb 220 basic_block *);
9f9f72aa 221extern void gather_blocks_in_sese_region (basic_block entry, basic_block exit,
9771b263 222 vec<basic_block> *bbs_p);
42759f1e 223extern void add_phi_args_after_copy_bb (basic_block);
5f40b3cb 224extern void add_phi_args_after_copy (basic_block *, unsigned, edge);
726a989a
RB
225extern bool gimple_purge_dead_eh_edges (basic_block);
226extern bool gimple_purge_all_dead_eh_edges (const_bitmap);
30fd5881
EB
227extern bool gimple_purge_dead_abnormal_call_edges (basic_block);
228extern bool gimple_purge_all_dead_abnormal_call_edges (const_bitmap);
726a989a 229extern tree gimplify_build1 (gimple_stmt_iterator *, enum tree_code,
26277d41 230 tree, tree);
726a989a 231extern tree gimplify_build2 (gimple_stmt_iterator *, enum tree_code,
26277d41 232 tree, tree, tree);
726a989a 233extern tree gimplify_build3 (gimple_stmt_iterator *, enum tree_code,
26277d41 234 tree, tree, tree, tree);
a930a4ef 235extern void init_empty_tree_cfg (void);
908ff6a3 236extern void init_empty_tree_cfg_for_function (struct function *);
e21aff8a 237extern void fold_cond_expr_cond (void);
4f6c2131 238extern void make_abnormal_goto_edges (basic_block, bool);
684aaf29 239extern void replace_uses_by (tree, tree);
c9784e6d
KH
240extern void start_recording_case_labels (void);
241extern void end_recording_case_labels (void);
50674e96 242extern basic_block move_sese_region_to_fn (struct function *, basic_block,
b357f682 243 basic_block, tree);
672987e8 244void remove_edge_and_dominated_blocks (edge);
d7f09764 245bool tree_node_can_be_shared (tree);
c9784e6d 246
31432e21
RG
247/* In tree-ssa-loop-ch.c */
248bool do_while_loop_p (struct loop *);
249
17684618
ZD
250/* Affine iv. */
251
252typedef struct
253{
254 /* Iv = BASE + STEP * i. */
255 tree base, step;
256
257 /* True if this iv does not overflow. */
258 bool no_overflow;
259} affine_iv;
260
e9eb809d
ZD
261/* Description of number of iterations of a loop. All the expressions inside
262 the structure can be evaluated at the end of the loop's preheader
263 (and due to ssa form, also anywhere inside the body of the loop). */
264
265struct tree_niter_desc
266{
6cb38cd4 267 tree assumptions; /* The boolean expression. If this expression evaluates
e9eb809d
ZD
268 to false, then the other fields in this structure
269 should not be used; there is no guarantee that they
270 will be correct. */
2a7e31df 271 tree may_be_zero; /* The boolean expression. If it evaluates to true,
e9eb809d
ZD
272 the loop will exit in the first iteration (i.e.
273 its latch will not be executed), even if the niter
274 field says otherwise. */
275 tree niter; /* The expression giving the number of iterations of
276 a loop (provided that assumptions == true and
277 may_be_zero == false), more precisely the number
278 of executions of the latch of the loop. */
b3ce5b6e
ZD
279 double_int max; /* The upper bound on the number of iterations of
280 the loop. */
17684618
ZD
281
282 /* The simplified shape of the exit condition. The loop exits if
283 CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
284 LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
285 LE_EXPR and negative if CMP is GE_EXPR. This information is used
286 by loop unrolling. */
287 affine_iv control;
288 tree bound;
289 enum tree_code cmp;
e9eb809d
ZD
290};
291
79fe1b3b 292
e9eb809d
ZD
293/* In tree-ssa-loop*.c */
294
e3bdfed6 295unsigned int tree_ssa_lim (void);
d73be268
ZD
296unsigned int tree_ssa_unswitch_loops (void);
297unsigned int canonicalize_induction_variables (void);
d6e840ee 298unsigned int tree_unroll_loops_completely (bool, bool);
d73be268 299unsigned int tree_ssa_prefetch_arrays (void);
d73be268 300void tree_ssa_iv_optimize (void);
592c303d 301unsigned tree_predictive_commoning (void);
c80a5403 302tree canonicalize_loop_ivs (struct loop *, tree *, bool);
5f40b3cb 303bool parallelize_loops (void);
a7e5372d 304
52778e2a 305bool loop_only_exit_p (const struct loop *, const_edge);
e9eb809d 306bool number_of_iterations_exit (struct loop *, edge,
e152d14c
JH
307 struct tree_niter_desc *niter, bool,
308 bool every_iteration = true);
ca4c3169 309tree find_loop_niter (struct loop *, edge *);
e9eb809d
ZD
310tree loop_niter_by_eval (struct loop *, edge);
311tree find_loop_niter_by_eval (struct loop *, edge *);
421e6082 312void estimate_numbers_of_iterations (void);
726a989a
RB
313bool scev_probably_wraps_p (tree, tree, gimple, struct loop *, bool);
314bool convert_affine_scev (struct loop *, tree, tree *, tree *, gimple, bool);
d7f5de76
ZD
315
316bool nowrap_type_p (tree);
317enum ev_direction {EV_DIR_GROWS, EV_DIR_DECREASES, EV_DIR_UNKNOWN};
ed7a4b4b 318enum ev_direction scev_direction (const_tree);
d7f5de76 319
d73be268 320void free_numbers_of_iterations_estimates (void);
c9639aae 321void free_numbers_of_iterations_estimates_loop (struct loop *);
84d65814 322void rewrite_into_loop_closed_ssa (bitmap, unsigned);
a3b9e73c 323void verify_loop_closed_ssa (bool);
a7e5372d 324bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
726a989a 325void create_iv (tree, tree, tree, struct loop *, gimple_stmt_iterator *, bool,
82b85a85 326 tree *, tree *);
5f40b3cb 327basic_block split_loop_exit_edge (edge);
726a989a 328void standard_iv_increment_position (struct loop *, gimple_stmt_iterator *,
8b11a64c
ZD
329 bool *);
330basic_block ip_end_pos (struct loop *);
331basic_block ip_normal_pos (struct loop *);
726a989a 332bool gimple_duplicate_loop_to_header_edge (struct loop *, edge,
92fc4a2f 333 unsigned int, sbitmap,
9771b263 334 edge, vec<edge> *,
ee8c1b05 335 int);
dea61d92 336struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *, edge);
d7bf3bcf 337tree expand_simple_operations (tree);
d5ab5675 338void substitute_in_loop_info (struct loop *, tree, tree);
b7eae7b8 339edge single_dom_exit (struct loop *);
17684618
ZD
340bool can_unroll_loop_p (struct loop *loop, unsigned factor,
341 struct tree_niter_desc *niter);
d73be268 342void tree_unroll_loop (struct loop *, unsigned,
17684618 343 edge, struct tree_niter_desc *);
567b96ed
ZD
344typedef void (*transform_callback)(struct loop *, void *);
345void tree_transform_and_unroll_loop (struct loop *, unsigned,
346 edge, struct tree_niter_desc *,
347 transform_callback, void *);
e5db3515 348bool contains_abnormal_ssa_name_p (tree);
726a989a 349bool stmt_dominates_stmt_p (gimple, gimple);
e9eb809d 350
2090d6a0 351/* In tree-ssa-threadedge.c */
448ee662
RG
352extern void threadedge_initialize_values (void);
353extern void threadedge_finalize_values (void);
9771b263 354extern vec<tree> ssa_name_values;
448ee662 355#define SSA_NAME_VALUE(x) \
c3284718
RS
356 (SSA_NAME_VERSION (x) < ssa_name_values.length () \
357 ? ssa_name_values[SSA_NAME_VERSION (x)] \
448ee662
RG
358 : NULL_TREE)
359extern void set_ssa_name_value (tree, tree);
2090d6a0 360extern bool potentially_threadable_block (basic_block);
726a989a 361extern void thread_across_edge (gimple, edge, bool,
9771b263 362 vec<tree> *, tree (*) (gimple, gimple));
6e02b5f5 363extern void propagate_threaded_block_debug_into (basic_block, basic_block);
2090d6a0 364
40923b20
DP
365/* In tree-ssa-loop-im.c */
366/* The possibilities of statement movement. */
367
368enum move_pos
369 {
370 MOVE_IMPOSSIBLE, /* No movement -- side effect expression. */
371 MOVE_PRESERVE_EXECUTION, /* Must not cause the non-executed statement
372 become executed -- memory accesses, ... */
373 MOVE_POSSIBLE /* Unlimited movement. */
374 };
726a989a 375extern enum move_pos movement_possibility (gimple);
bbc8a8dc 376char *get_lsm_tmp_name (tree, unsigned);
d16a5e36 377
6de9cd9a 378/* In tree-flow-inline.h */
9566a759 379static inline bool unmodifiable_var_p (const_tree);
5006671f 380static inline bool ref_contains_array_ref (const_tree);
6de9cd9a
DN
381
382/* In tree-eh.c */
726a989a 383extern void make_eh_edges (gimple);
1d65f45c
RH
384extern bool make_eh_dispatch_edges (gimple);
385extern edge redirect_eh_edge (edge, basic_block);
386extern void redirect_eh_dispatch_edge (gimple, edge, basic_block);
726a989a 387extern bool stmt_could_throw_p (gimple);
726a989a 388extern bool stmt_can_throw_internal (gimple);
33977f81 389extern bool stmt_can_throw_external (gimple);
1d65f45c
RH
390extern void add_stmt_to_eh_lp_fn (struct function *, gimple, int);
391extern void add_stmt_to_eh_lp (gimple, int);
392extern bool remove_stmt_from_eh_lp (gimple);
393extern bool remove_stmt_from_eh_lp_fn (struct function *, gimple);
394extern int lookup_stmt_eh_lp_fn (struct function *, gimple);
1d65f45c
RH
395extern int lookup_stmt_eh_lp (gimple);
396extern bool maybe_clean_eh_stmt_fn (struct function *, gimple);
397extern bool maybe_clean_eh_stmt (gimple);
726a989a 398extern bool maybe_clean_or_replace_eh_stmt (gimple, gimple);
1d65f45c
RH
399extern bool maybe_duplicate_eh_stmt_fn (struct function *, gimple,
400 struct function *, gimple,
401 struct pointer_map_t *, int);
402extern bool maybe_duplicate_eh_stmt (gimple, gimple);
726a989a 403extern bool verify_eh_edges (gimple);
1d65f45c 404extern bool verify_eh_dispatch_edge (gimple);
99d8763e 405extern void maybe_remove_unreachable_handlers (void);
6de9cd9a 406
33c94679 407/* In tree-ssa-pre.c */
c9145754 408void debug_value_expressions (unsigned int);
b71b4522 409
599eabdb 410/* In tree-loop-linear.c */
d73be268 411extern void linear_transform_loops (void);
f8bf9252
SP
412extern unsigned perfect_loop_nest_depth (struct loop *);
413
414/* In graphite.c */
415extern void graphite_transform_loops (void);
599eabdb 416
3d8864c0
SP
417/* In tree-data-ref.c */
418extern void tree_check_data_deps (void);
419
feb075f4 420/* In tree-ssa-loop-ivopts.c */
ac182688 421bool expr_invariant_in_loop_p (struct loop *, tree);
726a989a 422bool stmt_invariant_in_loop_p (struct loop *, gimple);
4ba5ea11 423struct loop *outermost_invariant_loop_for_expr (struct loop *, tree);
09e881c9
BE
424bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum machine_mode,
425 addr_space_t);
bc068a23 426bool may_be_nonaddressable_p (tree expr);
8b11a64c 427
9885da8e 428/* In gimplify.c */
bcf71673 429tree force_gimple_operand_1 (tree, gimple_seq *, gimple_predicate, tree);
726a989a 430tree force_gimple_operand (tree, gimple_seq *, bool, tree);
bcf71673
RG
431tree force_gimple_operand_gsi_1 (gimple_stmt_iterator *, tree,
432 gimple_predicate, tree,
433 bool, enum gsi_iterator_update);
726a989a
RB
434tree force_gimple_operand_gsi (gimple_stmt_iterator *, tree, bool, tree,
435 bool, enum gsi_iterator_update);
de4af523 436tree gimple_fold_indirect_ref (tree);
8b11a64c 437
3f519b35
RG
438/* In tree-ssa-live.c */
439extern void remove_unused_locals (void);
cff7525f 440extern void dump_scope_blocks (FILE *, int);
ac80ba07 441extern void debug_scope_blocks (int);
c6a21142 442extern void debug_scope_block (tree, int);
3f519b35 443
ac182688
ZD
444/* In tree-ssa-address.c */
445
ac182688
ZD
446/* Description of a memory address. */
447
448struct mem_address
449{
450 tree symbol, base, index, step, offset;
451};
452
73f30c63 453struct affine_tree_combination;
880a1451
XDL
454tree create_mem_ref (gimple_stmt_iterator *, tree,
455 struct affine_tree_combination *, tree, tree, tree, bool);
d4ebfa65 456rtx addr_for_mem_ref (struct mem_address *, addr_space_t, bool);
ac182688
ZD
457void get_address_description (tree, struct mem_address *);
458tree maybe_fold_tmr (tree);
50674e96 459
873aa8f5 460unsigned int execute_fixup_cfg (void);
c900f6aa 461
7ea6b6cf
JH
462/* In ipa-pure-const.c */
463void warn_function_noreturn (tree);
464
62e0a1ed
RG
465/* In tree-parloops.c */
466bool parallelized_function_p (tree);
467
6de9cd9a
DN
468#include "tree-flow-inline.h"
469
470#endif /* _TREE_FLOW_H */
This page took 4.875992 seconds and 5 git commands to generate.