PR target/66563
[official-gcc.git] / gcc / cfg.h
blobf5ea2ce897fef5bb96e8bc5bff8d283ac36ebe35
1 /* Control flow graph manipulation code header file.
2 Copyright (C) 2014-2015 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_CFG_H
21 #define GCC_CFG_H
23 /* What sort of profiling information we have. */
24 enum profile_status_d
26 PROFILE_ABSENT,
27 PROFILE_GUESSED,
28 PROFILE_READ,
29 PROFILE_LAST /* Last value, used by profile streaming. */
32 /* A structure to group all the per-function control flow graph data.
33 The x_* prefixing is necessary because otherwise references to the
34 fields of this struct are interpreted as the defines for backward
35 source compatibility following the definition of this struct. */
36 struct GTY(()) control_flow_graph {
37 /* Block pointers for the exit and entry of a function.
38 These are always the head and tail of the basic block list. */
39 basic_block x_entry_block_ptr;
40 basic_block x_exit_block_ptr;
42 /* Index by basic block number, get basic block struct info. */
43 vec<basic_block, va_gc> *x_basic_block_info;
45 /* Number of basic blocks in this flow graph. */
46 int x_n_basic_blocks;
48 /* Number of edges in this flow graph. */
49 int x_n_edges;
51 /* The first free basic block number. */
52 int x_last_basic_block;
54 /* UIDs for LABEL_DECLs. */
55 int last_label_uid;
57 /* Mapping of labels to their associated blocks. At present
58 only used for the gimple CFG. */
59 vec<basic_block, va_gc> *x_label_to_block_map;
61 enum profile_status_d x_profile_status;
63 /* Whether the dominators and the postdominators are available. */
64 enum dom_state x_dom_computed[2];
66 /* Number of basic blocks in the dominance tree. */
67 unsigned x_n_bbs_in_dom_tree[2];
69 /* Maximal number of entities in the single jumptable. Used to estimate
70 final flowgraph size. */
71 int max_jumptable_ents;
75 extern void init_flow (struct function *);
76 extern void clear_edges (void);
77 extern basic_block alloc_block (void);
78 extern void link_block (basic_block, basic_block);
79 extern void unlink_block (basic_block);
80 extern void compact_blocks (void);
81 extern void expunge_block (basic_block);
82 extern edge unchecked_make_edge (basic_block, basic_block, int);
83 extern edge cached_make_edge (sbitmap, basic_block, basic_block, int);
84 extern edge make_edge (basic_block, basic_block, int);
85 extern edge make_single_succ_edge (basic_block, basic_block, int);
86 extern void remove_edge_raw (edge);
87 extern void redirect_edge_succ (edge, basic_block);
88 extern void redirect_edge_pred (edge, basic_block);
89 extern void clear_bb_flags (void);
90 extern void dump_edge_info (FILE *, edge, int, int);
91 extern void debug (edge_def &ref);
92 extern void debug (edge_def *ptr);
93 extern void alloc_aux_for_blocks (int);
94 extern void clear_aux_for_blocks (void);
95 extern void free_aux_for_blocks (void);
96 extern void alloc_aux_for_edge (edge, int);
97 extern void alloc_aux_for_edges (int);
98 extern void clear_aux_for_edges (void);
99 extern void free_aux_for_edges (void);
100 extern void debug_bb (basic_block);
101 extern basic_block debug_bb_n (int);
102 extern void dump_bb_info (FILE *, basic_block, int, int, bool, bool);
103 extern void brief_dump_cfg (FILE *, int);
104 extern void update_bb_profile_for_threading (basic_block, int, gcov_type, edge);
105 extern void scale_bbs_frequencies_int (basic_block *, int, int, int);
106 extern void scale_bbs_frequencies_gcov_type (basic_block *, int, gcov_type,
107 gcov_type);
108 extern void initialize_original_copy_tables (void);
109 extern void free_original_copy_tables (void);
110 extern void set_bb_original (basic_block, basic_block);
111 extern basic_block get_bb_original (basic_block);
112 extern void set_bb_copy (basic_block, basic_block);
113 extern basic_block get_bb_copy (basic_block);
114 void set_loop_copy (struct loop *, struct loop *);
115 struct loop *get_loop_copy (struct loop *);
117 #endif /* GCC_CFG_H */