]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gimple-ssa.h
frv.c (frv_init_cumulative_args): Fix wrong cast.
[thirdparty/gcc.git] / gcc / gimple-ssa.h
CommitLineData
80560f95
AM
1/* Header file for routines that straddle the border between GIMPLE and
2 SSA in gimple.
3 Copyright (C) 2009-2013 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_GIMPLE_SSA_H
22#define GCC_GIMPLE_SSA_H
23
cc524fc7
AM
24/* This structure is used to map a gimple statement to a label,
25 or list of labels to represent transaction restart. */
26
27struct GTY(()) tm_restart_node {
28 gimple stmt;
29 tree label_or_list;
30};
31
32/* Gimple dataflow datastructure. All publicly available fields shall have
33 gimple_ accessor defined, all publicly modifiable fields should have
34 gimple_set accessor. */
35struct GTY(()) gimple_df {
36 /* A vector of all the noreturn calls passed to modify_stmt.
37 cleanup_control_flow uses it to detect cases where a mid-block
38 indirect call has been turned into a noreturn call. When this
39 happens, all the instructions after the call are no longer
40 reachable and must be deleted as dead. */
41 vec<gimple, va_gc> *modified_noreturn_calls;
42
43 /* Array of all SSA_NAMEs used in the function. */
44 vec<tree, va_gc> *ssa_names;
45
46 /* Artificial variable used for the virtual operand FUD chain. */
47 tree vop;
48
49 /* The PTA solution for the ESCAPED artificial variable. */
50 struct pt_solution escaped;
51
52 /* A map of decls to artificial ssa-names that point to the partition
53 of the decl. */
54 struct pointer_map_t * GTY((skip(""))) decls_to_pointers;
55
56 /* Free list of SSA_NAMEs. */
57 vec<tree, va_gc> *free_ssanames;
58
59 /* Hashtable holding definition for symbol. If this field is not NULL, it
60 means that the first reference to this variable in the function is a
61 USE or a VUSE. In those cases, the SSA renamer creates an SSA name
62 for this variable with an empty defining statement. */
63 htab_t GTY((param_is (union tree_node))) default_defs;
64
65 /* True if there are any symbols that need to be renamed. */
66 unsigned int ssa_renaming_needed : 1;
67
68 /* True if all virtual operands need to be renamed. */
69 unsigned int rename_vops : 1;
70
71 /* True if the code is in ssa form. */
72 unsigned int in_ssa_p : 1;
73
74 /* True if IPA points-to information was computed for this function. */
75 unsigned int ipa_pta : 1;
76
77 struct ssa_operands ssa_operands;
78
79 /* Map gimple stmt to tree label (or list of labels) for transaction
80 restart and abort. */
81 htab_t GTY ((param_is (struct tm_restart_node))) tm_restart;
82};
83
84
85/* Return true when gimple SSA form was built.
86 gimple_in_ssa_p is queried by gimplifier in various early stages before SSA
87 infrastructure is initialized. Check for presence of the datastructures
88 at first place. */
89static inline bool
90gimple_in_ssa_p (const struct function *fun)
91{
92 return fun && fun->gimple_df && fun->gimple_df->in_ssa_p;
93}
94
95/* Inline functions for manipulating various data structures defined in
96 tree-flow.h. See tree-flow.h for documentation. */
97
98/* Artificial variable used for the virtual operand FUD chain. */
99static inline tree
100gimple_vop (const struct function *fun)
101{
102 gcc_checking_assert (fun && fun->gimple_df);
103 return fun->gimple_df->vop;
104}
105
80560f95
AM
106/* Return the set of VUSE operand for statement G. */
107
108static inline use_operand_p
109gimple_vuse_op (const_gimple g)
110{
111 struct use_optype_d *ops;
112 if (!gimple_has_mem_ops (g))
113 return NULL_USE_OPERAND_P;
114 ops = g->gsops.opbase.use_ops;
115 if (ops
116 && USE_OP_PTR (ops)->use == &g->gsmembase.vuse)
117 return USE_OP_PTR (ops);
118 return NULL_USE_OPERAND_P;
119}
120
121/* Return the set of VDEF operand for statement G. */
122
123static inline def_operand_p
124gimple_vdef_op (gimple g)
125{
126 if (!gimple_has_mem_ops (g))
127 return NULL_DEF_OPERAND_P;
128 if (g->gsmembase.vdef)
129 return &g->gsmembase.vdef;
130 return NULL_DEF_OPERAND_P;
131}
132
133/* Mark statement S as modified, and update it. */
134
135static inline void
136update_stmt (gimple s)
137{
138 if (gimple_has_ops (s))
139 {
140 gimple_set_modified (s, true);
141 update_stmt_operands (s);
142 }
143}
144
145/* Update statement S if it has been optimized. */
146
147static inline void
148update_stmt_if_modified (gimple s)
149{
150 if (gimple_modified_p (s))
151 update_stmt_operands (s);
152}
153
154
155#endif /* GCC_GIMPLE_SSA_H */