1 |
684 |
jeremybenn |
/* 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>
|
6 |
|
|
|
7 |
|
|
This file is part of GCC.
|
8 |
|
|
|
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.
|
13 |
|
|
|
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.
|
18 |
|
|
|
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/>. */
|
22 |
|
|
|
23 |
|
|
#ifndef _TREE_SSA_PROPAGATE_H
|
24 |
|
|
#define _TREE_SSA_PROPAGATE_H 1
|
25 |
|
|
|
26 |
|
|
/* If SIM_P is true, statement S will be simulated again. */
|
27 |
|
|
|
28 |
|
|
static inline void
|
29 |
|
|
prop_set_simulate_again (gimple s, bool visit_p)
|
30 |
|
|
{
|
31 |
|
|
gimple_set_visited (s, visit_p);
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
/* Return true if statement T should be simulated again. */
|
35 |
|
|
|
36 |
|
|
static inline bool
|
37 |
|
|
prop_simulate_again_p (gimple s)
|
38 |
|
|
{
|
39 |
|
|
return gimple_visited_p (s);
|
40 |
|
|
}
|
41 |
|
|
|
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,
|
49 |
|
|
|
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,
|
56 |
|
|
|
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
|
62 |
|
|
};
|
63 |
|
|
|
64 |
|
|
|
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);
|
70 |
|
|
|
71 |
|
|
|
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);
|
80 |
|
|
|
81 |
|
|
#endif /* _TREE_SSA_PROPAGATE_H */
|