aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-threadedge.h
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
committerIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
commite252b51ccde010cbd2a146485d8045103cd99533 (patch)
treee060f101cdc32bf5e520de8e5275db9d4236b74c /gcc/tree-ssa-threadedge.h
parentf10c7c4596dda99d2ee872c995ae4aeda65adbdf (diff)
parent104c05c5284b7822d770ee51a7d91946c7e56d50 (diff)
downloadgcc-e252b51ccde010cbd2a146485d8045103cd99533.zip
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.gz
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.bz2
Merge from trunk revision 104c05c5284b7822d770ee51a7d91946c7e56d50.
Diffstat (limited to 'gcc/tree-ssa-threadedge.h')
-rw-r--r--gcc/tree-ssa-threadedge.h92
1 files changed, 81 insertions, 11 deletions
diff --git a/gcc/tree-ssa-threadedge.h b/gcc/tree-ssa-threadedge.h
index e19dc4b..18e6bd4 100644
--- a/gcc/tree-ssa-threadedge.h
+++ b/gcc/tree-ssa-threadedge.h
@@ -20,22 +20,92 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_TREE_SSA_THREADEDGE_H
#define GCC_TREE_SSA_THREADEDGE_H
+// Class used to maintain path state in the jump threader and pass it
+// to the jump threader simplifier.
+
+class jt_state
+{
+public:
+ jt_state (class const_and_copies *,
+ class avail_exprs_stack *,
+ class evrp_range_analyzer *);
+ void push (edge);
+ void pop ();
+ void register_equiv (tree dest, tree src, bool update_range = false);
+ void register_equivs_on_edge (edge e);
+ void record_ranges_from_stmt (gimple *stmt, bool temporary);
+
+private:
+ const_and_copies *m_copies;
+ avail_exprs_stack *m_exprs;
+ evrp_range_analyzer *m_evrp;
+};
+
+// This is the high level threader. The entry point is
+// thread_outgoing_edges(), which calculates and registers paths to be
+// threaded. When all candidates have been registered,
+// thread_through_all_blocks() is called to actually change the CFG.
+
+class jump_threader
+{
+public:
+ jump_threader (class jump_threader_simplifier *, class jt_state *);
+ ~jump_threader ();
+ void thread_outgoing_edges (basic_block);
+ void remove_jump_threads_including (edge_def *);
+ bool thread_through_all_blocks (bool may_peel_loop_headers);
+
+private:
+ tree simplify_control_stmt_condition (edge, gimple *);
+ tree simplify_control_stmt_condition_1 (edge,
+ gimple *,
+ tree op0,
+ tree_code cond_code,
+ tree op1,
+ unsigned limit);
+
+ bool thread_around_empty_blocks (vec<class jump_thread_edge *> *path,
+ edge, bitmap visited);
+ int thread_through_normal_block (vec<jump_thread_edge *> *path,
+ edge, bitmap visited);
+ void thread_across_edge (edge);
+ bool record_temporary_equivalences_from_phis (edge);
+ gimple *record_temporary_equivalences_from_stmts_at_dest (edge);
+
+ // Dummy condition to avoid creating lots of throw away statements.
+ gcond *dummy_cond;
+
+ class fwd_jt_path_registry *m_registry;
+ jump_threader_simplifier *m_simplifier;
+ jt_state *m_state;
+};
+
+// Statement simplifier callback for the jump threader.
+
+class jump_threader_simplifier
+{
+public:
+ jump_threader_simplifier (class vr_values *v);
+ virtual ~jump_threader_simplifier () { }
+ virtual tree simplify (gimple *, gimple *, basic_block, jt_state *);
+
+protected:
+ vr_values *m_vr_values;
+};
+
+extern void propagate_threaded_block_debug_into (basic_block, basic_block);
+extern bool single_succ_to_potentially_threadable_block (basic_block);
+
+// ?? All this ssa_name_values stuff is the store of values for
+// avail_exprs_stack and const_and_copies, so it really belongs in the
+// jump_threader class. However, it's probably not worth touching
+// this, since all this windable state is slated to go with the
+// ranger.
extern vec<tree> ssa_name_values;
#define SSA_NAME_VALUE(x) \
(SSA_NAME_VERSION (x) < ssa_name_values.length () \
? ssa_name_values[SSA_NAME_VERSION (x)] \
: NULL_TREE)
extern void set_ssa_name_value (tree, tree);
-extern void threadedge_initialize_values (void);
-extern void threadedge_finalize_values (void);
-extern bool potentially_threadable_block (basic_block);
-extern void propagate_threaded_block_debug_into (basic_block, basic_block);
-class evrp_range_analyzer;
-extern void thread_outgoing_edges (basic_block, gcond *,
- const_and_copies *,
- avail_exprs_stack *,
- evrp_range_analyzer *,
- tree (*) (gimple *, gimple *,
- avail_exprs_stack *, basic_block));
#endif /* GCC_TREE_SSA_THREADEDGE_H */