Otawa  0.10
otawa::pfg::BB Class Reference

A basic block in a otawa::pfg::PFG . More...

#include <otawa/cfg/PFG.h>

Inheritance diagram for otawa::pfg::BB:
otawa::GenGraph< N, E >::GenNode otawa::graph::Node

Classes

class  InstIter
 Iterator on the instructions of a basic block. More...
 

Public Member Functions

 BB (void)
 
 BB (Inst *first, t::uint32 size)
 
Address address (void) const
 Get the start address of the basic block. More...
 
Address topAddress (void) const
 Get the address next after the basic block, that is, address + size. More...
 
t::uint32 size (void) const
 Get the size of the basic block. More...
 
Instfirst (void) const
 Get the first instruction of the basic block. More...
 
int count (void) const
 Count the number of instructions in the basic block. More...
 
PFGpfg (void) const
 
bool isControl (void) const
 Test if the basic block is ended by a control instruction. More...
 
bool isBranch (void) const
 Test if the basic block is ended by a simple branch instruction (neither a call, nor a return). More...
 
bool isConditional (void) const
 Test if the basic block is ended by a conditional branch. More...
 
bool isBranched (void) const
 
bool isCall (void) const
 Test if the basic block ends with a call instruction. More...
 
bool isReturn (void) const
 Test if the basic block ends with a return instruction. More...
 
bool isMultiTarget (void) const
 Test if the basic block ends with a multi-target branch instruction (either branch, or call). More...
 
void setSize (size_t size)
 
int index (void) const
 
bool hasSucc (void) const
 
bool hasPred (void) const
 
int countSucc (void) const
 
int countPred (void) const
 
bool isPredOf (const GenNode *node)
 
bool isSuccOf (const GenNode *node)
 

Private Attributes

Inst_first
 
t::uint32 _size
 

Detailed Description

A basic block in a otawa::pfg::PFG .

Constructor & Destructor Documentation

otawa::pfg::BB::BB ( void  )
inline
otawa::pfg::BB::BB ( Inst first,
t::uint32  size 
)
inline

Member Function Documentation

Address otawa::pfg::BB::address ( void  ) const
inline

Get the start address of the basic block.

Returns
Basic block address.

Referenced by otawa::pfg::PFG::add(), and otawa::PFGBuilder::finalizeBB().

int otawa::pfg::BB::count ( void  ) const
inline

Count the number of instructions in the basic block.

Returns
Number of instruction.
template<class N, class E>
int otawa::GenGraph< N, E >::GenNode::countPred ( void  ) const
inlineinherited
template<class N, class E>
int otawa::GenGraph< N, E >::GenNode::countSucc ( void  ) const
inlineinherited
Inst * otawa::pfg::BB::first ( void  ) const
inline

Get the first instruction of the basic block.

Returns
First instruction.

Referenced by otawa::PFGBuilder::finalizeBB().

template<class N, class E>
bool otawa::GenGraph< N, E >::GenNode::hasPred ( void  ) const
inlineinherited
template<class N, class E>
bool otawa::GenGraph< N, E >::GenNode::hasSucc ( void  ) const
inlineinherited
bool otawa::pfg::BB::isBranch ( void  ) const

Test if the basic block is ended by a simple branch instruction (neither a call, nor a return).

Returns
True if it ends with a branch instructions, false else.

References otawa::pfg::Edge::BRANCH, otawa::pfg::Edge::COND_BRANCH, and otawa::cfgio::edge().

bool otawa::pfg::BB::isBranched ( void  ) const
bool otawa::pfg::BB::isCall ( void  ) const

Test if the basic block ends with a call instruction.

Returns
True if it ends with a call instruction, false else.

References otawa::pfg::Edge::CALL, otawa::pfg::Edge::COND_CALL, and otawa::cfgio::edge().

bool otawa::pfg::BB::isConditional ( void  ) const

Test if the basic block is ended by a conditional branch.

Returns
True if it is ended by a conditional branch, false else.

References otawa::pfg::Edge::COND_BRANCH, otawa::pfg::Edge::COND_CALL, otawa::pfg::Edge::COND_RETURN, and otawa::cfgio::edge().

bool otawa::pfg::BB::isControl ( void  ) const

Test if the basic block is ended by a control instruction.

Returns
True if it contains a control, false else.

References otawa::cfgio::edge(), and otawa::pfg::Edge::SEQ.

bool otawa::pfg::BB::isMultiTarget ( void  ) const

Test if the basic block ends with a multi-target branch instruction (either branch, or call).

Returns
True if it ends with a multi-target branch instruction, false else.

References otawa::pfg::Edge::BRANCH, otawa::pfg::Edge::CALL, otawa::pfg::Edge::COND_BRANCH, otawa::pfg::Edge::COND_CALL, and otawa::cfgio::edge().

template<class N, class E>
bool otawa::GenGraph< N, E >::GenNode::isPredOf ( const GenNode node)
inlineinherited
bool otawa::pfg::BB::isReturn ( void  ) const

Test if the basic block ends with a return instruction.

Returns
True if it ends with a return instruction, false else.

References otawa::pfg::Edge::COND_RETURN, otawa::cfgio::edge(), and otawa::pfg::Edge::RETURN.

template<class N, class E>
bool otawa::GenGraph< N, E >::GenNode::isSuccOf ( const GenNode node)
inlineinherited
PFG& otawa::pfg::BB::pfg ( void  ) const
inline
void otawa::pfg::BB::setSize ( size_t  size)
inline
size_t otawa::pfg::BB::size ( void  ) const
inline

Get the size of the basic block.

Returns
Basic block size in bytes.
Address otawa::pfg::BB::topAddress ( void  ) const
inline

Get the address next after the basic block, that is, address + size.

Returns
Basic block next after address.

References otawa::ot::address().

Member Data Documentation

Inst* otawa::pfg::BB::_first
private
t::uint32 otawa::pfg::BB::_size
private

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