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