| 1 | 280 | jeremybenn | /* Generic dominator tree walker
 | 
      
         | 2 |  |  |    Copyright (C) 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
 | 
      
         | 3 |  |  |    Contributed by Diego Novillo <dnovillo@redhat.com>
 | 
      
         | 4 |  |  |  
 | 
      
         | 5 |  |  | This file is part of GCC.
 | 
      
         | 6 |  |  |  
 | 
      
         | 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.
 | 
      
         | 11 |  |  |  
 | 
      
         | 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.
 | 
      
         | 16 |  |  |  
 | 
      
         | 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/>.  */
 | 
      
         | 20 |  |  |  
 | 
      
         | 21 |  |  | typedef void *void_p;
 | 
      
         | 22 |  |  | DEF_VEC_P(void_p);
 | 
      
         | 23 |  |  | DEF_VEC_ALLOC_P(void_p,heap);
 | 
      
         | 24 |  |  |  
 | 
      
         | 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.  */
 | 
      
         | 28 |  |  |  
 | 
      
         | 29 |  |  | struct dom_walk_data
 | 
      
         | 30 |  |  | {
 | 
      
         | 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;
 | 
      
         | 36 |  |  |  
 | 
      
         | 37 |  |  |   /* Function to initialize block local data.
 | 
      
         | 38 |  |  |  
 | 
      
         | 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.
 | 
      
         | 42 |  |  |  
 | 
      
         | 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);
 | 
      
         | 48 |  |  |  
 | 
      
         | 49 |  |  |   /* Function to call before the recursive walk of the dominator children.  */
 | 
      
         | 50 |  |  |   void (*before_dom_children) (struct dom_walk_data *, basic_block);
 | 
      
         | 51 |  |  |  
 | 
      
         | 52 |  |  |   /* Function to call after the recursive walk of the dominator children.  */
 | 
      
         | 53 |  |  |   void (*after_dom_children) (struct dom_walk_data *, basic_block);
 | 
      
         | 54 |  |  |  
 | 
      
         | 55 |  |  |   /* Global data for a walk through the dominator tree.  */
 | 
      
         | 56 |  |  |   void *global_data;
 | 
      
         | 57 |  |  |  
 | 
      
         | 58 |  |  |   /* Stack of any data we need to keep on a per-block basis.
 | 
      
         | 59 |  |  |  
 | 
      
         | 60 |  |  |      If you have no local data, then BLOCK_DATA_STACK will be NULL.  */
 | 
      
         | 61 |  |  |   VEC(void_p,heap) *block_data_stack;
 | 
      
         | 62 |  |  |  
 | 
      
         | 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;
 | 
      
         | 66 |  |  |  
 | 
      
         | 67 |  |  |   /* From here below are private data.  Please do not use this
 | 
      
         | 68 |  |  |      information/data outside domwalk.c.  */
 | 
      
         | 69 |  |  |  
 | 
      
         | 70 |  |  |   /* Stack of available block local structures.  */
 | 
      
         | 71 |  |  |   VEC(void_p,heap) *free_block_data;
 | 
      
         | 72 |  |  | };
 | 
      
         | 73 |  |  |  
 | 
      
         | 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 *);
 |