* doc/install.texi: Fix a typo.
[official-gcc.git] / gcc / domwalk.h
blobfbf549bbd9842ad0dc2cc5ca2c10c12f9d538a00
1 /* Generic dominator tree walker
2 Copyright (C) 2003, 2004 Free Software Foundation, Inc.
3 Contributed by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 /* This is the main data structure for the dominator walker. It provides
23 the callback hooks as well as a convenient place to hang block local
24 data and pass-global data. */
26 struct dom_walk_data
28 /* This is the direction of the dominator tree we want to walk. i.e.,
29 if it is set to CDI_DOMINATORS, then we walk the dominator tree,
30 if it is set to CDI_POST_DOMINATORS, then we walk the post
31 dominator tree. */
32 ENUM_BITFIELD (cdi_direction) dom_direction : 2;
34 /* Nonzero if the statement walker should walk the statements from
35 last to first within a basic block instead of first to last.
37 Note this affects both statement walkers. We haven't yet needed
38 to use the second statement walker for anything, so it's hard to
39 predict if we really need the ability to select their direction
40 independently. */
41 BOOL_BITFIELD walk_stmts_backward : 1;
43 /* Function to initialize block local data.
45 Note that the dominator walker infrastructure may provide a new
46 fresh, and zero'd block local data structure, or it may re-use an
47 existing block local data structure.
49 If the block local structure has items such as virtual arrays, then
50 that allows your optimizer to re-use those arrays rather than
51 creating new ones. */
52 void (*initialize_block_local_data) (struct dom_walk_data *,
53 basic_block, bool);
55 /* Function to call before the statement walk occurring before the
56 recursive walk of the dominator children.
58 This typically initializes a block local data and pushes that
59 data onto BLOCK_DATA_STACK. */
60 void (*before_dom_children_before_stmts) (struct dom_walk_data *,
61 basic_block);
63 /* Function to call to walk statements before the recursive walk
64 of the dominator children. */
65 void (*before_dom_children_walk_stmts) (struct dom_walk_data *,
66 basic_block, block_stmt_iterator);
68 /* Function to call after the statement walk occurring before the
69 recursive walk of the dominator children. */
70 void (*before_dom_children_after_stmts) (struct dom_walk_data *,
71 basic_block);
73 /* Function to call before the statement walk occurring after the
74 recursive walk of the dominator children. */
75 void (*after_dom_children_before_stmts) (struct dom_walk_data *,
76 basic_block);
78 /* Function to call to walk statements after the recursive walk
79 of the dominator children. */
80 void (*after_dom_children_walk_stmts) (struct dom_walk_data *,
81 basic_block, block_stmt_iterator);
83 /* Function to call after the statement walk occurring after the
84 recursive walk of the dominator children.
86 This typically finalizes any block local data and pops
87 that data from BLOCK_DATA_STACK. */
88 void (*after_dom_children_after_stmts) (struct dom_walk_data *,
89 basic_block);
91 /* Global data for a walk through the dominator tree. */
92 void *global_data;
94 /* Stack of any data we need to keep on a per-block basis.
96 If you have no local data, then BLOCK_DATA_STACK will be NULL. */
97 varray_type block_data_stack;
99 /* Size of the block local data. If this is zero, then it is assumed
100 you have no local data and thus no BLOCK_DATA_STACK as well. */
101 size_t block_local_data_size;
103 /* From here below are private data. Please do not use this
104 information/data outside domwalk.c. */
106 /* Stack of available block local structures. */
107 varray_type free_block_data;
110 void walk_dominator_tree (struct dom_walk_data *, basic_block);
111 void init_walk_dominator_tree (struct dom_walk_data *);
112 void fini_walk_dominator_tree (struct dom_walk_data *);