xref: /dflybsd-src/contrib/gcc-4.7/gcc/tree-flow.h (revision 0a8dc9fc45f4d0b236341a473fac4a486375f60c)
1e4b17023SJohn Marino /* Data and Control Flow Analysis for Trees.
2e4b17023SJohn Marino    Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
3e4b17023SJohn Marino    Free Software Foundation, Inc.
4e4b17023SJohn Marino    Contributed by Diego Novillo <dnovillo@redhat.com>
5e4b17023SJohn Marino 
6e4b17023SJohn Marino This file is part of GCC.
7e4b17023SJohn Marino 
8e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify
9e4b17023SJohn Marino it under the terms of the GNU General Public License as published by
10e4b17023SJohn Marino the Free Software Foundation; either version 3, or (at your option)
11e4b17023SJohn Marino any later version.
12e4b17023SJohn Marino 
13e4b17023SJohn Marino GCC is distributed in the hope that it will be useful,
14e4b17023SJohn Marino but WITHOUT ANY WARRANTY; without even the implied warranty of
15e4b17023SJohn Marino MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16e4b17023SJohn Marino GNU General Public License for more details.
17e4b17023SJohn Marino 
18e4b17023SJohn Marino You should have received a copy of the GNU General Public License
19e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
20e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
21e4b17023SJohn Marino 
22e4b17023SJohn Marino #ifndef _TREE_FLOW_H
23e4b17023SJohn Marino #define _TREE_FLOW_H 1
24e4b17023SJohn Marino 
25e4b17023SJohn Marino #include "bitmap.h"
26e4b17023SJohn Marino #include "sbitmap.h"
27e4b17023SJohn Marino #include "basic-block.h"
28e4b17023SJohn Marino #include "hashtab.h"
29e4b17023SJohn Marino #include "gimple.h"
30e4b17023SJohn Marino #include "tree-ssa-operands.h"
31e4b17023SJohn Marino #include "cgraph.h"
32e4b17023SJohn Marino #include "ipa-reference.h"
33e4b17023SJohn Marino #include "tree-ssa-alias.h"
34e4b17023SJohn Marino 
35e4b17023SJohn Marino 
36e4b17023SJohn Marino /* This structure is used to map a gimple statement to a label,
37e4b17023SJohn Marino    or list of labels to represent transaction restart.  */
38e4b17023SJohn Marino 
39e4b17023SJohn Marino struct GTY(()) tm_restart_node {
40e4b17023SJohn Marino   gimple stmt;
41e4b17023SJohn Marino   tree label_or_list;
42e4b17023SJohn Marino };
43e4b17023SJohn Marino 
44e4b17023SJohn Marino /* Gimple dataflow datastructure. All publicly available fields shall have
45e4b17023SJohn Marino    gimple_ accessor defined in tree-flow-inline.h, all publicly modifiable
46e4b17023SJohn Marino    fields should have gimple_set accessor.  */
47e4b17023SJohn Marino struct GTY(()) gimple_df {
48e4b17023SJohn Marino   /* Array of all variables referenced in the function.  */
49e4b17023SJohn Marino   htab_t GTY((param_is (union tree_node))) referenced_vars;
50e4b17023SJohn Marino 
51e4b17023SJohn Marino   /* A vector of all the noreturn calls passed to modify_stmt.
52e4b17023SJohn Marino      cleanup_control_flow uses it to detect cases where a mid-block
53e4b17023SJohn Marino      indirect call has been turned into a noreturn call.  When this
54e4b17023SJohn Marino      happens, all the instructions after the call are no longer
55e4b17023SJohn Marino      reachable and must be deleted as dead.  */
56e4b17023SJohn Marino   VEC(gimple,gc) *modified_noreturn_calls;
57e4b17023SJohn Marino 
58e4b17023SJohn Marino   /* Array of all SSA_NAMEs used in the function.  */
59e4b17023SJohn Marino   VEC(tree,gc) *ssa_names;
60e4b17023SJohn Marino 
61e4b17023SJohn Marino   /* Artificial variable used for the virtual operand FUD chain.  */
62e4b17023SJohn Marino   tree vop;
63e4b17023SJohn Marino 
64e4b17023SJohn Marino   /* The PTA solution for the ESCAPED artificial variable.  */
65e4b17023SJohn Marino   struct pt_solution escaped;
66e4b17023SJohn Marino 
67e4b17023SJohn Marino   /* A map of decls to artificial ssa-names that point to the partition
68e4b17023SJohn Marino      of the decl.  */
69e4b17023SJohn Marino   struct pointer_map_t * GTY((skip(""))) decls_to_pointers;
70e4b17023SJohn Marino 
71e4b17023SJohn Marino   /* Free list of SSA_NAMEs.  */
72e4b17023SJohn Marino   VEC(tree,gc) *free_ssanames;
73e4b17023SJohn Marino 
74e4b17023SJohn Marino   /* Hashtable holding definition for symbol.  If this field is not NULL, it
75e4b17023SJohn Marino      means that the first reference to this variable in the function is a
76e4b17023SJohn Marino      USE or a VUSE.  In those cases, the SSA renamer creates an SSA name
77e4b17023SJohn Marino      for this variable with an empty defining statement.  */
78e4b17023SJohn Marino   htab_t GTY((param_is (union tree_node))) default_defs;
79e4b17023SJohn Marino 
80e4b17023SJohn Marino   /* Symbols whose SSA form needs to be updated or created for the first
81e4b17023SJohn Marino      time.  */
82e4b17023SJohn Marino   bitmap syms_to_rename;
83e4b17023SJohn Marino 
84e4b17023SJohn Marino   /* True if the code is in ssa form.  */
85e4b17023SJohn Marino   unsigned int in_ssa_p : 1;
86e4b17023SJohn Marino 
87e4b17023SJohn Marino   /* True if IPA points-to information was computed for this function.  */
88e4b17023SJohn Marino   unsigned int ipa_pta : 1;
89e4b17023SJohn Marino 
90e4b17023SJohn Marino   struct ssa_operands ssa_operands;
91e4b17023SJohn Marino 
92e4b17023SJohn Marino   /* Map gimple stmt to tree label (or list of labels) for transaction
93e4b17023SJohn Marino      restart and abort.  */
94e4b17023SJohn Marino   htab_t GTY ((param_is (struct tm_restart_node))) tm_restart;
95e4b17023SJohn Marino };
96e4b17023SJohn Marino 
97e4b17023SJohn Marino /* Accessors for internal use only.  Generic code should use abstraction
98e4b17023SJohn Marino    provided by tree-flow-inline.h or specific modules.  */
99e4b17023SJohn Marino #define FREE_SSANAMES(fun) (fun)->gimple_df->free_ssanames
100e4b17023SJohn Marino #define SSANAMES(fun) (fun)->gimple_df->ssa_names
101e4b17023SJohn Marino #define MODIFIED_NORETURN_CALLS(fun) (fun)->gimple_df->modified_noreturn_calls
102e4b17023SJohn Marino #define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
103e4b17023SJohn Marino #define SYMS_TO_RENAME(fun) (fun)->gimple_df->syms_to_rename
104e4b17023SJohn Marino 
105e4b17023SJohn Marino typedef struct
106e4b17023SJohn Marino {
107e4b17023SJohn Marino   htab_t htab;
108e4b17023SJohn Marino   PTR *slot;
109e4b17023SJohn Marino   PTR *limit;
110e4b17023SJohn Marino } htab_iterator;
111e4b17023SJohn Marino 
112e4b17023SJohn Marino /* Iterate through the elements of hashtable HTAB, using htab_iterator ITER,
113e4b17023SJohn Marino    storing each element in RESULT, which is of type TYPE.  */
114e4b17023SJohn Marino #define FOR_EACH_HTAB_ELEMENT(HTAB, RESULT, TYPE, ITER) \
115e4b17023SJohn Marino   for (RESULT = (TYPE) first_htab_element (&(ITER), (HTAB)); \
116e4b17023SJohn Marino 	!end_htab_p (&(ITER)); \
117e4b17023SJohn Marino 	RESULT = (TYPE) next_htab_element (&(ITER)))
118e4b17023SJohn Marino 
119e4b17023SJohn Marino /*---------------------------------------------------------------------------
120e4b17023SJohn Marino 		      Attributes for SSA_NAMEs.
121e4b17023SJohn Marino 
122e4b17023SJohn Marino   NOTE: These structures are stored in struct tree_ssa_name
123e4b17023SJohn Marino   but are only used by the tree optimizers, so it makes better sense
124e4b17023SJohn Marino   to declare them here to avoid recompiling unrelated files when
125e4b17023SJohn Marino   making changes.
126e4b17023SJohn Marino ---------------------------------------------------------------------------*/
127e4b17023SJohn Marino 
128e4b17023SJohn Marino /* Aliasing information for SSA_NAMEs representing pointer variables.  */
129e4b17023SJohn Marino 
130e4b17023SJohn Marino struct GTY(()) ptr_info_def
131e4b17023SJohn Marino {
132e4b17023SJohn Marino   /* The points-to solution.  */
133e4b17023SJohn Marino   struct pt_solution pt;
134e4b17023SJohn Marino 
135e4b17023SJohn Marino   /* Alignment and misalignment of the pointer in bytes.  Together
136e4b17023SJohn Marino      align and misalign specify low known bits of the pointer.
137e4b17023SJohn Marino      ptr & (align - 1) == misalign.  */
138e4b17023SJohn Marino 
139e4b17023SJohn Marino   /* The power-of-two byte alignment of the object this pointer
140e4b17023SJohn Marino      points into.  This is usually DECL_ALIGN_UNIT for decls and
141e4b17023SJohn Marino      MALLOC_ABI_ALIGNMENT for allocated storage.  */
142e4b17023SJohn Marino   unsigned int align;
143e4b17023SJohn Marino 
144e4b17023SJohn Marino   /* The byte offset this pointer differs from the above alignment.  */
145e4b17023SJohn Marino   unsigned int misalign;
146e4b17023SJohn Marino };
147e4b17023SJohn Marino 
148e4b17023SJohn Marino 
149e4b17023SJohn Marino /* It is advantageous to avoid things like life analysis for variables which
150e4b17023SJohn Marino    do not need PHI nodes.  This enum describes whether or not a particular
151e4b17023SJohn Marino    variable may need a PHI node.  */
152e4b17023SJohn Marino 
153e4b17023SJohn Marino enum need_phi_state {
154e4b17023SJohn Marino   /* This is the default.  If we are still in this state after finding
155e4b17023SJohn Marino      all the definition and use sites, then we will assume the variable
156e4b17023SJohn Marino      needs PHI nodes.  This is probably an overly conservative assumption.  */
157e4b17023SJohn Marino   NEED_PHI_STATE_UNKNOWN,
158e4b17023SJohn Marino 
159e4b17023SJohn Marino   /* This state indicates that we have seen one or more sets of the
160e4b17023SJohn Marino      variable in a single basic block and that the sets dominate all
161e4b17023SJohn Marino      uses seen so far.  If after finding all definition and use sites
162e4b17023SJohn Marino      we are still in this state, then the variable does not need any
163e4b17023SJohn Marino      PHI nodes.  */
164e4b17023SJohn Marino   NEED_PHI_STATE_NO,
165e4b17023SJohn Marino 
166e4b17023SJohn Marino   /* This state indicates that we have either seen multiple definitions of
167e4b17023SJohn Marino      the variable in multiple blocks, or that we encountered a use in a
168e4b17023SJohn Marino      block that was not dominated by the block containing the set(s) of
169e4b17023SJohn Marino      this variable.  This variable is assumed to need PHI nodes.  */
170e4b17023SJohn Marino   NEED_PHI_STATE_MAYBE
171e4b17023SJohn Marino };
172e4b17023SJohn Marino 
173e4b17023SJohn Marino 
174e4b17023SJohn Marino struct GTY(()) var_ann_d {
175e4b17023SJohn Marino   /* Used when building base variable structures in a var_map.  */
176e4b17023SJohn Marino   unsigned base_var_processed : 1;
177e4b17023SJohn Marino 
178e4b17023SJohn Marino   /* Nonzero if this variable was used after SSA optimizations were
179e4b17023SJohn Marino      applied.  We set this when translating out of SSA form.  */
180e4b17023SJohn Marino   unsigned used : 1;
181e4b17023SJohn Marino 
182e4b17023SJohn Marino   /* This field indicates whether or not the variable may need PHI nodes.
183e4b17023SJohn Marino      See the enum's definition for more detailed information about the
184e4b17023SJohn Marino      states.  */
185e4b17023SJohn Marino   ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
186e4b17023SJohn Marino 
187e4b17023SJohn Marino   /* Used by var_map for the base index of ssa base variables.  */
188e4b17023SJohn Marino   unsigned base_index;
189e4b17023SJohn Marino 
190e4b17023SJohn Marino   /* During into-ssa and the dominator optimizer, this field holds the
191e4b17023SJohn Marino      current version of this variable (an SSA_NAME).  */
192e4b17023SJohn Marino   tree current_def;
193e4b17023SJohn Marino };
194e4b17023SJohn Marino 
195e4b17023SJohn Marino 
196e4b17023SJohn Marino /* Immediate use lists are used to directly access all uses for an SSA
197e4b17023SJohn Marino    name and get pointers to the statement for each use.
198e4b17023SJohn Marino 
199e4b17023SJohn Marino    The structure ssa_use_operand_d consists of PREV and NEXT pointers
200e4b17023SJohn Marino    to maintain the list.  A USE pointer, which points to address where
201e4b17023SJohn Marino    the use is located and a LOC pointer which can point to the
202e4b17023SJohn Marino    statement where the use is located, or, in the case of the root
203e4b17023SJohn Marino    node, it points to the SSA name itself.
204e4b17023SJohn Marino 
205e4b17023SJohn Marino    The list is anchored by an occurrence of ssa_operand_d *in* the
206e4b17023SJohn Marino    ssa_name node itself (named 'imm_uses').  This node is uniquely
207e4b17023SJohn Marino    identified by having a NULL USE pointer. and the LOC pointer
208e4b17023SJohn Marino    pointing back to the ssa_name node itself.  This node forms the
209e4b17023SJohn Marino    base for a circular list, and initially this is the only node in
210e4b17023SJohn Marino    the list.
211e4b17023SJohn Marino 
212e4b17023SJohn Marino    Fast iteration allows each use to be examined, but does not allow
213e4b17023SJohn Marino    any modifications to the uses or stmts.
214e4b17023SJohn Marino 
215e4b17023SJohn Marino    Normal iteration allows insertion, deletion, and modification. the
216e4b17023SJohn Marino    iterator manages this by inserting a marker node into the list
217e4b17023SJohn Marino    immediately before the node currently being examined in the list.
218e4b17023SJohn Marino    this marker node is uniquely identified by having null stmt *and* a
219e4b17023SJohn Marino    null use pointer.
220e4b17023SJohn Marino 
221e4b17023SJohn Marino    When iterating to the next use, the iteration routines check to see
222e4b17023SJohn Marino    if the node after the marker has changed. if it has, then the node
223e4b17023SJohn Marino    following the marker is now the next one to be visited. if not, the
224e4b17023SJohn Marino    marker node is moved past that node in the list (visualize it as
225e4b17023SJohn Marino    bumping the marker node through the list).  this continues until
226e4b17023SJohn Marino    the marker node is moved to the original anchor position. the
227e4b17023SJohn Marino    marker node is then removed from the list.
228e4b17023SJohn Marino 
229e4b17023SJohn Marino    If iteration is halted early, the marker node must be removed from
230e4b17023SJohn Marino    the list before continuing.  */
231e4b17023SJohn Marino typedef struct immediate_use_iterator_d
232e4b17023SJohn Marino {
233e4b17023SJohn Marino   /* This is the current use the iterator is processing.  */
234e4b17023SJohn Marino   ssa_use_operand_t *imm_use;
235e4b17023SJohn Marino   /* This marks the last use in the list (use node from SSA_NAME)  */
236e4b17023SJohn Marino   ssa_use_operand_t *end_p;
237e4b17023SJohn Marino   /* This node is inserted and used to mark the end of the uses for a stmt.  */
238e4b17023SJohn Marino   ssa_use_operand_t iter_node;
239e4b17023SJohn Marino   /* This is the next ssa_name to visit.  IMM_USE may get removed before
240e4b17023SJohn Marino      the next one is traversed to, so it must be cached early.  */
241e4b17023SJohn Marino   ssa_use_operand_t *next_imm_name;
242e4b17023SJohn Marino } imm_use_iterator;
243e4b17023SJohn Marino 
244e4b17023SJohn Marino 
245e4b17023SJohn Marino /* Use this iterator when simply looking at stmts.  Adding, deleting or
246e4b17023SJohn Marino    modifying stmts will cause this iterator to malfunction.  */
247e4b17023SJohn Marino 
248e4b17023SJohn Marino #define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR)		\
249e4b17023SJohn Marino   for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR));	\
250e4b17023SJohn Marino        !end_readonly_imm_use_p (&(ITER));			\
251e4b17023SJohn Marino        (void) ((DEST) = next_readonly_imm_use (&(ITER))))
252e4b17023SJohn Marino 
253e4b17023SJohn Marino /* Use this iterator to visit each stmt which has a use of SSAVAR.  */
254e4b17023SJohn Marino 
255e4b17023SJohn Marino #define FOR_EACH_IMM_USE_STMT(STMT, ITER, SSAVAR)		\
256e4b17023SJohn Marino   for ((STMT) = first_imm_use_stmt (&(ITER), (SSAVAR));		\
257e4b17023SJohn Marino        !end_imm_use_stmt_p (&(ITER));				\
258e4b17023SJohn Marino        (void) ((STMT) = next_imm_use_stmt (&(ITER))))
259e4b17023SJohn Marino 
260e4b17023SJohn Marino /* Use this to terminate the FOR_EACH_IMM_USE_STMT loop early.  Failure to
261e4b17023SJohn Marino    do so will result in leaving a iterator marker node in the immediate
262e4b17023SJohn Marino    use list, and nothing good will come from that.   */
263e4b17023SJohn Marino #define BREAK_FROM_IMM_USE_STMT(ITER)				\
264e4b17023SJohn Marino    {								\
265e4b17023SJohn Marino      end_imm_use_stmt_traverse (&(ITER));			\
266e4b17023SJohn Marino      break;							\
267e4b17023SJohn Marino    }
268e4b17023SJohn Marino 
269e4b17023SJohn Marino 
270e4b17023SJohn Marino /* Use this iterator in combination with FOR_EACH_IMM_USE_STMT to
271e4b17023SJohn Marino    get access to each occurrence of ssavar on the stmt returned by
272e4b17023SJohn Marino    that iterator..  for instance:
273e4b17023SJohn Marino 
274e4b17023SJohn Marino      FOR_EACH_IMM_USE_STMT (stmt, iter, var)
275e4b17023SJohn Marino        {
276e4b17023SJohn Marino          FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
277e4b17023SJohn Marino 	   {
278e4b17023SJohn Marino 	     SET_USE (use_p, blah);
279e4b17023SJohn Marino 	   }
280e4b17023SJohn Marino 	 update_stmt (stmt);
281e4b17023SJohn Marino        }							 */
282e4b17023SJohn Marino 
283e4b17023SJohn Marino #define FOR_EACH_IMM_USE_ON_STMT(DEST, ITER)			\
284e4b17023SJohn Marino   for ((DEST) = first_imm_use_on_stmt (&(ITER));		\
285e4b17023SJohn Marino        !end_imm_use_on_stmt_p (&(ITER));			\
286e4b17023SJohn Marino        (void) ((DEST) = next_imm_use_on_stmt (&(ITER))))
287e4b17023SJohn Marino 
288e4b17023SJohn Marino 
289e4b17023SJohn Marino 
290e4b17023SJohn Marino typedef struct var_ann_d *var_ann_t;
291e4b17023SJohn Marino 
292e4b17023SJohn Marino static inline var_ann_t var_ann (const_tree);
293e4b17023SJohn Marino static inline void update_stmt (gimple);
294e4b17023SJohn Marino static inline int get_lineno (const_gimple);
295e4b17023SJohn Marino 
296e4b17023SJohn Marino /* Accessors for basic block annotations.  */
297e4b17023SJohn Marino static inline gimple_seq phi_nodes (const_basic_block);
298e4b17023SJohn Marino static inline void set_phi_nodes (basic_block, gimple_seq);
299e4b17023SJohn Marino 
300e4b17023SJohn Marino /*---------------------------------------------------------------------------
301e4b17023SJohn Marino 			      Global declarations
302e4b17023SJohn Marino ---------------------------------------------------------------------------*/
303e4b17023SJohn Marino struct int_tree_map {
304e4b17023SJohn Marino   unsigned int uid;
305e4b17023SJohn Marino   tree to;
306e4b17023SJohn Marino };
307e4b17023SJohn Marino 
308e4b17023SJohn Marino extern unsigned int int_tree_map_hash (const void *);
309e4b17023SJohn Marino extern int int_tree_map_eq (const void *, const void *);
310e4b17023SJohn Marino 
311e4b17023SJohn Marino extern unsigned int uid_decl_map_hash (const void *);
312e4b17023SJohn Marino extern int uid_decl_map_eq (const void *, const void *);
313e4b17023SJohn Marino 
314e4b17023SJohn Marino typedef struct
315e4b17023SJohn Marino {
316e4b17023SJohn Marino   htab_iterator hti;
317e4b17023SJohn Marino } referenced_var_iterator;
318e4b17023SJohn Marino 
319e4b17023SJohn Marino /* This macro loops over all the referenced vars, one at a time, putting the
320e4b17023SJohn Marino    current var in VAR.  Note:  You are not allowed to add referenced variables
321e4b17023SJohn Marino    to the hashtable while using this macro.  Doing so may cause it to behave
322e4b17023SJohn Marino    erratically.  */
323e4b17023SJohn Marino 
324e4b17023SJohn Marino #define FOR_EACH_REFERENCED_VAR(FN, VAR, ITER)		\
325e4b17023SJohn Marino   for ((VAR) = first_referenced_var ((FN), &(ITER));	\
326e4b17023SJohn Marino        !end_referenced_vars_p (&(ITER));		\
327e4b17023SJohn Marino        (VAR) = next_referenced_var (&(ITER)))
328e4b17023SJohn Marino 
329e4b17023SJohn Marino extern tree referenced_var_lookup (struct function *, unsigned int);
330e4b17023SJohn Marino extern bool referenced_var_check_and_insert (tree);
331e4b17023SJohn Marino #define num_referenced_vars htab_elements (gimple_referenced_vars (cfun))
332e4b17023SJohn Marino 
333e4b17023SJohn Marino #define num_ssa_names (VEC_length (tree, cfun->gimple_df->ssa_names))
334e4b17023SJohn Marino #define ssa_name(i) (VEC_index (tree, cfun->gimple_df->ssa_names, (i)))
335e4b17023SJohn Marino 
336e4b17023SJohn Marino /* Macros for showing usage statistics.  */
337e4b17023SJohn Marino #define SCALE(x) ((unsigned long) ((x) < 1024*10	\
338e4b17023SJohn Marino 		  ? (x)					\
339e4b17023SJohn Marino 		  : ((x) < 1024*1024*10			\
340e4b17023SJohn Marino 		     ? (x) / 1024			\
341e4b17023SJohn Marino 		     : (x) / (1024*1024))))
342e4b17023SJohn Marino 
343e4b17023SJohn Marino #define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
344e4b17023SJohn Marino 
345e4b17023SJohn Marino #define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
346e4b17023SJohn Marino 
347e4b17023SJohn Marino /*---------------------------------------------------------------------------
348e4b17023SJohn Marino 			      OpenMP Region Tree
349e4b17023SJohn Marino ---------------------------------------------------------------------------*/
350e4b17023SJohn Marino 
351e4b17023SJohn Marino /* Parallel region information.  Every parallel and workshare
352e4b17023SJohn Marino    directive is enclosed between two markers, the OMP_* directive
353e4b17023SJohn Marino    and a corresponding OMP_RETURN statement.  */
354e4b17023SJohn Marino 
355e4b17023SJohn Marino struct omp_region
356e4b17023SJohn Marino {
357e4b17023SJohn Marino   /* The enclosing region.  */
358e4b17023SJohn Marino   struct omp_region *outer;
359e4b17023SJohn Marino 
360e4b17023SJohn Marino   /* First child region.  */
361e4b17023SJohn Marino   struct omp_region *inner;
362e4b17023SJohn Marino 
363e4b17023SJohn Marino   /* Next peer region.  */
364e4b17023SJohn Marino   struct omp_region *next;
365e4b17023SJohn Marino 
366e4b17023SJohn Marino   /* Block containing the omp directive as its last stmt.  */
367e4b17023SJohn Marino   basic_block entry;
368e4b17023SJohn Marino 
369e4b17023SJohn Marino   /* Block containing the OMP_RETURN as its last stmt.  */
370e4b17023SJohn Marino   basic_block exit;
371e4b17023SJohn Marino 
372e4b17023SJohn Marino   /* Block containing the OMP_CONTINUE as its last stmt.  */
373e4b17023SJohn Marino   basic_block cont;
374e4b17023SJohn Marino 
375e4b17023SJohn Marino   /* If this is a combined parallel+workshare region, this is a list
376e4b17023SJohn Marino      of additional arguments needed by the combined parallel+workshare
377e4b17023SJohn Marino      library call.  */
378e4b17023SJohn Marino   VEC(tree,gc) *ws_args;
379e4b17023SJohn Marino 
380e4b17023SJohn Marino   /* The code for the omp directive of this region.  */
381e4b17023SJohn Marino   enum gimple_code type;
382e4b17023SJohn Marino 
383e4b17023SJohn Marino   /* Schedule kind, only used for OMP_FOR type regions.  */
384e4b17023SJohn Marino   enum omp_clause_schedule_kind sched_kind;
385e4b17023SJohn Marino 
386e4b17023SJohn Marino   /* True if this is a combined parallel+workshare region.  */
387e4b17023SJohn Marino   bool is_combined_parallel;
388e4b17023SJohn Marino };
389e4b17023SJohn Marino 
390e4b17023SJohn Marino extern struct omp_region *root_omp_region;
391e4b17023SJohn Marino extern struct omp_region *new_omp_region (basic_block, enum gimple_code,
392e4b17023SJohn Marino 					  struct omp_region *);
393e4b17023SJohn Marino extern void free_omp_regions (void);
394e4b17023SJohn Marino void omp_expand_local (basic_block);
395e4b17023SJohn Marino extern tree find_omp_clause (tree, enum omp_clause_code);
396e4b17023SJohn Marino tree copy_var_decl (tree, tree, tree);
397e4b17023SJohn Marino 
398e4b17023SJohn Marino /*---------------------------------------------------------------------------
399e4b17023SJohn Marino 			      Function prototypes
400e4b17023SJohn Marino ---------------------------------------------------------------------------*/
401e4b17023SJohn Marino /* In tree-cfg.c  */
402e4b17023SJohn Marino 
403e4b17023SJohn Marino /* Location to track pending stmt for edge insertion.  */
404e4b17023SJohn Marino #define PENDING_STMT(e)	((e)->insns.g)
405e4b17023SJohn Marino 
406e4b17023SJohn Marino extern void delete_tree_cfg_annotations (void);
407e4b17023SJohn Marino extern bool stmt_ends_bb_p (gimple);
408e4b17023SJohn Marino extern bool is_ctrl_stmt (gimple);
409e4b17023SJohn Marino extern bool is_ctrl_altering_stmt (gimple);
410e4b17023SJohn Marino extern bool simple_goto_p (gimple);
411e4b17023SJohn Marino extern bool stmt_can_make_abnormal_goto (gimple);
412e4b17023SJohn Marino extern basic_block single_noncomplex_succ (basic_block bb);
413e4b17023SJohn Marino extern void gimple_dump_bb (basic_block, FILE *, int, int);
414e4b17023SJohn Marino extern void gimple_debug_bb (basic_block);
415e4b17023SJohn Marino extern basic_block gimple_debug_bb_n (int);
416e4b17023SJohn Marino extern void gimple_dump_cfg (FILE *, int);
417e4b17023SJohn Marino extern void gimple_debug_cfg (int);
418e4b17023SJohn Marino extern void dump_cfg_stats (FILE *);
419e4b17023SJohn Marino extern void dot_cfg (void);
420e4b17023SJohn Marino extern void debug_cfg_stats (void);
421e4b17023SJohn Marino extern void debug_loops (int);
422e4b17023SJohn Marino extern void debug_loop (struct loop *, int);
423e4b17023SJohn Marino extern void debug_loop_num (unsigned, int);
424e4b17023SJohn Marino extern void print_loops (FILE *, int);
425e4b17023SJohn Marino extern void print_loops_bb (FILE *, basic_block, int, int);
426e4b17023SJohn Marino extern void cleanup_dead_labels (void);
427e4b17023SJohn Marino extern void group_case_labels (void);
428e4b17023SJohn Marino extern gimple first_stmt (basic_block);
429e4b17023SJohn Marino extern gimple last_stmt (basic_block);
430e4b17023SJohn Marino extern gimple last_and_only_stmt (basic_block);
431e4b17023SJohn Marino extern edge find_taken_edge (basic_block, tree);
432e4b17023SJohn Marino extern basic_block label_to_block_fn (struct function *, tree);
433e4b17023SJohn Marino #define label_to_block(t) (label_to_block_fn (cfun, t))
434e4b17023SJohn Marino extern void notice_special_calls (gimple);
435e4b17023SJohn Marino extern void clear_special_calls (void);
436e4b17023SJohn Marino extern void verify_gimple_in_seq (gimple_seq);
437e4b17023SJohn Marino extern void verify_gimple_in_cfg (struct function *);
438e4b17023SJohn Marino extern tree gimple_block_label (basic_block);
439e4b17023SJohn Marino extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
440e4b17023SJohn Marino extern bool gimple_duplicate_sese_region (edge, edge, basic_block *, unsigned,
441e4b17023SJohn Marino 					basic_block *);
442e4b17023SJohn Marino extern bool gimple_duplicate_sese_tail (edge, edge, basic_block *, unsigned,
443e4b17023SJohn Marino 				      basic_block *);
444e4b17023SJohn Marino extern void gather_blocks_in_sese_region (basic_block entry, basic_block exit,
445e4b17023SJohn Marino 					  VEC(basic_block,heap) **bbs_p);
446e4b17023SJohn Marino extern void add_phi_args_after_copy_bb (basic_block);
447e4b17023SJohn Marino extern void add_phi_args_after_copy (basic_block *, unsigned, edge);
448e4b17023SJohn Marino extern bool gimple_purge_dead_eh_edges (basic_block);
449e4b17023SJohn Marino extern bool gimple_purge_all_dead_eh_edges (const_bitmap);
450e4b17023SJohn Marino extern bool gimple_purge_dead_abnormal_call_edges (basic_block);
451e4b17023SJohn Marino extern bool gimple_purge_all_dead_abnormal_call_edges (const_bitmap);
452e4b17023SJohn Marino extern tree gimplify_build1 (gimple_stmt_iterator *, enum tree_code,
453e4b17023SJohn Marino 			     tree, tree);
454e4b17023SJohn Marino extern tree gimplify_build2 (gimple_stmt_iterator *, enum tree_code,
455e4b17023SJohn Marino 			     tree, tree, tree);
456e4b17023SJohn Marino extern tree gimplify_build3 (gimple_stmt_iterator *, enum tree_code,
457e4b17023SJohn Marino 			     tree, tree, tree, tree);
458e4b17023SJohn Marino extern void init_empty_tree_cfg (void);
459e4b17023SJohn Marino extern void init_empty_tree_cfg_for_function (struct function *);
460e4b17023SJohn Marino extern void fold_cond_expr_cond (void);
461e4b17023SJohn Marino extern void make_abnormal_goto_edges (basic_block, bool);
462e4b17023SJohn Marino extern void replace_uses_by (tree, tree);
463e4b17023SJohn Marino extern void start_recording_case_labels (void);
464e4b17023SJohn Marino extern void end_recording_case_labels (void);
465e4b17023SJohn Marino extern basic_block move_sese_region_to_fn (struct function *, basic_block,
466e4b17023SJohn Marino 				           basic_block, tree);
467e4b17023SJohn Marino void remove_edge_and_dominated_blocks (edge);
468e4b17023SJohn Marino bool tree_node_can_be_shared (tree);
469*95d28233SJohn Marino extern unsigned int split_critical_edges (void);
470e4b17023SJohn Marino 
471e4b17023SJohn Marino /* In tree-cfgcleanup.c  */
472e4b17023SJohn Marino extern bitmap cfgcleanup_altered_bbs;
473e4b17023SJohn Marino extern bool cleanup_tree_cfg (void);
474e4b17023SJohn Marino 
475e4b17023SJohn Marino /* In tree-pretty-print.c.  */
476e4b17023SJohn Marino extern void dump_generic_bb (FILE *, basic_block, int, int);
477e4b17023SJohn Marino extern int op_code_prio (enum tree_code);
478e4b17023SJohn Marino extern int op_prio (const_tree);
479e4b17023SJohn Marino extern const char *op_symbol_code (enum tree_code);
480e4b17023SJohn Marino 
481e4b17023SJohn Marino /* In tree-dfa.c  */
482e4b17023SJohn Marino extern var_ann_t create_var_ann (tree);
483e4b17023SJohn Marino extern void renumber_gimple_stmt_uids (void);
484e4b17023SJohn Marino extern void renumber_gimple_stmt_uids_in_blocks (basic_block *, int);
485e4b17023SJohn Marino extern void dump_dfa_stats (FILE *);
486e4b17023SJohn Marino extern void debug_dfa_stats (void);
487e4b17023SJohn Marino extern void debug_referenced_vars (void);
488e4b17023SJohn Marino extern void dump_referenced_vars (FILE *);
489e4b17023SJohn Marino extern void dump_variable (FILE *, tree);
490e4b17023SJohn Marino extern void debug_variable (tree);
491e4b17023SJohn Marino extern tree get_virtual_var (tree);
492e4b17023SJohn Marino extern bool add_referenced_var (tree);
493e4b17023SJohn Marino extern void remove_referenced_var (tree);
494e4b17023SJohn Marino extern void mark_symbols_for_renaming (gimple);
495e4b17023SJohn Marino extern void find_new_referenced_vars (gimple);
496e4b17023SJohn Marino extern tree make_rename_temp (tree, const char *);
497e4b17023SJohn Marino extern void set_default_def (tree, tree);
498e4b17023SJohn Marino extern tree gimple_default_def (struct function *, tree);
499e4b17023SJohn Marino extern bool stmt_references_abnormal_ssa_name (gimple);
500e4b17023SJohn Marino extern tree get_ref_base_and_extent (tree, HOST_WIDE_INT *,
501e4b17023SJohn Marino 				     HOST_WIDE_INT *, HOST_WIDE_INT *);
502e4b17023SJohn Marino extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *);
503e4b17023SJohn Marino extern void find_referenced_vars_in (gimple);
504e4b17023SJohn Marino 
505e4b17023SJohn Marino /* In tree-phinodes.c  */
506e4b17023SJohn Marino extern void reserve_phi_args_for_new_edge (basic_block);
507e4b17023SJohn Marino extern void add_phi_node_to_bb (gimple phi, basic_block bb);
508e4b17023SJohn Marino extern gimple create_phi_node (tree, basic_block);
509e4b17023SJohn Marino extern void add_phi_arg (gimple, tree, edge, source_location);
510e4b17023SJohn Marino extern void remove_phi_args (edge);
511e4b17023SJohn Marino extern void remove_phi_node (gimple_stmt_iterator *, bool);
512e4b17023SJohn Marino extern void remove_phi_nodes (basic_block);
513e4b17023SJohn Marino extern void init_phinodes (void);
514e4b17023SJohn Marino extern void fini_phinodes (void);
515e4b17023SJohn Marino extern void release_phi_node (gimple);
516e4b17023SJohn Marino #ifdef GATHER_STATISTICS
517e4b17023SJohn Marino extern void phinodes_print_statistics (void);
518e4b17023SJohn Marino #endif
519e4b17023SJohn Marino 
520e4b17023SJohn Marino /* In gimple-low.c  */
521e4b17023SJohn Marino extern void record_vars_into (tree, tree);
522e4b17023SJohn Marino extern void record_vars (tree);
523e4b17023SJohn Marino extern bool gimple_seq_may_fallthru (gimple_seq);
524e4b17023SJohn Marino extern bool gimple_stmt_may_fallthru (gimple);
525e4b17023SJohn Marino extern bool gimple_check_call_matching_types (gimple, tree);
526e4b17023SJohn Marino 
527e4b17023SJohn Marino 
528e4b17023SJohn Marino /* In tree-ssa.c  */
529e4b17023SJohn Marino 
530e4b17023SJohn Marino /* Mapping for redirected edges.  */
531e4b17023SJohn Marino struct _edge_var_map {
532e4b17023SJohn Marino   tree result;			/* PHI result.  */
533e4b17023SJohn Marino   tree def;			/* PHI arg definition.  */
534e4b17023SJohn Marino   source_location locus;        /* PHI arg location.  */
535e4b17023SJohn Marino };
536e4b17023SJohn Marino typedef struct _edge_var_map edge_var_map;
537e4b17023SJohn Marino 
538e4b17023SJohn Marino DEF_VEC_O(edge_var_map);
539e4b17023SJohn Marino DEF_VEC_ALLOC_O(edge_var_map, heap);
540e4b17023SJohn Marino 
541e4b17023SJohn Marino /* A vector of var maps.  */
542e4b17023SJohn Marino typedef VEC(edge_var_map, heap) *edge_var_map_vector;
543e4b17023SJohn Marino 
544e4b17023SJohn Marino extern void init_tree_ssa (struct function *);
545e4b17023SJohn Marino extern void redirect_edge_var_map_add (edge, tree, tree, source_location);
546e4b17023SJohn Marino extern void redirect_edge_var_map_clear (edge);
547e4b17023SJohn Marino extern void redirect_edge_var_map_dup (edge, edge);
548e4b17023SJohn Marino extern edge_var_map_vector redirect_edge_var_map_vector (edge);
549e4b17023SJohn Marino extern void redirect_edge_var_map_destroy (void);
550e4b17023SJohn Marino 
551e4b17023SJohn Marino extern edge ssa_redirect_edge (edge, basic_block);
552e4b17023SJohn Marino extern void flush_pending_stmts (edge);
553e4b17023SJohn Marino extern void verify_ssa (bool);
554e4b17023SJohn Marino extern void delete_tree_ssa (void);
555e4b17023SJohn Marino extern bool ssa_undefined_value_p (tree);
556e4b17023SJohn Marino extern void warn_uninit (enum opt_code, tree, tree, tree, const char *, void *);
557e4b17023SJohn Marino extern unsigned int warn_uninitialized_vars (bool);
558e4b17023SJohn Marino extern void execute_update_addresses_taken (void);
559e4b17023SJohn Marino 
560e4b17023SJohn Marino /* Call-back function for walk_use_def_chains().  At each reaching
561e4b17023SJohn Marino    definition, a function with this prototype is called.  */
562e4b17023SJohn Marino typedef bool (*walk_use_def_chains_fn) (tree, gimple, void *);
563e4b17023SJohn Marino 
564e4b17023SJohn Marino extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
565e4b17023SJohn Marino 
566e4b17023SJohn Marino void insert_debug_temps_for_defs (gimple_stmt_iterator *);
567e4b17023SJohn Marino void insert_debug_temp_for_var_def (gimple_stmt_iterator *, tree);
568e4b17023SJohn Marino void reset_debug_uses (gimple);
569e4b17023SJohn Marino void release_defs_bitset (bitmap toremove);
570e4b17023SJohn Marino 
571e4b17023SJohn Marino /* In tree-into-ssa.c  */
572e4b17023SJohn Marino void update_ssa (unsigned);
573e4b17023SJohn Marino void delete_update_ssa (void);
574e4b17023SJohn Marino void register_new_name_mapping (tree, tree);
575e4b17023SJohn Marino tree create_new_def_for (tree, gimple, def_operand_p);
576e4b17023SJohn Marino bool need_ssa_update_p (struct function *);
577e4b17023SJohn Marino bool name_mappings_registered_p (void);
578e4b17023SJohn Marino bool name_registered_for_update_p (tree);
579e4b17023SJohn Marino bitmap ssa_names_to_replace (void);
580e4b17023SJohn Marino void release_ssa_name_after_update_ssa (tree);
581e4b17023SJohn Marino void compute_global_livein (bitmap, bitmap);
582e4b17023SJohn Marino void mark_sym_for_renaming (tree);
583e4b17023SJohn Marino void mark_set_for_renaming (bitmap);
584e4b17023SJohn Marino bool symbol_marked_for_renaming (tree);
585e4b17023SJohn Marino tree get_current_def (tree);
586e4b17023SJohn Marino void set_current_def (tree, tree);
587e4b17023SJohn Marino 
588e4b17023SJohn Marino /* In tree-ssanames.c  */
589e4b17023SJohn Marino extern void init_ssanames (struct function *, int);
590e4b17023SJohn Marino extern void fini_ssanames (void);
591e4b17023SJohn Marino extern tree make_ssa_name_fn (struct function *, tree, gimple);
592e4b17023SJohn Marino extern tree duplicate_ssa_name (tree, gimple);
593e4b17023SJohn Marino extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
594e4b17023SJohn Marino extern void release_ssa_name (tree);
595e4b17023SJohn Marino extern void release_defs (gimple);
596e4b17023SJohn Marino extern void replace_ssa_name_symbol (tree, tree);
597e4b17023SJohn Marino 
598e4b17023SJohn Marino #ifdef GATHER_STATISTICS
599e4b17023SJohn Marino extern void ssanames_print_statistics (void);
600e4b17023SJohn Marino #endif
601e4b17023SJohn Marino 
602e4b17023SJohn Marino /* In tree-ssa-ccp.c  */
603e4b17023SJohn Marino tree fold_const_aggregate_ref (tree);
604e4b17023SJohn Marino tree gimple_fold_stmt_to_constant (gimple, tree (*)(tree));
605e4b17023SJohn Marino 
606e4b17023SJohn Marino /* In tree-ssa-dom.c  */
607e4b17023SJohn Marino extern void dump_dominator_optimization_stats (FILE *);
608e4b17023SJohn Marino extern void debug_dominator_optimization_stats (void);
609e4b17023SJohn Marino int loop_depth_of_name (tree);
610e4b17023SJohn Marino tree degenerate_phi_result (gimple);
611e4b17023SJohn Marino bool simple_iv_increment_p (gimple);
612e4b17023SJohn Marino 
613e4b17023SJohn Marino /* In tree-ssa-copy.c  */
614e4b17023SJohn Marino extern void propagate_value (use_operand_p, tree);
615e4b17023SJohn Marino extern void propagate_tree_value (tree *, tree);
616e4b17023SJohn Marino extern void propagate_tree_value_into_stmt (gimple_stmt_iterator *, tree);
617e4b17023SJohn Marino extern void replace_exp (use_operand_p, tree);
618e4b17023SJohn Marino extern bool may_propagate_copy (tree, tree);
619e4b17023SJohn Marino extern bool may_propagate_copy_into_stmt (gimple, tree);
620e4b17023SJohn Marino extern bool may_propagate_copy_into_asm (tree);
621e4b17023SJohn Marino 
622e4b17023SJohn Marino /* In tree-ssa-loop-ch.c  */
623e4b17023SJohn Marino bool do_while_loop_p (struct loop *);
624e4b17023SJohn Marino 
625e4b17023SJohn Marino /* Affine iv.  */
626e4b17023SJohn Marino 
627e4b17023SJohn Marino typedef struct
628e4b17023SJohn Marino {
629e4b17023SJohn Marino   /* Iv = BASE + STEP * i.  */
630e4b17023SJohn Marino   tree base, step;
631e4b17023SJohn Marino 
632e4b17023SJohn Marino   /* True if this iv does not overflow.  */
633e4b17023SJohn Marino   bool no_overflow;
634e4b17023SJohn Marino } affine_iv;
635e4b17023SJohn Marino 
636e4b17023SJohn Marino /* Description of number of iterations of a loop.  All the expressions inside
637e4b17023SJohn Marino    the structure can be evaluated at the end of the loop's preheader
638e4b17023SJohn Marino    (and due to ssa form, also anywhere inside the body of the loop).  */
639e4b17023SJohn Marino 
640e4b17023SJohn Marino struct tree_niter_desc
641e4b17023SJohn Marino {
642e4b17023SJohn Marino   tree assumptions;	/* The boolean expression.  If this expression evaluates
643e4b17023SJohn Marino 			   to false, then the other fields in this structure
644e4b17023SJohn Marino 			   should not be used; there is no guarantee that they
645e4b17023SJohn Marino 			   will be correct.  */
646e4b17023SJohn Marino   tree may_be_zero;	/* The boolean expression.  If it evaluates to true,
647e4b17023SJohn Marino 			   the loop will exit in the first iteration (i.e.
648e4b17023SJohn Marino 			   its latch will not be executed), even if the niter
649e4b17023SJohn Marino 			   field says otherwise.  */
650e4b17023SJohn Marino   tree niter;		/* The expression giving the number of iterations of
651e4b17023SJohn Marino 			   a loop (provided that assumptions == true and
652e4b17023SJohn Marino 			   may_be_zero == false), more precisely the number
653e4b17023SJohn Marino 			   of executions of the latch of the loop.  */
654e4b17023SJohn Marino   double_int max;	/* The upper bound on the number of iterations of
655e4b17023SJohn Marino 			   the loop.  */
656e4b17023SJohn Marino 
657e4b17023SJohn Marino   /* The simplified shape of the exit condition.  The loop exits if
658e4b17023SJohn Marino      CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
659e4b17023SJohn Marino      LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
660e4b17023SJohn Marino      LE_EXPR and negative if CMP is GE_EXPR.  This information is used
661e4b17023SJohn Marino      by loop unrolling.  */
662e4b17023SJohn Marino   affine_iv control;
663e4b17023SJohn Marino   tree bound;
664e4b17023SJohn Marino   enum tree_code cmp;
665e4b17023SJohn Marino };
666e4b17023SJohn Marino 
667e4b17023SJohn Marino /* In tree-ssa-phiopt.c */
668e4b17023SJohn Marino bool empty_block_p (basic_block);
669e4b17023SJohn Marino basic_block *blocks_in_phiopt_order (void);
670e4b17023SJohn Marino 
671e4b17023SJohn Marino /* In tree-ssa-loop*.c  */
672e4b17023SJohn Marino 
673e4b17023SJohn Marino unsigned int tree_ssa_lim (void);
674e4b17023SJohn Marino unsigned int tree_ssa_unswitch_loops (void);
675e4b17023SJohn Marino unsigned int canonicalize_induction_variables (void);
676e4b17023SJohn Marino unsigned int tree_unroll_loops_completely (bool, bool);
677e4b17023SJohn Marino unsigned int tree_ssa_prefetch_arrays (void);
678e4b17023SJohn Marino void tree_ssa_iv_optimize (void);
679e4b17023SJohn Marino unsigned tree_predictive_commoning (void);
680e4b17023SJohn Marino tree canonicalize_loop_ivs (struct loop *, tree *, bool);
681e4b17023SJohn Marino bool parallelize_loops (void);
682e4b17023SJohn Marino 
683e4b17023SJohn Marino bool loop_only_exit_p (const struct loop *, const_edge);
684e4b17023SJohn Marino bool number_of_iterations_exit (struct loop *, edge,
685e4b17023SJohn Marino 				struct tree_niter_desc *niter, bool);
686e4b17023SJohn Marino tree find_loop_niter (struct loop *, edge *);
687e4b17023SJohn Marino tree loop_niter_by_eval (struct loop *, edge);
688e4b17023SJohn Marino tree find_loop_niter_by_eval (struct loop *, edge *);
689e4b17023SJohn Marino void estimate_numbers_of_iterations (bool);
690e4b17023SJohn Marino bool array_at_struct_end_p (tree);
691e4b17023SJohn Marino bool scev_probably_wraps_p (tree, tree, gimple, struct loop *, bool);
692e4b17023SJohn Marino bool convert_affine_scev (struct loop *, tree, tree *, tree *, gimple, bool);
693e4b17023SJohn Marino 
694e4b17023SJohn Marino bool nowrap_type_p (tree);
695e4b17023SJohn Marino enum ev_direction {EV_DIR_GROWS, EV_DIR_DECREASES, EV_DIR_UNKNOWN};
696e4b17023SJohn Marino enum ev_direction scev_direction (const_tree);
697e4b17023SJohn Marino 
698e4b17023SJohn Marino void free_numbers_of_iterations_estimates (void);
699e4b17023SJohn Marino void free_numbers_of_iterations_estimates_loop (struct loop *);
700e4b17023SJohn Marino void rewrite_into_loop_closed_ssa (bitmap, unsigned);
701e4b17023SJohn Marino void verify_loop_closed_ssa (bool);
702e4b17023SJohn Marino bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
703e4b17023SJohn Marino void create_iv (tree, tree, tree, struct loop *, gimple_stmt_iterator *, bool,
704e4b17023SJohn Marino 		tree *, tree *);
705e4b17023SJohn Marino basic_block split_loop_exit_edge (edge);
706e4b17023SJohn Marino void standard_iv_increment_position (struct loop *, gimple_stmt_iterator *,
707e4b17023SJohn Marino 				     bool *);
708e4b17023SJohn Marino basic_block ip_end_pos (struct loop *);
709e4b17023SJohn Marino basic_block ip_normal_pos (struct loop *);
710e4b17023SJohn Marino bool gimple_duplicate_loop_to_header_edge (struct loop *, edge,
711e4b17023SJohn Marino 					 unsigned int, sbitmap,
712e4b17023SJohn Marino 					 edge, VEC (edge, heap) **,
713e4b17023SJohn Marino 					 int);
714e4b17023SJohn Marino struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *, edge);
715e4b17023SJohn Marino void rename_variables_in_loop (struct loop *);
716e4b17023SJohn Marino void rename_variables_in_bb (basic_block bb);
717e4b17023SJohn Marino tree expand_simple_operations (tree);
718e4b17023SJohn Marino void substitute_in_loop_info (struct loop *, tree, tree);
719e4b17023SJohn Marino edge single_dom_exit (struct loop *);
720e4b17023SJohn Marino bool can_unroll_loop_p (struct loop *loop, unsigned factor,
721e4b17023SJohn Marino 			struct tree_niter_desc *niter);
722e4b17023SJohn Marino void tree_unroll_loop (struct loop *, unsigned,
723e4b17023SJohn Marino 		       edge, struct tree_niter_desc *);
724e4b17023SJohn Marino typedef void (*transform_callback)(struct loop *, void *);
725e4b17023SJohn Marino void tree_transform_and_unroll_loop (struct loop *, unsigned,
726e4b17023SJohn Marino 				     edge, struct tree_niter_desc *,
727e4b17023SJohn Marino 				     transform_callback, void *);
728e4b17023SJohn Marino bool contains_abnormal_ssa_name_p (tree);
729e4b17023SJohn Marino bool stmt_dominates_stmt_p (gimple, gimple);
730e4b17023SJohn Marino void mark_virtual_ops_for_renaming (gimple);
731e4b17023SJohn Marino 
732e4b17023SJohn Marino /* In tree-ssa-dce.c */
733e4b17023SJohn Marino void mark_virtual_operand_for_renaming (tree);
734e4b17023SJohn Marino void mark_virtual_phi_result_for_renaming (gimple);
735e4b17023SJohn Marino 
736e4b17023SJohn Marino /* In tree-ssa-threadedge.c */
737e4b17023SJohn Marino extern void threadedge_initialize_values (void);
738e4b17023SJohn Marino extern void threadedge_finalize_values (void);
739e4b17023SJohn Marino extern VEC(tree,heap) *ssa_name_values;
740e4b17023SJohn Marino #define SSA_NAME_VALUE(x) \
741e4b17023SJohn Marino     (SSA_NAME_VERSION(x) < VEC_length(tree, ssa_name_values) \
742e4b17023SJohn Marino      ? VEC_index(tree, ssa_name_values, SSA_NAME_VERSION(x)) \
743e4b17023SJohn Marino      : NULL_TREE)
744e4b17023SJohn Marino extern void set_ssa_name_value (tree, tree);
745e4b17023SJohn Marino extern bool potentially_threadable_block (basic_block);
746e4b17023SJohn Marino extern void thread_across_edge (gimple, edge, bool,
747e4b17023SJohn Marino 				VEC(tree, heap) **, tree (*) (gimple, gimple));
748e4b17023SJohn Marino 
749e4b17023SJohn Marino /* In tree-ssa-loop-im.c  */
750e4b17023SJohn Marino /* The possibilities of statement movement.  */
751e4b17023SJohn Marino 
752e4b17023SJohn Marino enum move_pos
753e4b17023SJohn Marino   {
754e4b17023SJohn Marino     MOVE_IMPOSSIBLE,		/* No movement -- side effect expression.  */
755e4b17023SJohn Marino     MOVE_PRESERVE_EXECUTION,	/* Must not cause the non-executed statement
756e4b17023SJohn Marino 				   become executed -- memory accesses, ... */
757e4b17023SJohn Marino     MOVE_POSSIBLE		/* Unlimited movement.  */
758e4b17023SJohn Marino   };
759e4b17023SJohn Marino extern enum move_pos movement_possibility (gimple);
760e4b17023SJohn Marino char *get_lsm_tmp_name (tree, unsigned);
761e4b17023SJohn Marino 
762e4b17023SJohn Marino /* In tree-flow-inline.h  */
763e4b17023SJohn Marino static inline void set_is_used (tree);
764e4b17023SJohn Marino static inline bool unmodifiable_var_p (const_tree);
765e4b17023SJohn Marino static inline bool ref_contains_array_ref (const_tree);
766e4b17023SJohn Marino 
767e4b17023SJohn Marino /* In tree-eh.c  */
768e4b17023SJohn Marino extern void make_eh_edges (gimple);
769e4b17023SJohn Marino extern bool make_eh_dispatch_edges (gimple);
770e4b17023SJohn Marino extern edge redirect_eh_edge (edge, basic_block);
771e4b17023SJohn Marino extern void redirect_eh_dispatch_edge (gimple, edge, basic_block);
772e4b17023SJohn Marino extern bool tree_could_trap_p (tree);
773e4b17023SJohn Marino extern bool operation_could_trap_helper_p (enum tree_code, bool, bool, bool,
774e4b17023SJohn Marino 					   bool, tree, bool *);
775e4b17023SJohn Marino extern bool operation_could_trap_p (enum tree_code, bool, bool, tree);
776e4b17023SJohn Marino extern bool stmt_could_throw_p (gimple);
777e4b17023SJohn Marino extern bool tree_could_throw_p (tree);
778e4b17023SJohn Marino extern bool stmt_can_throw_internal (gimple);
779e4b17023SJohn Marino extern bool stmt_can_throw_external (gimple);
780e4b17023SJohn Marino extern void add_stmt_to_eh_lp_fn (struct function *, gimple, int);
781e4b17023SJohn Marino extern void add_stmt_to_eh_lp (gimple, int);
782e4b17023SJohn Marino extern bool remove_stmt_from_eh_lp (gimple);
783e4b17023SJohn Marino extern bool remove_stmt_from_eh_lp_fn (struct function *, gimple);
784e4b17023SJohn Marino extern int lookup_stmt_eh_lp_fn (struct function *, gimple);
785e4b17023SJohn Marino extern int lookup_stmt_eh_lp (gimple);
786e4b17023SJohn Marino extern bool maybe_clean_eh_stmt_fn (struct function *, gimple);
787e4b17023SJohn Marino extern bool maybe_clean_eh_stmt (gimple);
788e4b17023SJohn Marino extern bool maybe_clean_or_replace_eh_stmt (gimple, gimple);
789e4b17023SJohn Marino extern bool maybe_duplicate_eh_stmt_fn (struct function *, gimple,
790e4b17023SJohn Marino 					struct function *, gimple,
791e4b17023SJohn Marino 					struct pointer_map_t *, int);
792e4b17023SJohn Marino extern bool maybe_duplicate_eh_stmt (gimple, gimple);
793e4b17023SJohn Marino extern bool verify_eh_edges (gimple);
794e4b17023SJohn Marino extern bool verify_eh_dispatch_edge (gimple);
795e4b17023SJohn Marino extern void maybe_remove_unreachable_handlers (void);
796e4b17023SJohn Marino 
797e4b17023SJohn Marino /* In tree-ssa-pre.c  */
798e4b17023SJohn Marino struct pre_expr_d;
799e4b17023SJohn Marino void add_to_value (unsigned int, struct pre_expr_d *);
800e4b17023SJohn Marino void debug_value_expressions (unsigned int);
801e4b17023SJohn Marino void print_value_expressions (FILE *, unsigned int);
802e4b17023SJohn Marino 
803e4b17023SJohn Marino /* In tree-ssa-sink.c  */
804e4b17023SJohn Marino bool is_hidden_global_store (gimple);
805e4b17023SJohn Marino 
806e4b17023SJohn Marino /* In tree-loop-linear.c  */
807e4b17023SJohn Marino extern void linear_transform_loops (void);
808e4b17023SJohn Marino extern unsigned perfect_loop_nest_depth (struct loop *);
809e4b17023SJohn Marino 
810e4b17023SJohn Marino /* In graphite.c  */
811e4b17023SJohn Marino extern void graphite_transform_loops (void);
812e4b17023SJohn Marino 
813e4b17023SJohn Marino /* In tree-data-ref.c  */
814e4b17023SJohn Marino extern void tree_check_data_deps (void);
815e4b17023SJohn Marino 
816e4b17023SJohn Marino /* In tree-ssa-loop-ivopts.c  */
817e4b17023SJohn Marino bool expr_invariant_in_loop_p (struct loop *, tree);
818e4b17023SJohn Marino bool stmt_invariant_in_loop_p (struct loop *, gimple);
819e4b17023SJohn Marino bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum machine_mode,
820e4b17023SJohn Marino 				      addr_space_t);
821e4b17023SJohn Marino unsigned multiply_by_cost (HOST_WIDE_INT, enum machine_mode, bool);
822e4b17023SJohn Marino bool may_be_nonaddressable_p (tree expr);
823e4b17023SJohn Marino 
824e4b17023SJohn Marino /* In tree-ssa-threadupdate.c.  */
825e4b17023SJohn Marino extern bool thread_through_all_blocks (bool);
826e4b17023SJohn Marino extern void register_jump_thread (edge, edge, edge);
827e4b17023SJohn Marino 
828e4b17023SJohn Marino /* In gimplify.c  */
829e4b17023SJohn Marino tree force_gimple_operand_1 (tree, gimple_seq *, gimple_predicate, tree);
830e4b17023SJohn Marino tree force_gimple_operand (tree, gimple_seq *, bool, tree);
831e4b17023SJohn Marino tree force_gimple_operand_gsi_1 (gimple_stmt_iterator *, tree,
832e4b17023SJohn Marino 				 gimple_predicate, tree,
833e4b17023SJohn Marino 				 bool, enum gsi_iterator_update);
834e4b17023SJohn Marino tree force_gimple_operand_gsi (gimple_stmt_iterator *, tree, bool, tree,
835e4b17023SJohn Marino 			       bool, enum gsi_iterator_update);
836e4b17023SJohn Marino tree gimple_fold_indirect_ref (tree);
837e4b17023SJohn Marino 
838e4b17023SJohn Marino /* In tree-ssa-live.c */
839e4b17023SJohn Marino extern void remove_unused_locals (void);
840e4b17023SJohn Marino extern void dump_scope_blocks (FILE *, int);
841e4b17023SJohn Marino extern void debug_scope_blocks (int);
842e4b17023SJohn Marino extern void debug_scope_block (tree, int);
843e4b17023SJohn Marino 
844e4b17023SJohn Marino /* In tree-ssa-address.c  */
845e4b17023SJohn Marino 
846e4b17023SJohn Marino /* Description of a memory address.  */
847e4b17023SJohn Marino 
848e4b17023SJohn Marino struct mem_address
849e4b17023SJohn Marino {
850e4b17023SJohn Marino   tree symbol, base, index, step, offset;
851e4b17023SJohn Marino };
852e4b17023SJohn Marino 
853e4b17023SJohn Marino struct affine_tree_combination;
854e4b17023SJohn Marino tree create_mem_ref (gimple_stmt_iterator *, tree,
855e4b17023SJohn Marino 		     struct affine_tree_combination *, tree, tree, tree, bool);
856e4b17023SJohn Marino rtx addr_for_mem_ref (struct mem_address *, addr_space_t, bool);
857e4b17023SJohn Marino void get_address_description (tree, struct mem_address *);
858e4b17023SJohn Marino tree maybe_fold_tmr (tree);
859e4b17023SJohn Marino 
860e4b17023SJohn Marino unsigned int execute_free_datastructures (void);
861e4b17023SJohn Marino unsigned int execute_fixup_cfg (void);
862e4b17023SJohn Marino bool fixup_noreturn_call (gimple stmt);
863e4b17023SJohn Marino 
864e4b17023SJohn Marino /* In ipa-pure-const.c  */
865e4b17023SJohn Marino void warn_function_noreturn (tree);
866e4b17023SJohn Marino 
867e4b17023SJohn Marino /* In tree-ssa-ter.c  */
868e4b17023SJohn Marino bool stmt_is_replaceable_p (gimple);
869e4b17023SJohn Marino 
870e4b17023SJohn Marino #include "tree-flow-inline.h"
871e4b17023SJohn Marino 
872e4b17023SJohn Marino void swap_tree_operands (gimple, tree *, tree *);
873e4b17023SJohn Marino 
874e4b17023SJohn Marino #endif /* _TREE_FLOW_H  */
875