1 /* Data structures and function declarations for the SSA value propagation
3 Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
4 Contributed by Diego Novillo <dnovillo@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #ifndef _TREE_SSA_PROPAGATE_H
23 #define _TREE_SSA_PROPAGATE_H 1
25 /* Use the TREE_VISITED bitflag to mark statements and PHI nodes that
26 have been deemed varying and should not be simulated again. */
27 #define DONT_SIMULATE_AGAIN(T) TREE_VISITED (T)
29 /* Lattice values used for propagation purposes. Specific instances
30 of a propagation engine must return these values from the statement
31 and PHI visit functions to direct the engine. */
32 enum ssa_prop_result
{
33 /* The statement produces nothing of interest. No edges will be
34 added to the work lists. */
35 SSA_PROP_NOT_INTERESTING
,
37 /* The statement produces an interesting value. The set SSA_NAMEs
38 returned by SSA_PROP_VISIT_STMT should be added to
39 INTERESTING_SSA_EDGES. If the statement being visited is a
40 conditional jump, SSA_PROP_VISIT_STMT should indicate which edge
41 out of the basic block should be marked executable. */
44 /* The statement produces a varying (i.e., useless) value and
45 should not be simulated again. If the statement being visited
46 is a conditional jump, all the edges coming out of the block
47 will be considered executable. */
53 /* Lattice value. Each propagator is free to define its own
54 lattice and this field is only meaningful while propagating.
55 It will not be used by substitute_and_fold. */
58 /* Propagated value. */
61 /* If this value is held in an SSA name for a non-register
62 variable, this field holds the actual memory reference
63 associated with this value. This field is taken from
64 the LHS of the assignment that generated the associated SSA
65 name. However, in the case of PHI nodes, this field is copied
66 from the PHI arguments (assuming that all the arguments have
67 the same memory reference). See replace_vuses_in for a more
68 detailed description. */
72 typedef struct prop_value_d prop_value_t
;
75 /* Type of value ranges. See value_range_d for a description of these
77 enum value_range_type
{ VR_UNDEFINED
, VR_RANGE
, VR_ANTI_RANGE
, VR_VARYING
};
79 /* Range of values that can be associated with an SSA_NAME after VRP
83 /* Lattice value represented by this range. */
84 enum value_range_type type
;
86 /* Minimum and maximum values represented by this range. These
87 values should be interpreted as follows:
89 - If TYPE is VR_UNDEFINED or VR_VARYING then MIN and MAX must
92 - If TYPE == VR_RANGE then MIN holds the minimum value and
93 MAX holds the maximum value of the range [MIN, MAX].
95 - If TYPE == ANTI_RANGE the variable is known to NOT
96 take any values in the range [MIN, MAX]. */
100 /* Set of SSA names whose value ranges are equivalent to this one.
101 This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */
105 typedef struct value_range_d value_range_t
;
108 /* Call-back functions used by the value propagation engine. */
109 typedef enum ssa_prop_result (*ssa_prop_visit_stmt_fn
) (tree
, edge
*, tree
*);
110 typedef enum ssa_prop_result (*ssa_prop_visit_phi_fn
) (tree
);
113 /* In tree-ssa-propagate.c */
114 void ssa_propagate (ssa_prop_visit_stmt_fn
, ssa_prop_visit_phi_fn
);
116 bool valid_gimple_expression_p (tree expr
);
117 bool set_rhs (tree
*, tree
);
118 tree
first_vdef (tree
);
119 bool stmt_makes_single_load (tree
);
120 bool stmt_makes_single_store (tree
);
121 prop_value_t
*get_value_loaded_by (tree
, prop_value_t
*);
122 bool replace_uses_in (tree
, bool *, prop_value_t
*);
123 bool substitute_and_fold (prop_value_t
*, bool);
125 #endif /* _TREE_SSA_PROPAGATE_H */