quick commit
[official-gcc.git] / gcc / domwalk.h
blob63aeec233a363478283e4dac3acb1b9bfb68f379
1 /* Generic dominator tree walker
2 Copyright (C) 2003, 2004, 2005, 2007, 2008 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 3, 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 COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 typedef void *void_p;
22 DEF_VEC_P(void_p);
23 DEF_VEC_ALLOC_P(void_p,heap);
25 /* This is the main data structure for the dominator walker. It provides
26 the callback hooks as well as a convenient place to hang block local
27 data and pass-global data. */
29 struct dom_walk_data
31 /* This is the direction of the dominator tree we want to walk. i.e.,
32 if it is set to CDI_DOMINATORS, then we walk the dominator tree,
33 if it is set to CDI_POST_DOMINATORS, then we walk the post
34 dominator tree. */
35 ENUM_BITFIELD (cdi_direction) dom_direction : 2;
37 /* Function to initialize block local data.
39 Note that the dominator walker infrastructure may provide a new
40 fresh, and zero'd block local data structure, or it may re-use an
41 existing block local data structure.
43 If the block local structure has items such as virtual arrays, then
44 that allows your optimizer to re-use those arrays rather than
45 creating new ones. */
46 void (*initialize_block_local_data) (struct dom_walk_data *,
47 basic_block, bool);
49 /* Function to call before the recursive walk of the dominator children. */
50 void (*before_dom_children) (struct dom_walk_data *, basic_block);
52 /* Function to call after the recursive walk of the dominator children. */
53 void (*after_dom_children) (struct dom_walk_data *, basic_block);
55 /* Global data for a walk through the dominator tree. */
56 void *global_data;
58 /* Stack of any data we need to keep on a per-block basis.
60 If you have no local data, then BLOCK_DATA_STACK will be NULL. */
61 VEC(void_p,heap) *block_data_stack;
63 /* Size of the block local data. If this is zero, then it is assumed
64 you have no local data and thus no BLOCK_DATA_STACK as well. */
65 size_t block_local_data_size;
67 /* From here below are private data. Please do not use this
68 information/data outside domwalk.c. */
70 /* Stack of available block local structures. */
71 VEC(void_p,heap) *free_block_data;
74 void walk_dominator_tree (struct dom_walk_data *, basic_block);
75 void init_walk_dominator_tree (struct dom_walk_data *);
76 void fini_walk_dominator_tree (struct dom_walk_data *);