Daily bump.
[gcc.git] / gcc / domwalk.h
1 /* Generic dominator tree walker
2 Copyright (C) 2003, 2004, 2005, 2007, 2008, 2012
3 Free Software Foundation, Inc.
4 Contributed by Diego Novillo <dnovillo@redhat.com>
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
21
22 typedef void *void_p;
23
24 /* This is the main data structure for the dominator walker. It provides
25 the callback hooks as well as a convenient place to hang block local
26 data and pass-global data. */
27
28 struct dom_walk_data
29 {
30 /* This is the direction of the dominator tree we want to walk. i.e.,
31 if it is set to CDI_DOMINATORS, then we walk the dominator tree,
32 if it is set to CDI_POST_DOMINATORS, then we walk the post
33 dominator tree. */
34 ENUM_BITFIELD (cdi_direction) dom_direction : 2;
35
36 /* Function to initialize block local data.
37
38 Note that the dominator walker infrastructure may provide a new
39 fresh, and zero'd block local data structure, or it may re-use an
40 existing block local data structure.
41
42 If the block local structure has items such as virtual arrays, then
43 that allows your optimizer to re-use those arrays rather than
44 creating new ones. */
45 void (*initialize_block_local_data) (struct dom_walk_data *,
46 basic_block, bool);
47
48 /* Function to call before the recursive walk of the dominator children. */
49 void (*before_dom_children) (struct dom_walk_data *, basic_block);
50
51 /* Function to call after the recursive walk of the dominator children. */
52 void (*after_dom_children) (struct dom_walk_data *, basic_block);
53
54 /* Global data for a walk through the dominator tree. */
55 void *global_data;
56
57 /* Stack of any data we need to keep on a per-block basis.
58
59 If you have no local data, then BLOCK_DATA_STACK will be NULL. */
60 vec<void_p> block_data_stack;
61
62 /* Size of the block local data. If this is zero, then it is assumed
63 you have no local data and thus no BLOCK_DATA_STACK as well. */
64 size_t block_local_data_size;
65
66 /* From here below are private data. Please do not use this
67 information/data outside domwalk.c. */
68
69 /* Stack of available block local structures. */
70 vec<void_p> free_block_data;
71 };
72
73 void walk_dominator_tree (struct dom_walk_data *, basic_block);
74 void init_walk_dominator_tree (struct dom_walk_data *);
75 void fini_walk_dominator_tree (struct dom_walk_data *);