1169689Skan/* Data and Control Flow Analysis for Trees.
2169689Skan   Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
3169689Skan   Contributed by Diego Novillo <dnovillo@redhat.com>
4169689Skan
5169689SkanThis file is part of GCC.
6169689Skan
7169689SkanGCC is free software; you can redistribute it and/or modify
8169689Skanit under the terms of the GNU General Public License as published by
9169689Skanthe Free Software Foundation; either version 2, or (at your option)
10169689Skanany later version.
11169689Skan
12169689SkanGCC is distributed in the hope that it will be useful,
13169689Skanbut WITHOUT ANY WARRANTY; without even the implied warranty of
14169689SkanMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15169689SkanGNU General Public License for more details.
16169689Skan
17169689SkanYou should have received a copy of the GNU General Public License
18169689Skanalong with GCC; see the file COPYING.  If not, write to
19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
20169689SkanBoston, MA 02110-1301, USA.  */
21169689Skan
22169689Skan#ifndef _TREE_FLOW_H
23169689Skan#define _TREE_FLOW_H 1
24169689Skan
25169689Skan#include "bitmap.h"
26169689Skan#include "hard-reg-set.h"
27169689Skan#include "basic-block.h"
28169689Skan#include "hashtab.h"
29169689Skan#include "tree-gimple.h"
30169689Skan#include "tree-ssa-operands.h"
31169689Skan#include "cgraph.h"
32169689Skan#include "ipa-reference.h"
33169689Skan
34169689Skan/* Forward declare structures for the garbage collector GTY markers.  */
35169689Skan#ifndef GCC_BASIC_BLOCK_H
36169689Skanstruct edge_def;
37169689Skantypedef struct edge_def *edge;
38169689Skanstruct basic_block_def;
39169689Skantypedef struct basic_block_def *basic_block;
40169689Skan#endif
41169689Skan
42169689Skan/* True if the code is in ssa form.  */
43169689Skanextern bool in_ssa_p;
44169689Skan
45169689Skantypedef struct
46169689Skan{
47169689Skan  htab_t htab;
48169689Skan  PTR *slot;
49169689Skan  PTR *limit;
50169689Skan} htab_iterator;
51169689Skan
52169689Skan/* Iterate through the elements of hashtable HTAB, using htab_iterator ITER,
53169689Skan   storing each element in RESULT, which is of type TYPE.  */
54169689Skan#define FOR_EACH_HTAB_ELEMENT(HTAB, RESULT, TYPE, ITER) \
55169689Skan  for (RESULT = (TYPE) first_htab_element (&(ITER), (HTAB)); \
56169689Skan	!end_htab_p (&(ITER)); \
57169689Skan	RESULT = (TYPE) next_htab_element (&(ITER)))
58169689Skan
59169689Skan/*---------------------------------------------------------------------------
60169689Skan		      Attributes for SSA_NAMEs.
61169689Skan
62169689Skan  NOTE: These structures are stored in struct tree_ssa_name
63169689Skan  but are only used by the tree optimizers, so it makes better sense
64169689Skan  to declare them here to avoid recompiling unrelated files when
65169689Skan  making changes.
66169689Skan---------------------------------------------------------------------------*/
67169689Skan
68169689Skan/* Aliasing information for SSA_NAMEs representing pointer variables.  */
69169689Skanstruct ptr_info_def GTY(())
70169689Skan{
71169689Skan  /* Nonzero if points-to analysis couldn't determine where this pointer
72169689Skan     is pointing to.  */
73169689Skan  unsigned int pt_anything : 1;
74169689Skan
75169689Skan  /* Nonzero if the value of this pointer escapes the current function.  */
76169689Skan  unsigned int value_escapes_p : 1;
77169689Skan
78169689Skan  /* Nonzero if this pointer is dereferenced.  */
79169689Skan  unsigned int is_dereferenced : 1;
80169689Skan
81169689Skan  /* Nonzero if this pointer points to a global variable.  */
82169689Skan  unsigned int pt_global_mem : 1;
83169689Skan
84169689Skan  /* Nonzero if this pointer points to NULL.  */
85169689Skan  unsigned int pt_null : 1;
86169689Skan
87169689Skan  /* Set of variables that this pointer may point to.  */
88169689Skan  bitmap pt_vars;
89169689Skan
90169689Skan  /* If this pointer has been dereferenced, and points-to information is
91169689Skan     more precise than type-based aliasing, indirect references to this
92169689Skan     pointer will be represented by this memory tag, instead of the type
93169689Skan     tag computed by TBAA.  */
94169689Skan  tree name_mem_tag;
95169689Skan
96169689Skan  /* Mask of reasons this pointer's value escapes the function  */
97169689Skan  unsigned int escape_mask;
98169689Skan};
99169689Skan
100169689Skan
101169689Skan/*---------------------------------------------------------------------------
102169689Skan		   Tree annotations stored in tree_common.ann
103169689Skan---------------------------------------------------------------------------*/
104169689Skanenum tree_ann_type { TREE_ANN_COMMON, VAR_ANN, FUNCTION_ANN, STMT_ANN };
105169689Skan
106169689Skanstruct tree_ann_common_d GTY(())
107169689Skan{
108169689Skan  /* Annotation type.  */
109169689Skan  enum tree_ann_type type;
110169689Skan
111169689Skan /* Auxiliary info specific to a pass.  At all times, this
112169689Skan    should either point to valid data or be NULL.  */
113169689Skan  PTR GTY ((skip (""))) aux;
114169689Skan
115169689Skan  /* The value handle for this expression.  Used by GVN-PRE.  */
116169689Skan  tree GTY((skip)) value_handle;
117169689Skan};
118169689Skan
119169689Skan/* It is advantageous to avoid things like life analysis for variables which
120169689Skan   do not need PHI nodes.  This enum describes whether or not a particular
121169689Skan   variable may need a PHI node.  */
122169689Skan
123169689Skanenum need_phi_state {
124169689Skan  /* This is the default.  If we are still in this state after finding
125169689Skan     all the definition and use sites, then we will assume the variable
126169689Skan     needs PHI nodes.  This is probably an overly conservative assumption.  */
127169689Skan  NEED_PHI_STATE_UNKNOWN,
128169689Skan
129169689Skan  /* This state indicates that we have seen one or more sets of the
130169689Skan     variable in a single basic block and that the sets dominate all
131169689Skan     uses seen so far.  If after finding all definition and use sites
132169689Skan     we are still in this state, then the variable does not need any
133169689Skan     PHI nodes.  */
134169689Skan  NEED_PHI_STATE_NO,
135169689Skan
136169689Skan  /* This state indicates that we have either seen multiple definitions of
137169689Skan     the variable in multiple blocks, or that we encountered a use in a
138169689Skan     block that was not dominated by the block containing the set(s) of
139169689Skan     this variable.  This variable is assumed to need PHI nodes.  */
140169689Skan  NEED_PHI_STATE_MAYBE
141169689Skan};
142169689Skan
143169689Skanstruct subvar;
144169689Skantypedef struct subvar *subvar_t;
145169689Skan
146169689Skan/* This structure represents a fake sub-variable for a structure field.  */
147169689Skanstruct subvar GTY(())
148169689Skan{
149169689Skan  /* Fake variable.  */
150169689Skan  tree var;
151169689Skan
152169689Skan  /* Next subvar for this structure.  */
153169689Skan  subvar_t next;
154169689Skan};
155169689Skan
156169689Skanstruct var_ann_d GTY(())
157169689Skan{
158169689Skan  struct tree_ann_common_d common;
159169689Skan
160169689Skan  /* Used by the out of SSA pass to determine whether this variable has
161169689Skan     been seen yet or not.  */
162169689Skan  unsigned out_of_ssa_tag : 1;
163169689Skan
164169689Skan  /* Used when building root_var structures in tree_ssa_live.[ch].  */
165169689Skan  unsigned root_var_processed : 1;
166169689Skan
167169689Skan  /* Nonzero if this variable is in the alias set of another variable.  */
168169689Skan  unsigned is_aliased : 1;
169169689Skan
170169689Skan  /* Nonzero if this variable was used after SSA optimizations were
171169689Skan     applied.  We set this when translating out of SSA form.  */
172169689Skan  unsigned used : 1;
173169689Skan
174169689Skan  /* This field indicates whether or not the variable may need PHI nodes.
175169689Skan     See the enum's definition for more detailed information about the
176169689Skan     states.  */
177169689Skan  ENUM_BITFIELD (need_phi_state) need_phi_state : 2;
178169689Skan
179169689Skan  /* Used during operand processing to determine if this variable is already
180169689Skan     in the vuse list.  */
181169689Skan  unsigned in_vuse_list : 1;
182169689Skan
183169689Skan  /* Used during operand processing to determine if this variable is already
184169689Skan     in the v_may_def list.  */
185169689Skan  unsigned in_v_may_def_list : 1;
186169689Skan
187169689Skan  /* An artificial variable representing the memory location pointed-to by
188169689Skan     all the pointer symbols that flow-insensitive alias analysis
189169689Skan     (mostly type-based) considers to be aliased.  If the variable is
190169689Skan     not a pointer or if it is never dereferenced, this must be NULL.  */
191169689Skan  tree symbol_mem_tag;
192169689Skan
193169689Skan  /* Variables that may alias this variable.  */
194169689Skan  VEC(tree, gc) *may_aliases;
195169689Skan
196169689Skan  /* Used when going out of SSA form to indicate which partition this
197169689Skan     variable represents storage for.  */
198169689Skan  unsigned partition;
199169689Skan
200169689Skan  /* Used by the root-var object in tree-ssa-live.[ch].  */
201169689Skan  unsigned root_index;
202169689Skan
203169689Skan  /* During into-ssa and the dominator optimizer, this field holds the
204169689Skan     current version of this variable (an SSA_NAME).  */
205169689Skan  tree current_def;
206169689Skan
207169689Skan  /* If this variable is a structure, this fields holds a list of
208169689Skan     symbols representing each of the fields of the structure.  */
209169689Skan  subvar_t subvars;
210169689Skan
211169689Skan  /* Mask of values saying the reasons why this variable has escaped
212169689Skan     the function.  */
213169689Skan  unsigned int escape_mask;
214169689Skan};
215169689Skan
216169689Skanstruct function_ann_d GTY(())
217169689Skan{
218169689Skan  struct tree_ann_common_d common;
219169689Skan
220169689Skan  /* Pointer to the structure that contains the sets of global
221169689Skan     variables modified by function calls.  This field is only used
222169689Skan     for FUNCTION_DECLs.  */
223169689Skan  ipa_reference_vars_info_t GTY ((skip)) reference_vars_info;
224169689Skan};
225169689Skan
226169689Skantypedef struct immediate_use_iterator_d
227169689Skan{
228169689Skan  /* This is the current use the iterator is processing.  */
229169689Skan  ssa_use_operand_t *imm_use;
230169689Skan  /* This marks the last use in the list (use node from SSA_NAME)  */
231169689Skan  ssa_use_operand_t *end_p;
232169689Skan  /* This node is inserted and used to mark the end of the uses for a stmt.  */
233169689Skan  ssa_use_operand_t iter_node;
234169689Skan  /* This is the next ssa_name to visit.  IMM_USE may get removed before
235169689Skan     the next one is traversed to, so it must be cached early.  */
236169689Skan  ssa_use_operand_t *next_imm_name;
237169689Skan} imm_use_iterator;
238169689Skan
239169689Skan
240169689Skan/* Use this iterator when simply looking at stmts.  Adding, deleting or
241169689Skan   modifying stmts will cause this iterator to malfunction.  */
242169689Skan
243169689Skan#define FOR_EACH_IMM_USE_FAST(DEST, ITER, SSAVAR)			\
244169689Skan  for ((DEST) = first_readonly_imm_use (&(ITER), (SSAVAR));	\
245169689Skan       !end_readonly_imm_use_p (&(ITER));			\
246169689Skan       (DEST) = next_readonly_imm_use (&(ITER)))
247169689Skan
248169689Skan/* Use this iterator to visit each stmt which has a use of SSAVAR.  */
249169689Skan
250169689Skan#define FOR_EACH_IMM_USE_STMT(STMT, ITER, SSAVAR)		\
251169689Skan  for ((STMT) = first_imm_use_stmt (&(ITER), (SSAVAR));		\
252169689Skan       !end_imm_use_stmt_p (&(ITER));				\
253169689Skan       (STMT) = next_imm_use_stmt (&(ITER)))
254169689Skan
255169689Skan/* Use this to terminate the FOR_EACH_IMM_USE_STMT loop early.  Failure to
256169689Skan   do so will result in leaving a iterator marker node in the immediate
257169689Skan   use list, and nothing good will come from that.   */
258169689Skan#define BREAK_FROM_IMM_USE_STMT(ITER)				\
259169689Skan   {								\
260169689Skan     end_imm_use_stmt_traverse (&(ITER));			\
261169689Skan     break;							\
262169689Skan   }
263169689Skan
264169689Skan
265169689Skan/* Use this iterator in combination with FOR_EACH_IMM_USE_STMT to
266169689Skan   get access to each occurrence of ssavar on the stmt returned by
267169689Skan   that iterator..  for instance:
268169689Skan
269169689Skan     FOR_EACH_IMM_USE_STMT (stmt, iter, var)
270169689Skan       {
271169689Skan         FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
272169689Skan	   {
273169689Skan	     SET_USE (use_p) = blah;
274169689Skan	   }
275169689Skan	 update_stmt (stmt);
276169689Skan       }							 */
277169689Skan
278169689Skan#define FOR_EACH_IMM_USE_ON_STMT(DEST, ITER)			\
279169689Skan  for ((DEST) = first_imm_use_on_stmt (&(ITER));		\
280169689Skan       !end_imm_use_on_stmt_p (&(ITER));			\
281169689Skan       (DEST) = next_imm_use_on_stmt (&(ITER)))
282169689Skan
283169689Skan
284169689Skan
285169689Skanstruct stmt_ann_d GTY(())
286169689Skan{
287169689Skan  struct tree_ann_common_d common;
288169689Skan
289169689Skan  /* Nonzero if the statement has been modified (meaning that the operands
290169689Skan     need to be scanned again).  */
291169689Skan  unsigned modified : 1;
292169689Skan
293169689Skan  /* Nonzero if the statement makes references to volatile storage.  */
294169689Skan  unsigned has_volatile_ops : 1;
295169689Skan
296169689Skan  /* Nonzero if the statement makes a function call that may clobber global
297169689Skan     and local addressable variables.  */
298169689Skan  unsigned makes_clobbering_call : 1;
299169689Skan
300169689Skan  /* Basic block that contains this statement.  */
301169689Skan  basic_block bb;
302169689Skan
303169689Skan  /* Operand cache for stmt.  */
304169689Skan  struct stmt_operands_d GTY ((skip (""))) operands;
305169689Skan
306169689Skan  /* Set of variables that have had their address taken in the statement.  */
307169689Skan  bitmap addresses_taken;
308169689Skan
309169689Skan  /* Unique identifier for this statement.  These ID's are to be created
310169689Skan     by each pass on an as-needed basis in any order convenient for the
311169689Skan     pass which needs statement UIDs.  */
312169689Skan  unsigned int uid;
313169689Skan
314169689Skan  /* Linked list of histograms for value-based profiling.  This is really a
315169689Skan     struct histogram_value*.  We use void* to avoid having to export that
316169689Skan     everywhere, and to avoid having to put it in GC memory.  */
317169689Skan
318169689Skan  void * GTY ((skip (""))) histograms;
319169689Skan};
320169689Skan
321169689Skanunion tree_ann_d GTY((desc ("ann_type ((tree_ann_t)&%h)")))
322169689Skan{
323169689Skan  struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
324169689Skan  struct var_ann_d GTY((tag ("VAR_ANN"))) vdecl;
325169689Skan  struct function_ann_d GTY((tag ("FUNCTION_ANN"))) fdecl;
326169689Skan  struct stmt_ann_d GTY((tag ("STMT_ANN"))) stmt;
327169689Skan};
328169689Skan
329169689Skanextern GTY(()) VEC(tree,gc) *modified_noreturn_calls;
330169689Skan
331169689Skantypedef union tree_ann_d *tree_ann_t;
332169689Skantypedef struct var_ann_d *var_ann_t;
333169689Skantypedef struct function_ann_d *function_ann_t;
334169689Skantypedef struct stmt_ann_d *stmt_ann_t;
335169689Skantypedef struct tree_ann_common_d *tree_ann_common_t;
336169689Skan
337169689Skanstatic inline tree_ann_common_t tree_common_ann (tree);
338169689Skanstatic inline tree_ann_common_t get_tree_common_ann (tree);
339169689Skanstatic inline var_ann_t var_ann (tree);
340169689Skanstatic inline var_ann_t get_var_ann (tree);
341169689Skanstatic inline function_ann_t function_ann (tree);
342169689Skanstatic inline function_ann_t get_function_ann (tree);
343169689Skanstatic inline stmt_ann_t stmt_ann (tree);
344169689Skanstatic inline stmt_ann_t get_stmt_ann (tree);
345169689Skanstatic inline enum tree_ann_type ann_type (tree_ann_t);
346169689Skanstatic inline basic_block bb_for_stmt (tree);
347169689Skanextern void set_bb_for_stmt (tree, basic_block);
348169689Skanstatic inline bool noreturn_call_p (tree);
349169689Skanstatic inline void update_stmt (tree);
350169689Skanstatic inline bool stmt_modified_p (tree);
351169689Skanstatic inline VEC(tree, gc) *may_aliases (tree);
352169689Skanstatic inline int get_lineno (tree);
353169689Skanstatic inline const char *get_filename (tree);
354169689Skanstatic inline bool is_exec_stmt (tree);
355169689Skanstatic inline bool is_label_stmt (tree);
356169689Skanstatic inline bitmap addresses_taken (tree);
357169689Skan
358169689Skan/*---------------------------------------------------------------------------
359169689Skan                  Structure representing predictions in tree level.
360169689Skan---------------------------------------------------------------------------*/
361169689Skanstruct edge_prediction GTY((chain_next ("%h.ep_next")))
362169689Skan{
363169689Skan  struct edge_prediction *ep_next;
364169689Skan  edge ep_edge;
365169689Skan  enum br_predictor ep_predictor;
366169689Skan  int ep_probability;
367169689Skan};
368169689Skan
369169689Skan/* Accessors for basic block annotations.  */
370169689Skanstatic inline tree phi_nodes (basic_block);
371169689Skanstatic inline void set_phi_nodes (basic_block, tree);
372169689Skan
373169689Skan/*---------------------------------------------------------------------------
374169689Skan			      Global declarations
375169689Skan---------------------------------------------------------------------------*/
376169689Skanstruct int_tree_map GTY(())
377169689Skan{
378169689Skan
379169689Skan  unsigned int uid;
380169689Skan  tree to;
381169689Skan};
382169689Skan
383169689Skanextern unsigned int int_tree_map_hash (const void *);
384169689Skanextern int int_tree_map_eq (const void *, const void *);
385169689Skan
386169689Skantypedef struct
387169689Skan{
388169689Skan  htab_iterator hti;
389169689Skan} referenced_var_iterator;
390169689Skan
391169689Skan
392169689Skan/* This macro loops over all the referenced vars, one at a time, putting the
393169689Skan   current var in VAR.  Note:  You are not allowed to add referenced variables
394169689Skan   to the hashtable while using this macro.  Doing so may cause it to behave
395169689Skan   erratically.  */
396169689Skan
397169689Skan#define FOR_EACH_REFERENCED_VAR(VAR, ITER) \
398169689Skan  for ((VAR) = first_referenced_var (&(ITER)); \
399169689Skan       !end_referenced_vars_p (&(ITER)); \
400169689Skan       (VAR) = next_referenced_var (&(ITER)))
401169689Skan
402169689Skan
403169689Skantypedef struct
404169689Skan{
405169689Skan  int i;
406169689Skan} safe_referenced_var_iterator;
407169689Skan
408169689Skan/* This macro loops over all the referenced vars, one at a time, putting the
409169689Skan   current var in VAR.  You are allowed to add referenced variables during the
410169689Skan   execution of this macro, however, the macro will not iterate over them.  It
411169689Skan   requires a temporary vector of trees, VEC, whose lifetime is controlled by
412169689Skan   the caller.  The purpose of the vector is to temporarily store the
413169689Skan   referenced_variables hashtable so that adding referenced variables does not
414169689Skan   affect the hashtable.  */
415169689Skan
416169689Skan#define FOR_EACH_REFERENCED_VAR_SAFE(VAR, VEC, ITER) \
417169689Skan  for ((ITER).i = 0, fill_referenced_var_vec (&(VEC)); \
418169689Skan       VEC_iterate (tree, (VEC), (ITER).i, (VAR)); \
419169689Skan       (ITER).i++)
420169689Skan
421169689Skan/* Array of all variables referenced in the function.  */
422169689Skanextern GTY((param_is (struct int_tree_map))) htab_t referenced_vars;
423169689Skan
424169689Skan/* Default defs for undefined symbols. */
425169689Skanextern GTY((param_is (struct int_tree_map))) htab_t default_defs;
426169689Skan
427169689Skanextern tree referenced_var_lookup (unsigned int);
428169689Skanextern bool referenced_var_check_and_insert (tree);
429169689Skan#define num_referenced_vars htab_elements (referenced_vars)
430169689Skan#define referenced_var(i) referenced_var_lookup (i)
431169689Skan
432169689Skan/* Array of all SSA_NAMEs used in the function.  */
433169689Skanextern GTY(()) VEC(tree,gc) *ssa_names;
434169689Skan
435169689Skan#define num_ssa_names (VEC_length (tree, ssa_names))
436169689Skan#define ssa_name(i) (VEC_index (tree, ssa_names, (i)))
437169689Skan
438169689Skan/* Artificial variable used to model the effects of function calls.  */
439169689Skanextern GTY(()) tree global_var;
440169689Skan
441169689Skan/* Artificial variable used to model the effects of nonlocal
442169689Skan   variables.  */
443169689Skanextern GTY(()) tree nonlocal_all;
444169689Skan
445169689Skan/* Call clobbered variables in the function.  If bit I is set, then
446169689Skan   REFERENCED_VARS (I) is call-clobbered.  */
447169689Skanextern bitmap call_clobbered_vars;
448169689Skan
449169689Skan/* Addressable variables in the function.  If bit I is set, then
450169689Skan   REFERENCED_VARS (I) has had its address taken.  */
451169689Skanextern bitmap addressable_vars;
452169689Skan
453169689Skan/* 'true' after aliases have been computed (see compute_may_aliases).  */
454169689Skanextern bool aliases_computed_p;
455169689Skan
456169689Skan/* Macros for showing usage statistics.  */
457169689Skan#define SCALE(x) ((unsigned long) ((x) < 1024*10	\
458169689Skan		  ? (x)					\
459169689Skan		  : ((x) < 1024*1024*10			\
460169689Skan		     ? (x) / 1024			\
461169689Skan		     : (x) / (1024*1024))))
462169689Skan
463169689Skan#define LABEL(x) ((x) < 1024*10 ? 'b' : ((x) < 1024*1024*10 ? 'k' : 'M'))
464169689Skan
465169689Skan#define PERCENT(x,y) ((float)(x) * 100.0 / (float)(y))
466169689Skan
467169689Skan/*---------------------------------------------------------------------------
468169689Skan			      Block iterators
469169689Skan---------------------------------------------------------------------------*/
470169689Skan
471169689Skantypedef struct {
472169689Skan  tree_stmt_iterator tsi;
473169689Skan  basic_block bb;
474169689Skan} block_stmt_iterator;
475169689Skan
476169689Skanstatic inline block_stmt_iterator bsi_start (basic_block);
477169689Skanstatic inline block_stmt_iterator bsi_last (basic_block);
478169689Skanstatic inline block_stmt_iterator bsi_after_labels (basic_block);
479169689Skanblock_stmt_iterator bsi_for_stmt (tree);
480169689Skanstatic inline bool bsi_end_p (block_stmt_iterator);
481169689Skanstatic inline void bsi_next (block_stmt_iterator *);
482169689Skanstatic inline void bsi_prev (block_stmt_iterator *);
483169689Skanstatic inline tree bsi_stmt (block_stmt_iterator);
484169689Skanstatic inline tree * bsi_stmt_ptr (block_stmt_iterator);
485169689Skan
486169689Skanextern void bsi_remove (block_stmt_iterator *, bool);
487169689Skanextern void bsi_move_before (block_stmt_iterator *, block_stmt_iterator *);
488169689Skanextern void bsi_move_after (block_stmt_iterator *, block_stmt_iterator *);
489169689Skanextern void bsi_move_to_bb_end (block_stmt_iterator *, basic_block);
490169689Skan
491169689Skanenum bsi_iterator_update
492169689Skan{
493169689Skan  /* Note that these are intentionally in the same order as TSI_FOO.  They
494169689Skan     mean exactly the same as their TSI_* counterparts.  */
495169689Skan  BSI_NEW_STMT,
496169689Skan  BSI_SAME_STMT,
497169689Skan  BSI_CHAIN_START,
498169689Skan  BSI_CHAIN_END,
499169689Skan  BSI_CONTINUE_LINKING
500169689Skan};
501169689Skan
502169689Skanextern void bsi_insert_before (block_stmt_iterator *, tree,
503169689Skan			       enum bsi_iterator_update);
504169689Skanextern void bsi_insert_after (block_stmt_iterator *, tree,
505169689Skan			      enum bsi_iterator_update);
506169689Skan
507169689Skanextern void bsi_replace (const block_stmt_iterator *, tree, bool);
508169689Skan
509169689Skan/*---------------------------------------------------------------------------
510169689Skan			      OpenMP Region Tree
511169689Skan---------------------------------------------------------------------------*/
512169689Skan
513169689Skan/* Parallel region information.  Every parallel and workshare
514169689Skan   directive is enclosed between two markers, the OMP_* directive
515169689Skan   and a corresponding OMP_RETURN statement.  */
516169689Skan
517169689Skanstruct omp_region
518169689Skan{
519169689Skan  /* The enclosing region.  */
520169689Skan  struct omp_region *outer;
521169689Skan
522169689Skan  /* First child region.  */
523169689Skan  struct omp_region *inner;
524169689Skan
525169689Skan  /* Next peer region.  */
526169689Skan  struct omp_region *next;
527169689Skan
528169689Skan  /* Block containing the omp directive as its last stmt.  */
529169689Skan  basic_block entry;
530169689Skan
531169689Skan  /* Block containing the OMP_RETURN as its last stmt.  */
532169689Skan  basic_block exit;
533169689Skan
534169689Skan  /* Block containing the OMP_CONTINUE as its last stmt.  */
535169689Skan  basic_block cont;
536169689Skan
537169689Skan  /* If this is a combined parallel+workshare region, this is a list
538169689Skan     of additional arguments needed by the combined parallel+workshare
539169689Skan     library call.  */
540169689Skan  tree ws_args;
541169689Skan
542169689Skan  /* The code for the omp directive of this region.  */
543169689Skan  enum tree_code type;
544169689Skan
545169689Skan  /* Schedule kind, only used for OMP_FOR type regions.  */
546169689Skan  enum omp_clause_schedule_kind sched_kind;
547169689Skan
548169689Skan  /* True if this is a combined parallel+workshare region.  */
549169689Skan  bool is_combined_parallel;
550169689Skan};
551169689Skan
552169689Skanextern struct omp_region *root_omp_region;
553169689Skanextern struct omp_region *new_omp_region (basic_block, enum tree_code,
554169689Skan					  struct omp_region *);
555169689Skanextern void free_omp_regions (void);
556169689Skan
557169689Skan/*---------------------------------------------------------------------------
558169689Skan			      Function prototypes
559169689Skan---------------------------------------------------------------------------*/
560169689Skan/* In tree-cfg.c  */
561169689Skan
562169689Skan/* Location to track pending stmt for edge insertion.  */
563169689Skan#define PENDING_STMT(e)	((e)->insns.t)
564169689Skan
565169689Skanextern void delete_tree_cfg_annotations (void);
566169689Skanextern void disband_implicit_edges (void);
567169689Skanextern bool stmt_ends_bb_p (tree);
568169689Skanextern bool is_ctrl_stmt (tree);
569169689Skanextern bool is_ctrl_altering_stmt (tree);
570169689Skanextern bool computed_goto_p (tree);
571169689Skanextern bool simple_goto_p (tree);
572169689Skanextern bool tree_can_make_abnormal_goto (tree);
573169689Skanextern basic_block single_noncomplex_succ (basic_block bb);
574169689Skanextern void tree_dump_bb (basic_block, FILE *, int);
575169689Skanextern void debug_tree_bb (basic_block);
576169689Skanextern basic_block debug_tree_bb_n (int);
577169689Skanextern void dump_tree_cfg (FILE *, int);
578169689Skanextern void debug_tree_cfg (int);
579169689Skanextern void dump_cfg_stats (FILE *);
580169689Skanextern void debug_cfg_stats (void);
581169689Skanextern void debug_loop_ir (void);
582169689Skanextern void print_loop_ir (FILE *);
583169689Skanextern void cleanup_dead_labels (void);
584169689Skanextern void group_case_labels (void);
585169689Skanextern tree first_stmt (basic_block);
586169689Skanextern tree last_stmt (basic_block);
587169689Skanextern tree *last_stmt_ptr (basic_block);
588169689Skanextern tree last_and_only_stmt (basic_block);
589169689Skanextern edge find_taken_edge (basic_block, tree);
590169689Skanextern basic_block label_to_block_fn (struct function *, tree);
591169689Skan#define label_to_block(t) (label_to_block_fn (cfun, t))
592169689Skanextern void bsi_insert_on_edge (edge, tree);
593169689Skanextern basic_block bsi_insert_on_edge_immediate (edge, tree);
594169689Skanextern void bsi_commit_one_edge_insert (edge, basic_block *);
595169689Skanextern void bsi_commit_edge_inserts (void);
596169689Skanextern void notice_special_calls (tree);
597169689Skanextern void clear_special_calls (void);
598169689Skanextern void verify_stmts (void);
599169689Skanextern tree tree_block_label (basic_block);
600169689Skanextern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
601169689Skanextern bool tree_duplicate_sese_region (edge, edge, basic_block *, unsigned,
602169689Skan					basic_block *);
603169689Skanextern void add_phi_args_after_copy_bb (basic_block);
604169689Skanextern void add_phi_args_after_copy (basic_block *, unsigned);
605169689Skanextern bool tree_purge_dead_abnormal_call_edges (basic_block);
606169689Skanextern bool tree_purge_dead_eh_edges (basic_block);
607169689Skanextern bool tree_purge_all_dead_eh_edges (bitmap);
608169689Skanextern tree gimplify_val (block_stmt_iterator *, tree, tree);
609169689Skanextern tree gimplify_build1 (block_stmt_iterator *, enum tree_code,
610169689Skan			     tree, tree);
611169689Skanextern tree gimplify_build2 (block_stmt_iterator *, enum tree_code,
612169689Skan			     tree, tree, tree);
613169689Skanextern tree gimplify_build3 (block_stmt_iterator *, enum tree_code,
614169689Skan			     tree, tree, tree, tree);
615169689Skanextern void init_empty_tree_cfg (void);
616169689Skanextern void fold_cond_expr_cond (void);
617169689Skanextern void make_abnormal_goto_edges (basic_block, bool);
618169689Skanextern void replace_uses_by (tree, tree);
619169689Skanextern void start_recording_case_labels (void);
620169689Skanextern void end_recording_case_labels (void);
621169689Skanextern basic_block move_sese_region_to_fn (struct function *, basic_block,
622169689Skan				           basic_block);
623169689Skan
624169689Skan/* In tree-cfgcleanup.c  */
625169689Skanextern bool cleanup_tree_cfg (void);
626169689Skanextern void cleanup_tree_cfg_loop (void);
627169689Skan
628169689Skan/* In tree-pretty-print.c.  */
629169689Skanextern void dump_generic_bb (FILE *, basic_block, int, int);
630169689Skan
631169689Skan/* In tree-dfa.c  */
632169689Skanextern var_ann_t create_var_ann (tree);
633169689Skanextern function_ann_t create_function_ann (tree);
634169689Skanextern stmt_ann_t create_stmt_ann (tree);
635169689Skanextern tree_ann_common_t create_tree_common_ann (tree);
636169689Skanextern void dump_dfa_stats (FILE *);
637169689Skanextern void debug_dfa_stats (void);
638169689Skanextern void debug_referenced_vars (void);
639169689Skanextern void dump_referenced_vars (FILE *);
640169689Skanextern void dump_variable (FILE *, tree);
641169689Skanextern void debug_variable (tree);
642169689Skanextern void dump_subvars_for (FILE *, tree);
643169689Skanextern void debug_subvars_for (tree);
644169689Skanextern tree get_virtual_var (tree);
645169689Skanextern void add_referenced_var (tree);
646169689Skanextern void mark_new_vars_to_rename (tree);
647169689Skanextern void find_new_referenced_vars (tree *);
648169689Skan
649169689Skanextern tree make_rename_temp (tree, const char *);
650169689Skanextern void set_default_def (tree, tree);
651169689Skanextern tree default_def (tree);
652169689Skanextern tree default_def_fn (struct function *, tree);
653169689Skan
654169689Skan/* In tree-phinodes.c  */
655169689Skanextern void reserve_phi_args_for_new_edge (basic_block);
656169689Skanextern tree create_phi_node (tree, basic_block);
657169689Skanextern void add_phi_arg (tree, tree, edge);
658169689Skanextern void remove_phi_args (edge);
659169689Skanextern void remove_phi_node (tree, tree);
660169689Skanextern tree phi_reverse (tree);
661169689Skan
662169689Skan/* In gimple-low.c  */
663169689Skanextern void record_vars_into (tree, tree);
664169689Skanextern void record_vars (tree);
665169689Skanextern bool block_may_fallthru (tree);
666169689Skan
667169689Skan/* In tree-ssa-alias.c  */
668169689Skanextern void dump_may_aliases_for (FILE *, tree);
669169689Skanextern void debug_may_aliases_for (tree);
670169689Skanextern void dump_alias_info (FILE *);
671169689Skanextern void debug_alias_info (void);
672169689Skanextern void dump_points_to_info (FILE *);
673169689Skanextern void debug_points_to_info (void);
674169689Skanextern void dump_points_to_info_for (FILE *, tree);
675169689Skanextern void debug_points_to_info_for (tree);
676169689Skanextern bool may_be_aliased (tree);
677169689Skanextern bool is_aliased_with (tree, tree);
678169689Skanextern bool may_aliases_intersect (tree, tree);
679169689Skanextern struct ptr_info_def *get_ptr_info (tree);
680169689Skanextern void new_type_alias (tree, tree, tree);
681169689Skanextern void count_uses_and_derefs (tree, tree, unsigned *, unsigned *, bool *);
682169689Skanstatic inline subvar_t get_subvars_for_var (tree);
683169689Skanstatic inline tree get_subvar_at (tree, unsigned HOST_WIDE_INT);
684169689Skanstatic inline bool ref_contains_array_ref (tree);
685169689Skanstatic inline bool array_ref_contains_indirect_ref (tree);
686169689Skanextern tree get_ref_base_and_extent (tree, HOST_WIDE_INT *,
687169689Skan				     HOST_WIDE_INT *, HOST_WIDE_INT *);
688169689Skanstatic inline bool var_can_have_subvars (tree);
689169689Skanstatic inline bool overlap_subvar (unsigned HOST_WIDE_INT,
690169689Skan				   unsigned HOST_WIDE_INT,
691169689Skan				   tree, bool *);
692169689Skan
693169689Skan/* Call-back function for walk_use_def_chains().  At each reaching
694169689Skan   definition, a function with this prototype is called.  */
695169689Skantypedef bool (*walk_use_def_chains_fn) (tree, tree, void *);
696169689Skan
697259405Spfg/* In tree-ssa-alias-warnings.c  */
698259405Spfgextern void strict_aliasing_warning_backend (void);
699169689Skan
700169689Skan/* In tree-ssa.c  */
701169689Skanextern void init_tree_ssa (void);
702169689Skanextern edge ssa_redirect_edge (edge, basic_block);
703169689Skanextern void flush_pending_stmts (edge);
704169689Skanextern bool tree_ssa_useless_type_conversion (tree);
705169689Skanextern bool tree_ssa_useless_type_conversion_1 (tree, tree);
706169689Skanextern void verify_ssa (bool);
707169689Skanextern void delete_tree_ssa (void);
708169689Skanextern void register_new_def (tree, VEC(tree,heap) **);
709169689Skanextern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
710169689Skanextern bool stmt_references_memory_p (tree);
711169689Skan
712169689Skan/* In tree-into-ssa.c  */
713169689Skanvoid update_ssa (unsigned);
714169689Skanvoid delete_update_ssa (void);
715169689Skanvoid register_new_name_mapping (tree, tree);
716169689Skantree create_new_def_for (tree, tree, def_operand_p);
717169689Skanbool need_ssa_update_p (void);
718169689Skanbool name_registered_for_update_p (tree);
719169689Skanbitmap ssa_names_to_replace (void);
720169689Skanvoid release_ssa_name_after_update_ssa (tree name);
721169689Skanvoid compute_global_livein (bitmap, bitmap);
722169689Skantree duplicate_ssa_name (tree, tree);
723169689Skanvoid mark_sym_for_renaming (tree);
724169689Skanvoid mark_set_for_renaming (bitmap);
725169689Skantree get_current_def (tree);
726169689Skanvoid set_current_def (tree, tree);
727169689Skan
728169689Skan/* In tree-ssa-ccp.c  */
729169689Skanbool fold_stmt (tree *);
730169689Skanbool fold_stmt_inplace (tree);
731169689Skantree widen_bitfield (tree, tree, tree);
732169689Skan
733169689Skan/* In tree-vrp.c  */
734169689Skantree vrp_evaluate_conditional (tree, tree);
735169689Skanvoid simplify_stmt_using_ranges (tree);
736169689Skan
737169689Skan/* In tree-ssa-dom.c  */
738169689Skanextern void dump_dominator_optimization_stats (FILE *);
739169689Skanextern void debug_dominator_optimization_stats (void);
740169689Skanint loop_depth_of_name (tree);
741169689Skan
742169689Skan/* In tree-ssa-copy.c  */
743169689Skanextern void merge_alias_info (tree, tree);
744169689Skanextern void propagate_value (use_operand_p, tree);
745169689Skanextern void propagate_tree_value (tree *, tree);
746169689Skanextern void replace_exp (use_operand_p, tree);
747169689Skanextern bool may_propagate_copy (tree, tree);
748169689Skanextern bool may_propagate_copy_into_asm (tree);
749169689Skan
750169689Skan/* Affine iv.  */
751169689Skan
752169689Skantypedef struct
753169689Skan{
754169689Skan  /* Iv = BASE + STEP * i.  */
755169689Skan  tree base, step;
756169689Skan
757169689Skan  /* True if this iv does not overflow.  */
758169689Skan  bool no_overflow;
759169689Skan} affine_iv;
760169689Skan
761169689Skan/* Description of number of iterations of a loop.  All the expressions inside
762169689Skan   the structure can be evaluated at the end of the loop's preheader
763169689Skan   (and due to ssa form, also anywhere inside the body of the loop).  */
764169689Skan
765169689Skanstruct tree_niter_desc
766169689Skan{
767169689Skan  tree assumptions;	/* The boolean expression.  If this expression evaluates
768169689Skan			   to false, then the other fields in this structure
769169689Skan			   should not be used; there is no guarantee that they
770169689Skan			   will be correct.  */
771169689Skan  tree may_be_zero;	/* The boolean expression.  If it evaluates to true,
772169689Skan			   the loop will exit in the first iteration (i.e.
773169689Skan			   its latch will not be executed), even if the niter
774169689Skan			   field says otherwise.  */
775169689Skan  tree niter;		/* The expression giving the number of iterations of
776169689Skan			   a loop (provided that assumptions == true and
777169689Skan			   may_be_zero == false), more precisely the number
778169689Skan			   of executions of the latch of the loop.  */
779169689Skan  tree additional_info;	/* The boolean expression.  Sometimes we use additional
780169689Skan			   knowledge to simplify the other expressions
781169689Skan			   contained in this structure (for example the
782169689Skan			   knowledge about value ranges of operands on entry to
783169689Skan			   the loop).  If this is a case, conjunction of such
784169689Skan			   condition is stored in this field, so that we do not
785169689Skan			   lose the information: for example if may_be_zero
786169689Skan			   is (n <= 0) and niter is (unsigned) n, we know
787169689Skan			   that the number of iterations is at most
788169689Skan			   MAX_SIGNED_INT.  However if the (n <= 0) assumption
789169689Skan			   is eliminated (by looking at the guard on entry of
790169689Skan			   the loop), then the information would be lost.  */
791169689Skan
792169689Skan  /* The simplified shape of the exit condition.  The loop exits if
793169689Skan     CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
794169689Skan     LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
795169689Skan     LE_EXPR and negative if CMP is GE_EXPR.  This information is used
796169689Skan     by loop unrolling.  */
797169689Skan  affine_iv control;
798169689Skan  tree bound;
799169689Skan  enum tree_code cmp;
800169689Skan};
801169689Skan
802169689Skan/* In tree-vectorizer.c */
803169689Skanvoid vectorize_loops (struct loops *);
804169689Skanextern bool vect_can_force_dr_alignment_p (tree, unsigned int);
805169689Skanextern tree get_vectype_for_scalar_type (tree);
806169689Skan
807169689Skan/* In tree-ssa-phiopt.c */
808169689Skanbool empty_block_p (basic_block);
809169689Skan
810169689Skan/* In tree-ssa-loop*.c  */
811169689Skan
812169689Skanvoid tree_ssa_lim (struct loops *);
813169689Skanunsigned int tree_ssa_unswitch_loops (struct loops *);
814169689Skanunsigned int canonicalize_induction_variables (struct loops *);
815169689Skanunsigned int tree_unroll_loops_completely (struct loops *, bool);
816169689Skanunsigned int tree_ssa_prefetch_arrays (struct loops *);
817169689Skanunsigned int remove_empty_loops (struct loops *);
818169689Skanvoid tree_ssa_iv_optimize (struct loops *);
819169689Skan
820169689Skanbool number_of_iterations_exit (struct loop *, edge,
821169689Skan				struct tree_niter_desc *niter, bool);
822169689Skantree find_loop_niter (struct loop *, edge *);
823169689Skantree loop_niter_by_eval (struct loop *, edge);
824169689Skantree find_loop_niter_by_eval (struct loop *, edge *);
825169689Skanvoid estimate_numbers_of_iterations (struct loops *);
826169689Skanbool scev_probably_wraps_p (tree, tree, tree, struct loop *, bool);
827169689Skanbool convert_affine_scev (struct loop *, tree, tree *, tree *, tree, bool);
828169689Skan
829169689Skanbool nowrap_type_p (tree);
830169689Skanenum ev_direction {EV_DIR_GROWS, EV_DIR_DECREASES, EV_DIR_UNKNOWN};
831169689Skanenum ev_direction scev_direction (tree);
832169689Skan
833169689Skanvoid free_numbers_of_iterations_estimates (struct loops *);
834169689Skanvoid free_numbers_of_iterations_estimates_loop (struct loop *);
835169689Skanvoid rewrite_into_loop_closed_ssa (bitmap, unsigned);
836169689Skanvoid verify_loop_closed_ssa (void);
837169689Skanvoid loop_commit_inserts (void);
838169689Skanbool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
839169689Skanvoid create_iv (tree, tree, tree, struct loop *, block_stmt_iterator *, bool,
840169689Skan		tree *, tree *);
841169689Skanvoid split_loop_exit_edge (edge);
842169689Skanunsigned force_expr_to_var_cost (tree);
843169689Skanbasic_block bsi_insert_on_edge_immediate_loop (edge, tree);
844169689Skanvoid standard_iv_increment_position (struct loop *, block_stmt_iterator *,
845169689Skan				     bool *);
846169689Skanbasic_block ip_end_pos (struct loop *);
847169689Skanbasic_block ip_normal_pos (struct loop *);
848169689Skanbool tree_duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
849169689Skan					 unsigned int, sbitmap,
850169689Skan					 edge, edge *,
851169689Skan					 unsigned int *, int);
852169689Skanstruct loop *tree_ssa_loop_version (struct loops *, struct loop *, tree,
853169689Skan				    basic_block *);
854169689Skantree expand_simple_operations (tree);
855169689Skanvoid substitute_in_loop_info (struct loop *, tree, tree);
856169689Skanedge single_dom_exit (struct loop *);
857169689Skanbool can_unroll_loop_p (struct loop *loop, unsigned factor,
858169689Skan			struct tree_niter_desc *niter);
859169689Skanvoid tree_unroll_loop (struct loops *, struct loop *, unsigned,
860169689Skan		       edge, struct tree_niter_desc *);
861169689Skanbool contains_abnormal_ssa_name_p (tree);
862169689Skan
863169689Skan/* In tree-ssa-threadedge.c */
864169689Skanextern bool potentially_threadable_block (basic_block);
865169689Skanextern void thread_across_edge (tree, edge, bool,
866169689Skan				VEC(tree, heap) **, tree (*) (tree, tree));
867169689Skan
868169689Skan/* In tree-ssa-loop-im.c  */
869169689Skan/* The possibilities of statement movement.  */
870169689Skan
871169689Skanenum move_pos
872169689Skan  {
873169689Skan    MOVE_IMPOSSIBLE,		/* No movement -- side effect expression.  */
874169689Skan    MOVE_PRESERVE_EXECUTION,	/* Must not cause the non-executed statement
875169689Skan				   become executed -- memory accesses, ... */
876169689Skan    MOVE_POSSIBLE		/* Unlimited movement.  */
877169689Skan  };
878169689Skanextern enum move_pos movement_possibility (tree);
879169689Skan
880169689Skan/* The reasons a variable may escape a function.  */
881169689Skanenum escape_type
882169689Skan  {
883169689Skan    NO_ESCAPE = 0, /* Doesn't escape.  */
884169689Skan    ESCAPE_STORED_IN_GLOBAL = 1 << 1,
885169689Skan    ESCAPE_TO_ASM = 1 << 2,  /* Passed by address to an assembly
886169689Skan				statement.  */
887169689Skan    ESCAPE_TO_CALL = 1 << 3,  /* Escapes to a function call.  */
888169689Skan    ESCAPE_BAD_CAST = 1 << 4, /* Cast from pointer to integer */
889169689Skan    ESCAPE_TO_RETURN = 1 << 5, /* Returned from function.  */
890169689Skan    ESCAPE_TO_PURE_CONST = 1 << 6, /* Escapes to a pure or constant
891169689Skan				      function call.  */
892169689Skan    ESCAPE_IS_GLOBAL = 1 << 7,  /* Is a global variable.  */
893169689Skan    ESCAPE_IS_PARM = 1 << 8, /* Is an incoming function parameter.  */
894169689Skan    ESCAPE_UNKNOWN = 1 << 9 /* We believe it escapes for some reason
895169689Skan			       not enumerated above.  */
896169689Skan  };
897169689Skan
898169689Skan/* In tree-flow-inline.h  */
899169689Skanstatic inline bool is_call_clobbered (tree);
900169689Skanstatic inline void mark_call_clobbered (tree, unsigned int);
901169689Skanstatic inline void set_is_used (tree);
902169689Skanstatic inline bool unmodifiable_var_p (tree);
903169689Skan
904169689Skan/* In tree-eh.c  */
905169689Skanextern void make_eh_edges (tree);
906169689Skanextern bool tree_could_trap_p (tree);
907169689Skanextern bool tree_could_throw_p (tree);
908169689Skanextern bool tree_can_throw_internal (tree);
909169689Skanextern bool tree_can_throw_external (tree);
910169689Skanextern int lookup_stmt_eh_region (tree);
911169689Skanextern void add_stmt_to_eh_region (tree, int);
912169689Skanextern bool remove_stmt_from_eh_region (tree);
913169689Skanextern bool maybe_clean_or_replace_eh_stmt (tree, tree);
914169689Skan
915169689Skan/* In tree-ssa-pre.c  */
916169689Skanvoid add_to_value (tree, tree);
917169689Skanvoid debug_value_expressions (tree);
918169689Skanvoid print_value_expressions (FILE *, tree);
919169689Skan
920169689Skan
921169689Skan/* In tree-vn.c  */
922169689Skanbool expressions_equal_p (tree, tree);
923169689Skantree get_value_handle (tree);
924169689Skanhashval_t vn_compute (tree, hashval_t);
925169689Skanvoid sort_vuses (VEC (tree, gc) *);
926169689Skantree vn_lookup_or_add (tree, tree);
927169689Skantree vn_lookup_or_add_with_vuses (tree, VEC (tree, gc) *);
928169689Skanvoid vn_add (tree, tree);
929169689Skanvoid vn_add_with_vuses (tree, tree, VEC (tree, gc) *);
930169689Skantree vn_lookup (tree, tree);
931169689Skantree vn_lookup_with_vuses (tree, VEC (tree, gc) *);
932169689Skanvoid vn_init (void);
933169689Skanvoid vn_delete (void);
934169689Skan
935169689Skan/* In tree-ssa-sink.c  */
936169689Skanbool is_hidden_global_store (tree);
937169689Skan
938169689Skan/* In tree-sra.c  */
939169689Skanvoid insert_edge_copies (tree, basic_block);
940169689Skanvoid sra_insert_before (block_stmt_iterator *, tree);
941169689Skanvoid sra_insert_after (block_stmt_iterator *, tree);
942169689Skanvoid sra_init_cache (void);
943169689Skanbool sra_type_can_be_decomposed_p (tree);
944169689Skan
945169689Skan/* In tree-loop-linear.c  */
946169689Skanextern void linear_transform_loops (struct loops *);
947169689Skan
948169689Skan/* In tree-ssa-loop-ivopts.c  */
949169689Skanbool expr_invariant_in_loop_p (struct loop *, tree);
950169689Skanbool multiplier_allowed_in_address_p (HOST_WIDE_INT);
951169689Skanunsigned multiply_by_cost (HOST_WIDE_INT, enum machine_mode);
952169689Skan
953169689Skan/* In tree-ssa-threadupdate.c.  */
954169689Skanextern bool thread_through_all_blocks (void);
955169689Skanextern void register_jump_thread (edge, edge);
956169689Skan
957169689Skan/* In gimplify.c  */
958169689Skantree force_gimple_operand (tree, tree *, bool, tree);
959169689Skantree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree);
960169689Skan
961169689Skan/* In tree-ssa-structalias.c */
962169689Skanbool find_what_p_points_to (tree);
963169689Skan
964169689Skan/* In tree-ssa-live.c */
965169689Skanextern void remove_unused_locals (void);
966169689Skan
967169689Skan/* In tree-ssa-address.c  */
968169689Skan
969169689Skan/* Affine combination of trees.  We keep track of at most MAX_AFF_ELTS elements
970169689Skan   to make things simpler; this is sufficient in most cases.  */
971169689Skan
972169689Skan#define MAX_AFF_ELTS 8
973169689Skan
974169689Skanstruct affine_tree_combination
975169689Skan{
976169689Skan  /* Type of the result of the combination.  */
977169689Skan  tree type;
978169689Skan
979169689Skan  /* Mask modulo that the operations are performed.  */
980169689Skan  unsigned HOST_WIDE_INT mask;
981169689Skan
982169689Skan  /* Constant offset.  */
983169689Skan  unsigned HOST_WIDE_INT offset;
984169689Skan
985169689Skan  /* Number of elements of the combination.  */
986169689Skan  unsigned n;
987169689Skan
988169689Skan  /* Elements and their coefficients.  */
989169689Skan  tree elts[MAX_AFF_ELTS];
990169689Skan  unsigned HOST_WIDE_INT coefs[MAX_AFF_ELTS];
991169689Skan
992169689Skan  /* Remainder of the expression.  */
993169689Skan  tree rest;
994169689Skan};
995169689Skan
996169689Skan/* Description of a memory address.  */
997169689Skan
998169689Skanstruct mem_address
999169689Skan{
1000169689Skan  tree symbol, base, index, step, offset;
1001169689Skan};
1002169689Skan
1003169689Skantree create_mem_ref (block_stmt_iterator *, tree,
1004169689Skan		     struct affine_tree_combination *);
1005169689Skanrtx addr_for_mem_ref (struct mem_address *, bool);
1006169689Skanvoid get_address_description (tree, struct mem_address *);
1007169689Skantree maybe_fold_tmr (tree);
1008169689Skan
1009169689Skan/* This structure is simply used during pushing fields onto the fieldstack
1010169689Skan   to track the offset of the field, since bitpos_of_field gives it relative
1011169689Skan   to its immediate containing type, and we want it relative to the ultimate
1012169689Skan   containing object.  */
1013169689Skan
1014169689Skanstruct fieldoff
1015169689Skan{
1016169689Skan  tree type;
1017169689Skan  tree size;
1018169689Skan  tree decl;
1019169689Skan  HOST_WIDE_INT offset;
1020169689Skan};
1021169689Skantypedef struct fieldoff fieldoff_s;
1022169689Skan
1023169689SkanDEF_VEC_O(fieldoff_s);
1024169689SkanDEF_VEC_ALLOC_O(fieldoff_s,heap);
1025169689Skanint push_fields_onto_fieldstack (tree, VEC(fieldoff_s,heap) **,
1026169689Skan				 HOST_WIDE_INT, bool *);
1027169689Skanvoid sort_fieldstack (VEC(fieldoff_s,heap) *);
1028169689Skan
1029169689Skanvoid init_alias_heapvars (void);
1030169689Skanvoid delete_alias_heapvars (void);
1031169689Skan
1032169689Skan#include "tree-flow-inline.h"
1033169689Skan
1034169689Skanvoid swap_tree_operands (tree, tree *, tree *);
1035169689Skan
1036169689Skanextern void recalculate_used_alone (void);
1037169689Skanextern bool updating_used_alone;
1038169689Skan#endif /* _TREE_FLOW_H  */
1039