1/* Data and Control Flow Analysis for Trees.
2 Copyright (C) 2001-2023 Free Software Foundation, Inc.
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
9the Free Software Foundation; either version 3, or (at your option)
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
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef _TREE_CFG_H
22#define _TREE_CFG_H
23
24/* Location to track pending stmt for edge insertion. */
25#define PENDING_STMT(e) ((e)->insns.g)
26
27/* Garbage collection and PCH support for edge_def. */
28extern void gt_ggc_mx (edge_def *e);
29extern void gt_pch_nx (edge_def *e);
30extern void gt_pch_nx (edge_def *e, gt_pointer_operator, void *);
31
32extern void init_empty_tree_cfg_for_function (struct function *);
33extern void init_empty_tree_cfg (void);
34extern void start_recording_case_labels (void);
35extern void end_recording_case_labels (void);
36extern tree get_cases_for_edge (edge, gswitch *);
37extern basic_block label_to_block (struct function *, tree);
38extern void cleanup_dead_labels (void);
39extern bool group_case_labels_stmt (gswitch *);
40extern bool group_case_labels (void);
41extern void replace_uses_by (tree, tree);
42extern basic_block single_noncomplex_succ (basic_block bb);
43extern void notice_special_calls (gcall *);
44extern void clear_special_calls (void);
45extern edge find_taken_edge (basic_block, tree);
46extern void gimple_debug_bb (basic_block);
47extern basic_block gimple_debug_bb_n (int);
48extern void gimple_debug_cfg (int);
49extern void gimple_dump_cfg (FILE *, dump_flags_t);
50extern void dump_cfg_stats (FILE *);
51extern void debug_cfg_stats (void);
52extern bool computed_goto_p (gimple *);
53extern bool stmt_can_make_abnormal_goto (gimple *);
54extern basic_block get_abnormal_succ_dispatcher (basic_block);
55extern bool is_ctrl_stmt (gimple *);
56extern bool is_ctrl_altering_stmt (gimple *);
57extern bool simple_goto_p (gimple *);
58extern bool stmt_ends_bb_p (gimple *);
59extern bool gimple_seq_unreachable_p (gimple_seq);
60extern bool assert_unreachable_fallthru_edge_p (edge);
61extern void delete_tree_cfg_annotations (function *);
62extern gphi *get_virtual_phi (basic_block);
63extern gimple *first_stmt (basic_block);
64extern gimple *last_nondebug_stmt (basic_block);
65extern gimple *last_and_only_stmt (basic_block);
66extern bool verify_gimple_in_seq (gimple_seq, bool = true);
67extern bool verify_gimple_in_cfg (struct function *, bool, bool = true);
68extern tree gimple_block_label (basic_block);
69extern void add_phi_args_after_copy_bb (basic_block);
70extern void add_phi_args_after_copy (basic_block *, unsigned, edge);
71extern basic_block split_edge_bb_loc (edge);
72extern bool gimple_duplicate_seme_region (edge, edge, basic_block *, unsigned,
73 basic_block *, bool);
74extern bool gimple_duplicate_sese_tail (edge, edge, basic_block *, unsigned,
75 basic_block *);
76extern void gather_blocks_in_sese_region (basic_block entry, basic_block exit,
77 vec<basic_block> *bbs_p);
78extern void verify_sese (basic_block, basic_block, vec<basic_block> *);
79extern bool gather_ssa_name_hash_map_from (tree const &, tree const &, void *);
80extern void fold_loop_internal_call (gimple *, tree);
81extern basic_block move_sese_region_to_fn (struct function *, basic_block,
82 basic_block, tree);
83extern void dump_function_to_file (tree, FILE *, dump_flags_t);
84extern void debug_function (tree, dump_flags_t);
85extern void print_loops_bb (FILE *, basic_block, int, int);
86extern void print_loops (FILE *, int);
87extern void debug (class loop &ref);
88extern void debug (class loop *ptr);
89extern void debug_verbose (class loop &ref);
90extern void debug_verbose (class loop *ptr);
91extern void debug_loops (int);
92extern void debug_loop (class loop *, int);
93extern void debug_loop_num (unsigned, int);
94extern void remove_edge_and_dominated_blocks (edge);
95extern bool gimple_purge_dead_eh_edges (basic_block);
96extern bool gimple_purge_all_dead_eh_edges (const_bitmap);
97extern bool gimple_purge_dead_abnormal_call_edges (basic_block);
98extern bool gimple_purge_all_dead_abnormal_call_edges (const_bitmap);
99extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
100extern tree find_case_label_for_value (const gswitch *switch_stmt, tree val);
101extern edge find_taken_edge_switch_expr (const gswitch *switch_stmt, tree val);
102extern unsigned int execute_fixup_cfg (void);
103extern unsigned int split_critical_edges (bool for_edge_insertion_p = false);
104extern basic_block insert_cond_bb (basic_block, gimple *, gimple *,
105 profile_probability);
106extern bool gimple_find_sub_bbs (gimple_seq, gimple_stmt_iterator *);
107extern bool extract_true_false_controlled_edges (basic_block, basic_block,
108 edge *, edge *);
109extern void generate_range_test (basic_block bb, tree index, tree low,
110 tree high, tree *lhs, tree *rhs);
111extern basic_block gimple_switch_label_bb (function *, gswitch *, unsigned);
112extern basic_block gimple_switch_default_bb (function *, gswitch *);
113extern edge gimple_switch_edge (function *, gswitch *, unsigned);
114extern edge gimple_switch_default_edge (function *, gswitch *);
115extern bool cond_only_block_p (basic_block);
116extern void copy_phi_arg_into_existing_phi (edge, edge);
117
118/* Return true if the LHS of a call should be removed. */
119
120inline bool
121should_remove_lhs_p (tree lhs)
122{
123 return (lhs
124 && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs))) == INTEGER_CST
125 && !TREE_ADDRESSABLE (TREE_TYPE (lhs)));
126}
127
128
129inline unsigned int
130split_edges_for_insertion ()
131{
132 return split_critical_edges (/*for_edge_insertion_p=*/for_edge_insertion_p: true);
133}
134
135#endif /* _TREE_CFG_H */
136

source code of gcc/tree-cfg.h