1 /* Header file for SSA jump threading.
2 Copyright (C) 2013-2021 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
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
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_TREE_SSA_THREADEDGE_H
21 #define GCC_TREE_SSA_THREADEDGE_H
23 // This is the high level threader. The entry point is
24 // thread_outgoing_edges(), which calculates and registers paths to be
25 // threaded. When all candidates have been registered,
26 // thread_through_all_blocks() is called to actually change the CFG.
31 jump_threader (class const_and_copies
*,
33 class jump_threader_simplifier
*,
34 class evrp_range_analyzer
* = NULL
);
36 void thread_outgoing_edges (basic_block
);
37 void remove_jump_threads_including (edge_def
*);
38 bool thread_through_all_blocks (bool may_peel_loop_headers
);
41 tree
simplify_control_stmt_condition (edge
, gimple
*);
42 tree
simplify_control_stmt_condition_1 (edge
,
49 bool thread_around_empty_blocks (vec
<class jump_thread_edge
*> *path
,
50 edge
, bitmap visited
);
51 int thread_through_normal_block (vec
<jump_thread_edge
*> *path
,
52 edge
, bitmap visited
);
53 void thread_across_edge (edge
);
54 bool record_temporary_equivalences_from_phis (edge
);
55 gimple
*record_temporary_equivalences_from_stmts_at_dest (edge
);
57 // Dummy condition to avoid creating lots of throw away statements.
60 const_and_copies
*m_const_and_copies
;
61 avail_exprs_stack
*m_avail_exprs_stack
;
62 class jump_thread_path_registry
*m_registry
;
63 jump_threader_simplifier
*m_simplifier
;
64 evrp_range_analyzer
*m_evrp_range_analyzer
;
67 // Statement simplifier callback for the jump threader.
69 class jump_threader_simplifier
72 jump_threader_simplifier (class vr_values
*v
,
73 avail_exprs_stack
*avails
)
75 m_avail_exprs_stack (avails
)
77 virtual ~jump_threader_simplifier () { }
78 virtual tree
simplify (gimple
*, gimple
*, basic_block
);
81 vr_values
*m_vr_values
;
82 avail_exprs_stack
*m_avail_exprs_stack
;
85 extern void propagate_threaded_block_debug_into (basic_block
, basic_block
);
87 // ?? All this ssa_name_values stuff is the store of values for
88 // avail_exprs_stack and const_and_copies, so it really belongs in the
89 // jump_threader class. However, it's probably not worth touching
90 // this, since all this windable state is slated to go with the
92 extern vec
<tree
> ssa_name_values
;
93 #define SSA_NAME_VALUE(x) \
94 (SSA_NAME_VERSION (x) < ssa_name_values.length () \
95 ? ssa_name_values[SSA_NAME_VERSION (x)] \
97 extern void set_ssa_name_value (tree
, tree
);
99 #endif /* GCC_TREE_SSA_THREADEDGE_H */