PandA-2024.02
Public Member Functions | Private Member Functions | Private Attributes
OrderedBasicBlock Class Reference

#include <OrderedInstructions.hpp>

Public Member Functions

 OrderedBasicBlock (const blocRef &BasicB)
 
bool dominates (const struct gimple_node *A, const struct gimple_node *B)
 Find out whether A dominates B, meaning whether A comes before B in BB. More...
 

Private Member Functions

bool instComesBefore (const struct gimple_node *A, const struct gimple_node *B)
 Given no cached results, find if A comes before B in BB. More...
 

Private Attributes

CustomMap< const struct gimple_node *, unsigned > NumberedInsts
 Map a instruction to its position in a BasicBlock. More...
 
std::list< tree_nodeRef >::const_iterator LastInstFound
 Keep track of last instruction inserted into NumberedInsts. More...
 
unsigned NextInstPos
 The position/number to tag the next instruction to be found. More...
 
const std::list< tree_nodeRef > & BBInst
 The source BasicBlock instruction list. More...
 
const blocRef BB
 The source BasicBlock to map. More...
 

Detailed Description

Definition at line 57 of file OrderedInstructions.hpp.

Constructor & Destructor Documentation

◆ OrderedBasicBlock()

OrderedBasicBlock::OrderedBasicBlock ( const blocRef &  BasicB)
explicit

Definition at line 82 of file OrderedInstructions.cpp.

References GET_CONST_NODE, NumberedInsts, and U.

Member Function Documentation

◆ dominates()

bool OrderedBasicBlock::dominates ( const struct gimple_node A,
const struct gimple_node B 
)

Find out whether A dominates B, meaning whether A comes before B in BB.

This is a simplification that considers cached instruction positions and ignores other basic blocks, being only relevant to compare relative instructions positions inside BB. Returns false for A == B.

Definition at line 92 of file OrderedInstructions.cpp.

References BB, gimple_node::bb_index, tree_node::get_kind(), instComesBefore(), NumberedInsts, and THROW_ASSERT.

Here is the call graph for this function:

◆ instComesBefore()

bool OrderedBasicBlock::instComesBefore ( const struct gimple_node A,
const struct gimple_node B 
)
private

Given no cached results, find if A comes before B in BB.

Cache and number out instruction while walking BB.

Definition at line 52 of file OrderedInstructions.cpp.

References B, BBInst, GET_CONST_NODE, LastInstFound, NextInstPos, NumberedInsts, and THROW_ASSERT.

Referenced by dominates().

Here is the caller graph for this function:

Field Documentation

◆ BB

const blocRef OrderedBasicBlock::BB
private

The source BasicBlock to map.

Definition at line 74 of file OrderedInstructions.hpp.

Referenced by dominates().

◆ BBInst

const std::list<tree_nodeRef>& OrderedBasicBlock::BBInst
private

The source BasicBlock instruction list.

Definition at line 71 of file OrderedInstructions.hpp.

Referenced by instComesBefore().

◆ LastInstFound

std::list<tree_nodeRef>::const_iterator OrderedBasicBlock::LastInstFound
private

Keep track of last instruction inserted into NumberedInsts.

It speeds up queries for uncached instructions by providing a start point for new queries in OrderedBasicBlock::comesBefore.

Definition at line 65 of file OrderedInstructions.hpp.

Referenced by instComesBefore().

◆ NextInstPos

unsigned OrderedBasicBlock::NextInstPos
private

The position/number to tag the next instruction to be found.

Definition at line 68 of file OrderedInstructions.hpp.

Referenced by instComesBefore().

◆ NumberedInsts

CustomMap<const struct gimple_node*, unsigned> OrderedBasicBlock::NumberedInsts
private

Map a instruction to its position in a BasicBlock.

Definition at line 60 of file OrderedInstructions.hpp.

Referenced by dominates(), instComesBefore(), and OrderedBasicBlock().


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

Generated on Mon Feb 12 2024 13:03:59 for PandA-2024.02 by doxygen 1.8.13