GCC Middle and Back End API Reference
tree-ssa-threadedge.h
Go to the documentation of this file.
1/* Header file for SSA jump threading.
2 Copyright (C) 2013-2024 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_TREE_SSA_THREADEDGE_H
21#define GCC_TREE_SSA_THREADEDGE_H
22
23// Class used to maintain path state in the jump threader and pass it
24// to the jump threader simplifier.
25
27{
28public:
29 virtual ~jt_state () { }
30 virtual void push (edge);
31 virtual void pop ();
32 virtual void register_equiv (tree dest, tree src, bool update_range);
33 virtual void register_equivs_edge (edge e);
35 class jt_simplifier *);
36 virtual void record_ranges_from_stmt (gimple *stmt, bool temporary);
39 void dump (FILE *);
40 void debug ();
41
42private:
44 static const basic_block BB_MARKER;
45};
46
47// Statement simplifier callback for the jump threader.
48
50{
51public:
52 virtual ~jt_simplifier () { }
54};
55
57{
58private:
60 {
61 // Ranger has no need to simplify anything.
62 }
63};
64
66{
67public:
69 tree simplify (gimple *stmt, gimple *, basic_block, jt_state *) override;
70
71private:
73 const vec<basic_block> &path,
74 gimple *stmt);
75
78};
79
80// This is the high level threader. The entry point is
81// thread_outgoing_edges(), which calculates and registers paths to be
82// threaded. When all candidates have been registered,
83// thread_through_all_blocks() is called to actually change the CFG.
84
118
121
122// ?? All this ssa_name_values stuff is the store of values for
123// avail_exprs_stack and const_and_copies, so it really belongs in the
124// jump_threader class. However, it's probably not worth touching
125// this, since all this windable state is slated to go with the
126// ranger.
128#define SSA_NAME_VALUE(x) \
129 (SSA_NAME_VERSION (x) < ssa_name_values.length () \
130 ? ssa_name_values[SSA_NAME_VERSION (x)] \
131 : NULL_TREE)
132extern void set_ssa_name_value (tree, tree);
133
134#endif /* GCC_TREE_SSA_THREADEDGE_H */
Definition vec.h:1656
Definition basic-block.h:26
Definition tree-ssa-threadupdate.h:89
Definition gimple-range.h:48
Definition tree-ssa-threadedge.h:66
path_range_query * m_query
Definition tree-ssa-threadedge.h:77
void compute_exit_dependencies(bitmap dependencies, const vec< basic_block > &path, gimple *stmt)
Definition tree-ssa-threadedge.cc:1445
tree simplify(gimple *stmt, gimple *, basic_block, jt_state *) override
Definition tree-ssa-threadedge.cc:1408
gimple_ranger * m_ranger
Definition tree-ssa-threadedge.h:76
hybrid_jt_simplifier(class gimple_ranger *r, class path_range_query *q)
Definition tree-ssa-threadedge.cc:1400
Definition tree-ssa-threadedge.h:57
void register_equivs_stmt(gimple *, basic_block, jt_simplifier *) override
Definition tree-ssa-threadedge.h:59
Definition tree-ssa-threadedge.h:50
virtual ~jt_simplifier()
Definition tree-ssa-threadedge.h:52
virtual tree simplify(gimple *, gimple *, basic_block, jt_state *)=0
Definition tree-ssa-threadedge.h:27
void debug()
Definition tree-ssa-threadedge.cc:1275
void dump(FILE *)
Definition tree-ssa-threadedge.cc:1264
virtual void pop()
Definition tree-ssa-threadedge.cc:1243
auto_vec< basic_block > m_blocks
Definition tree-ssa-threadedge.h:43
virtual void record_ranges_from_stmt(gimple *stmt, bool temporary)
Definition tree-ssa-threadedge.cc:1313
void append_path(basic_block)
Definition tree-ssa-threadedge.cc:1257
void get_path(vec< basic_block > &)
Definition tree-ssa-threadedge.cc:1285
static const basic_block BB_MARKER
Definition tree-ssa-threadedge.h:44
virtual void register_equivs_stmt(gimple *, basic_block, class jt_simplifier *)
Definition tree-ssa-threadedge.cc:1326
virtual void push(edge)
Definition tree-ssa-threadedge.cc:1232
virtual void register_equivs_edge(edge e)
Definition tree-ssa-threadedge.cc:1321
virtual void register_equiv(tree dest, tree src, bool update_range)
Definition tree-ssa-threadedge.cc:1302
virtual ~jt_state()
Definition tree-ssa-threadedge.h:29
Definition tree-ssa-threadedge.h:86
jt_state * m_state
Definition tree-ssa-threadedge.h:116
gcond * dummy_cond
Definition tree-ssa-threadedge.h:112
class fwd_jt_path_registry * m_registry
Definition tree-ssa-threadedge.h:114
tree simplify_control_stmt_condition_1(edge, gimple *, tree op0, tree_code cond_code, tree op1, unsigned limit)
Definition tree-ssa-threadedge.cc:479
jump_threader(jt_simplifier *, class jt_state *)
Definition tree-ssa-threadedge.cc:64
bool thread_through_all_blocks(bool may_peel_loop_headers)
Definition tree-ssa-threadedge.cc:92
int thread_through_normal_block(vec< jump_thread_edge * > *path, edge, bitmap visited)
Definition tree-ssa-threadedge.cc:901
bool thread_around_empty_blocks(vec< class jump_thread_edge * > *path, edge, bitmap visited)
Definition tree-ssa-threadedge.cc:787
jt_simplifier * m_simplifier
Definition tree-ssa-threadedge.h:115
void thread_outgoing_edges(basic_block)
Definition tree-ssa-threadedge.cc:1193
~jump_threader()
Definition tree-ssa-threadedge.cc:78
gimple * record_temporary_equivalences_from_stmts_at_dest(edge)
Definition tree-ssa-threadedge.cc:216
void thread_across_edge(edge)
Definition tree-ssa-threadedge.cc:1066
bool record_temporary_equivalences_from_phis(edge)
Definition tree-ssa-threadedge.cc:152
void remove_jump_threads_including(edge_def *)
Definition tree-ssa-threadedge.cc:86
tree simplify_control_stmt_condition(edge, gimple *)
Definition tree-ssa-threadedge.cc:341
Definition gimple-range-path.h:33
class edge_def * edge
Definition coretypes.h:342
class bitmap_head * bitmap
Definition coretypes.h:51
union tree_node * tree
Definition coretypes.h:97
tree_code
Definition genmatch.cc:347
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
poly_int< N, C > r
Definition poly-int.h:770
Definition basic-block.h:117
Definition gimple.h:857
Definition gimple.h:225
Definition vec.h:450
static bitmap visited
Definition tree-ssa-dce.cc:483
void set_ssa_name_value(tree, tree)
Definition tree-ssa-threadedge.cc:55
vec< tree > ssa_name_values
Definition tree-ssa-threadedge.cc:50
void propagate_threaded_block_debug_into(basic_block, basic_block)
Definition tree-ssa-threadedge.cc:646
bool single_succ_to_potentially_threadable_block(basic_block)
Definition tree-ssa-threadedge.cc:1181