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