GCC Middle and Back End API Reference
dom_walker Class Reference

#include <domwalk.h>

Inheritance diagram for dom_walker:
Collaboration diagram for dom_walker:

Public Types

enum  reachability { ALL_BLOCKS , REACHABLE_BLOCKS , REACHABLE_BLOCKS_PRESERVING_FLAGS }
 

Public Member Functions

 dom_walker (cdi_direction direction, enum reachability=ALL_BLOCKS, int *bb_index_to_rpo=NULL)
 
 ~dom_walker ()
 
void walk (basic_block)
 
virtual edge before_dom_children (basic_block)
 
virtual void after_dom_children (basic_block)
 

Static Public Attributes

static const edge STOP = (edge)-1
 

Private Member Functions

bool bb_reachable (struct function *, basic_block)
 
void propagate_unreachable_to_edges (basic_block, FILE *, dump_flags_t)
 

Private Attributes

enum cdi_direction m_dom_direction: 2
 
enum reachability m_reachability: 2
 
bool m_user_bb_to_rpo
 
basic_block m_unreachable_dom
 
int * m_bb_to_rpo
 

Detailed Description

Generic dominator tree walker
   Copyright (C) 2003-2024 Free Software Foundation, Inc.
   Contributed by Diego Novillo <dnovillo@redhat.com>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.

GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   

This is the main class for the dominator walker. It is expected that consumers will have a custom class inheriting from it, which will over ride at least one of before_dom_children and after_dom_children to implement the custom behavior.

Member Enumeration Documentation

◆ reachability

Enumerator
ALL_BLOCKS 
REACHABLE_BLOCKS 
REACHABLE_BLOCKS_PRESERVING_FLAGS 

Constructor & Destructor Documentation

◆ dom_walker()

dom_walker::dom_walker ( cdi_direction direction,
enum reachability reachability = ALL_BLOCKS,
int * bb_index_to_rpo = NULL )
Constructor for a dom walker.   

◆ ~dom_walker()

dom_walker::~dom_walker ( )
Destructor.   

References free(), m_bb_to_rpo, and m_user_bb_to_rpo.

Member Function Documentation

◆ after_dom_children()

◆ bb_reachable()

bool dom_walker::bb_reachable ( struct function * fun,
basic_block bb )
private
Return TRUE if BB is reachable, false otherwise.   

References ALL_BLOCKS, CDI_DOMINATORS, dominated_by_p(), ENTRY_BLOCK_PTR_FOR_FN, FOR_EACH_EDGE, ggc_alloc(), m_reachability, m_unreachable_dom, and basic_block_def::preds.

Referenced by walk().

◆ before_dom_children()

◆ propagate_unreachable_to_edges()

void dom_walker::propagate_unreachable_to_edges ( basic_block bb,
FILE * dump_file,
dump_flags_t dump_flags )
private
BB has been determined to be unreachable.  Propagate that property
to incoming and outgoing edges of BB as appropriate.   

References CDI_DOMINATORS, dominated_by_p(), dump_file, dump_flags, FOR_EACH_EDGE, ggc_alloc(), basic_block_def::index, m_unreachable_dom, basic_block_def::preds, basic_block_def::succs, and TDF_DETAILS.

Referenced by walk().

◆ walk()

Field Documentation

◆ m_bb_to_rpo

int* dom_walker::m_bb_to_rpo
private

Referenced by walk(), and ~dom_walker().

◆ m_dom_direction

enum cdi_direction dom_walker::m_dom_direction
private

Referenced by walk().

◆ m_reachability

enum reachability dom_walker::m_reachability
private

Referenced by bb_reachable(), and walk().

◆ m_unreachable_dom

basic_block dom_walker::m_unreachable_dom
private

◆ m_user_bb_to_rpo

bool dom_walker::m_user_bb_to_rpo
private

Referenced by walk(), and ~dom_walker().

◆ STOP

const edge dom_walker::STOP = (edge)-1
static

The documentation for this class was generated from the following files: