2015-08-31 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / cfg.h
blob7674667100b259d4057c6118c090c11dc7c1d53e
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 #include "dominance.h"
25 /* What sort of profiling information we have. */
26 enum profile_status_d
28 PROFILE_ABSENT,
29 PROFILE_GUESSED,
30 PROFILE_READ,
31 PROFILE_LAST /* Last value, used by profile streaming. */
34 /* A structure to group all the per-function control flow graph data.
35 The x_* prefixing is necessary because otherwise references to the
36 fields of this struct are interpreted as the defines for backward
37 source compatibility following the definition of this struct. */
38 struct GTY(()) control_flow_graph {
39 /* Block pointers for the exit and entry of a function.
40 These are always the head and tail of the basic block list. */
41 basic_block x_entry_block_ptr;
42 basic_block x_exit_block_ptr;
44 /* Index by basic block number, get basic block struct info. */
45 vec<basic_block, va_gc> *x_basic_block_info;
47 /* Number of basic blocks in this flow graph. */
48 int x_n_basic_blocks;
50 /* Number of edges in this flow graph. */
51 int x_n_edges;
53 /* The first free basic block number. */
54 int x_last_basic_block;
56 /* UIDs for LABEL_DECLs. */
57 int last_label_uid;
59 /* Mapping of labels to their associated blocks. At present
60 only used for the gimple CFG. */
61 vec<basic_block, va_gc> *x_label_to_block_map;
63 enum profile_status_d x_profile_status;
65 /* Whether the dominators and the postdominators are available. */
66 enum dom_state x_dom_computed[2];
68 /* Number of basic blocks in the dominance tree. */
69 unsigned x_n_bbs_in_dom_tree[2];
71 /* Maximal number of entities in the single jumptable. Used to estimate
72 final flowgraph size. */
73 int max_jumptable_ents;
77 extern void init_flow (struct function *);
78 extern void clear_edges (void);
79 extern basic_block alloc_block (void);
80 extern void link_block (basic_block, basic_block);
81 extern void unlink_block (basic_block);
82 extern void compact_blocks (void);
83 extern void expunge_block (basic_block);
84 extern edge unchecked_make_edge (basic_block, basic_block, int);
85 extern edge cached_make_edge (sbitmap, basic_block, basic_block, int);
86 extern edge make_edge (basic_block, basic_block, int);
87 extern edge make_single_succ_edge (basic_block, basic_block, int);
88 extern void remove_edge_raw (edge);
89 extern void redirect_edge_succ (edge, basic_block);
90 extern void redirect_edge_pred (edge, basic_block);
91 extern void clear_bb_flags (void);
92 extern void dump_edge_info (FILE *, edge, int, int);
93 extern void debug (edge_def &ref);
94 extern void debug (edge_def *ptr);
95 extern void alloc_aux_for_blocks (int);
96 extern void clear_aux_for_blocks (void);
97 extern void free_aux_for_blocks (void);
98 extern void alloc_aux_for_edge (edge, int);
99 extern void alloc_aux_for_edges (int);
100 extern void clear_aux_for_edges (void);
101 extern void free_aux_for_edges (void);
102 extern void debug_bb (basic_block);
103 extern basic_block debug_bb_n (int);
104 extern void dump_bb_info (FILE *, basic_block, int, int, bool, bool);
105 extern void brief_dump_cfg (FILE *, int);
106 extern void update_bb_profile_for_threading (basic_block, int, gcov_type, edge);
107 extern void scale_bbs_frequencies_int (basic_block *, int, int, int);
108 extern void scale_bbs_frequencies_gcov_type (basic_block *, int, gcov_type,
109 gcov_type);
110 extern void initialize_original_copy_tables (void);
111 extern void free_original_copy_tables (void);
112 extern void set_bb_original (basic_block, basic_block);
113 extern basic_block get_bb_original (basic_block);
114 extern void set_bb_copy (basic_block, basic_block);
115 extern basic_block get_bb_copy (basic_block);
116 void set_loop_copy (struct loop *, struct loop *);
117 struct loop *get_loop_copy (struct loop *);
119 #endif /* GCC_CFG_H */