gcc/ChangeLog
[official-gcc.git] / gcc / domwalk.h
blob54b7f3c86d92c9af8aa3ed81b922df62a6882433
1 /* Generic dominator tree walker
2 Copyright (C) 2003-2013 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;
23 /* This is the main data structure for the dominator walker. It provides
24 the callback hooks as well as a convenient place to hang block local
25 data and pass-global data. */
27 struct dom_walk_data
29 /* This is the direction of the dominator tree we want to walk. i.e.,
30 if it is set to CDI_DOMINATORS, then we walk the dominator tree,
31 if it is set to CDI_POST_DOMINATORS, then we walk the post
32 dominator tree. */
33 ENUM_BITFIELD (cdi_direction) dom_direction : 2;
35 /* Function to initialize block local data.
37 Note that the dominator walker infrastructure may provide a new
38 fresh, and zero'd block local data structure, or it may re-use an
39 existing block local data structure.
41 If the block local structure has items such as virtual arrays, then
42 that allows your optimizer to re-use those arrays rather than
43 creating new ones. */
44 void (*initialize_block_local_data) (struct dom_walk_data *,
45 basic_block, bool);
47 /* Function to call before the recursive walk of the dominator children. */
48 void (*before_dom_children) (struct dom_walk_data *, basic_block);
50 /* Function to call after the recursive walk of the dominator children. */
51 void (*after_dom_children) (struct dom_walk_data *, basic_block);
53 /* Global data for a walk through the dominator tree. */
54 void *global_data;
56 /* Stack of any data we need to keep on a per-block basis.
58 If you have no local data, then BLOCK_DATA_STACK will be NULL. */
59 vec<void_p> block_data_stack;
61 /* Size of the block local data. If this is zero, then it is assumed
62 you have no local data and thus no BLOCK_DATA_STACK as well. */
63 size_t block_local_data_size;
65 /* From here below are private data. Please do not use this
66 information/data outside domwalk.c. */
68 /* Stack of available block local structures. */
69 vec<void_p> free_block_data;
72 void walk_dominator_tree (struct dom_walk_data *, basic_block);
73 void init_walk_dominator_tree (struct dom_walk_data *);
74 void fini_walk_dominator_tree (struct dom_walk_data *);