2012-01-31 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / tree-ssa-propagate.h
blob86e22e6ca5c737eb12471a5417b306a299c01313
1 /* Data structures and function declarations for the SSA value propagation
2 engine.
3 Copyright (C) 2004, 2005, 2007, 2008, 2010, 2011
4 Free Software Foundation, Inc.
5 Contributed by Diego Novillo <dnovillo@redhat.com>
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
14 GCC is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
23 #ifndef _TREE_SSA_PROPAGATE_H
24 #define _TREE_SSA_PROPAGATE_H 1
26 /* If SIM_P is true, statement S will be simulated again. */
28 static inline void
29 prop_set_simulate_again (gimple s, bool visit_p)
31 gimple_set_visited (s, visit_p);
34 /* Return true if statement T should be simulated again. */
36 static inline bool
37 prop_simulate_again_p (gimple s)
39 return gimple_visited_p (s);
42 /* Lattice values used for propagation purposes. Specific instances
43 of a propagation engine must return these values from the statement
44 and PHI visit functions to direct the engine. */
45 enum ssa_prop_result {
46 /* The statement produces nothing of interest. No edges will be
47 added to the work lists. */
48 SSA_PROP_NOT_INTERESTING,
50 /* The statement produces an interesting value. The set SSA_NAMEs
51 returned by SSA_PROP_VISIT_STMT should be added to
52 INTERESTING_SSA_EDGES. If the statement being visited is a
53 conditional jump, SSA_PROP_VISIT_STMT should indicate which edge
54 out of the basic block should be marked executable. */
55 SSA_PROP_INTERESTING,
57 /* The statement produces a varying (i.e., useless) value and
58 should not be simulated again. If the statement being visited
59 is a conditional jump, all the edges coming out of the block
60 will be considered executable. */
61 SSA_PROP_VARYING
65 /* Call-back functions used by the value propagation engine. */
66 typedef enum ssa_prop_result (*ssa_prop_visit_stmt_fn) (gimple, edge *, tree *);
67 typedef enum ssa_prop_result (*ssa_prop_visit_phi_fn) (gimple);
68 typedef bool (*ssa_prop_fold_stmt_fn) (gimple_stmt_iterator *gsi);
69 typedef tree (*ssa_prop_get_value_fn) (tree);
72 /* In tree-ssa-propagate.c */
73 void ssa_propagate (ssa_prop_visit_stmt_fn, ssa_prop_visit_phi_fn);
74 bool valid_gimple_rhs_p (tree);
75 void move_ssa_defining_stmt_for_defs (gimple, gimple);
76 bool update_gimple_call (gimple_stmt_iterator *, tree, int, ...);
77 bool update_call_from_tree (gimple_stmt_iterator *, tree);
78 bool stmt_makes_single_store (gimple);
79 bool substitute_and_fold (ssa_prop_get_value_fn, ssa_prop_fold_stmt_fn, bool);
81 #endif /* _TREE_SSA_PROPAGATE_H */