OTAWA  2.0
Framework to perform machine analysis and compute WCET.
otawa::BasicBlock Class Reference

#include <otawa/cfg/CFG.h>

+ Inheritance diagram for otawa::BasicBlock:

Classes

class  BundleIter
 
class  InstIter
 

Public Types

typedef Vector< Pair< BasicBlock *, Edge * > > basic_preds_t
 
typedef BaseBundle< InstIterBundle
 
- Public Types inherited from otawa::graph::Vertex
typedef edges_t::Iter EdgeIter
 
typedef elm::List< Edge * > edges_t
 

Public Member Functions

Address address (void) const
 
MemArea area (void) const
 
 BasicBlock (const Array< Inst * > &insts)
 Build a basic block. More...
 
void basicPreds (basic_preds_t &preds)
 Compute the predecessors of the current basic block that (a) are basic blocks and (b)for which transition can be accounted by an edge. More...
 
InstIter begin (void) const
 
Iterable< BundleIterbundles () const
 
bool contains (Address addr)
 
bool contains (Inst *i)
 Test if the current BB contains the given instruction. More...
 
bool contains (Inst *i) const
 
Instcontrol (void)
 Get the control instruction of the block (if any). More...
 
int count (void) const
 Count the number of instructions in the block. More...
 
InstIter end (void) const
 
Instfirst (void) const
 
InstIter insts (void) const
 
Instlast (void)
 Get the last instruction of the block. More...
 
bool overlap (BasicBlock *bb) const
 
bool overlap (const MemArea &area) const
 
int size (void) const
 Get size of the basic block. More...
 
Address topAddress (void) const
 
 ~BasicBlock (void)
 
- Public Member Functions inherited from otawa::Block
Address address (void) const
 
CFGcfg (void) const
 
int id (void) const
 
bool isBasic (void) const
 
bool isCall (void) const
 
bool isEnd (void) const
 
bool isEntry (void) const
 
bool isExit (void) const
 
bool isPhony (void) const
 
bool isSynth (void) const
 
bool isUnknown (void) const
 
bool isVirtual (void) const
 
 operator BasicBlock * (void)
 
 operator SynthBlock * (void)
 
BasicBlocktoBasic (void)
 
const BasicBlocktoBasic (void) const
 
SynthBlocktoSynth (void)
 
const SynthBlocktoSynth (void) const
 
- Public Member Functions inherited from otawa::PropList
void addProp (Property *prop)
 Add property to the list without checking of duplication. More...
 
void addProps (const PropList &props)
 Add all properties from the given property list, in a reverse order. More...
 
GetterRange all (const AbstractIdentifier &id) const
 
void clearProps (void)
 Remove all properties from the list. More...
 
PropertyextractProp (const AbstractIdentifier &id)
 
PropertyextractProp (const AbstractIdentifier *id)
 Remove a property matching the given identifier and return it. More...
 
PropertygetProp (const AbstractIdentifier *id) const
 Find a property by its identifier. More...
 
bool hasProp (const AbstractIdentifier &id) const
 
PropListoperator= (const PropList &props)
 
void print (elm::io::Output &out) const
 Display the current property list. More...
 
PropRange properties (void) const
 
 PropList (const PropList &props)
 Initialize a property list from a sequence of (identifier, value) pairs passed as variable arguments. More...
 
 PropList (void)
 
void removeAllProp (const AbstractIdentifier *id)
 Remove all the properties matching the given identifier. More...
 
void removeProp (const AbstractIdentifier &id)
 
void removeProp (const AbstractIdentifier *id)
 Remove a property matching the given identifier. More...
 
void setProp (const AbstractIdentifier *id)
 
void setProp (Property *prop)
 Set the property in the property list removing any double. More...
 
void takeProps (PropList &props)
 Take properties from props to the current property list. More...
 
 ~PropList (void)
 
- Public Member Functions inherited from otawa::graph::GenVertex< Block, Edge >
EdgeCollection inEdges (void) const
 
EdgeIter ins (void) const
 
EdgeCollection outEdges (void) const
 
EdgeIter outs (void) const
 
PredCollection preds (void) const
 
SuccCollection succs (void) const
 
- Public Member Functions inherited from otawa::graph::Vertex
int countIns (void) const
 
int countOuts (void) const
 
int index (void) const
 
const edges_tinEdges (void) const
 
EdgeIter ins (void) const
 
const edges_toutEdges (void) const
 
EdgeIter outs (void) const
 
 Vertex (void)
 

Private Attributes

AllocArray< Inst * > _insts
 

Additional Inherited Members

- Static Public Attributes inherited from otawa::Block
static const t::uint16 IS_BASIC = 1 << 0
 
static const t::uint16 IS_CALL = 0x2 << 0
 
static const t::uint16 IS_ENTRY = 0 << 2
 
static const t::uint16 IS_EXIT = 1 << 2
 
static const t::uint16 IS_PHONY = 3 << 2
 
static const t::uint16 IS_SYNTH = 2 << 0
 
static const t::uint16 IS_UNKN = 2 << 2
 
static const t::uint16 IS_VIRTUAL = 0 << 0
 
static const t::uint16 MASK1 = 0x3
 
static const t::uint16 MASK12 = MASK1 | (0x3 << 2)
 
- Static Public Attributes inherited from otawa::PropList
static rtti::Type__type = prop_list_class
 
static const PropList EMPTY
 This is an empty proplist for convenience. More...
 
- Protected Member Functions inherited from otawa::Block
 Block (t::uint16 type=IS_BASIC)
 Build a CFG block. More...
 
- Protected Member Functions inherited from otawa::graph::Vertex
 ~Vertex (void)
 

Detailed Description

A basic block of the CFG.

Member Typedef Documentation

◆ basic_preds_t

◆ Bundle

Constructor & Destructor Documentation

◆ BasicBlock()

otawa::BasicBlock::BasicBlock ( const Array< Inst * > &  instructions)

Build a basic block.

Parameters
instructionsArray of instructions.

References elm::Array< class >::count().

◆ ~BasicBlock()

otawa::BasicBlock::~BasicBlock ( void  )

Member Function Documentation

◆ address()

◆ area()

MemArea otawa::BasicBlock::area ( void  ) const
inline

◆ basicPreds()

void otawa::BasicBlock::basicPreds ( basic_preds_t preds)

Compute the predecessors of the current basic block that (a) are basic blocks and (b)for which transition can be accounted by an edge.

The result predecessor vector is empty if there is at least one predecessor basic block that cannot be accounted by an edge.

This function is useful when an analysis requires to work on instructions of chains of basic blocks.

The result is a vector of pair (b, e) where b is a predecessor basic blocks and e the edge that account for the number of iterations of the basic block.

Parameters
predsList of predecessors basic blocks and accounting edge.

References otawa::CFG::callCount(), otawa::SynthBlock::callee(), otawa::CFG::callers(), otawa::Block::cfg(), otawa::graph::Vertex::countIns(), otawa::CFG::exit(), otawa::graph::GenVertex< V, E >::inEdges(), otawa::graph::GenVertex< Block, Edge >::inEdges(), otawa::Block::isBasic(), otawa::Block::isEntry(), otawa::Block::isPhony(), p(), elm::pair(), elm::Vector< class, class, class >::pop(), otawa::graph::GenVertex< Block, Edge >::preds(), elm::Vector< class, class, class >::push(), otawa::Block::toBasic(), and otawa::Block::toSynth().

◆ begin()

InstIter otawa::BasicBlock::begin ( void  ) const
inline

◆ bundles()

Iterable<BundleIter> otawa::BasicBlock::bundles ( ) const
inline

◆ contains() [1/3]

bool otawa::BasicBlock::contains ( Address  addr)
inline

Test if the given address is in the area covered by the BB.

Parameters
addrAddress to test.
Returns
True of the address in the BB, false else.

◆ contains() [2/3]

bool otawa::BasicBlock::contains ( Inst i)

Test if the current BB contains the given instruction.

Beware: as some instruction sets melt opcode of instructions, it is not enough to test containment with addresses. Hence, this function test really if the given instruction is member of the BB list of instructions.

Parameters
iInstruction to look for.
Returns
True if the instruction is in the BB list, false else.

◆ contains() [3/3]

bool otawa::BasicBlock::contains ( Inst i) const
inline

◆ control()

Inst * otawa::BasicBlock::control ( void  )

Get the control instruction of the block (if any).

Returns
Block control instruction.

References otawa::IGNORE_CONTROL.

Referenced by otawa::etime::EdgeTimeBuilder::getBranchNode().

◆ count()

int otawa::BasicBlock::count ( void  ) const

Count the number of instructions in the block.

Returns
Instruction count.

◆ end()

InstIter otawa::BasicBlock::end ( void  ) const
inline

◆ first()

Inst * otawa::BasicBlock::first ( void  ) const
inline

Get the first instruction of the block.

Returns
Block first instruction?

Referenced by otawa::clp::Manager::next(), otawa::oslice::Slicer::processWorkingList(), and otawa::oslice::LivenessChecker::processWorkingList().

◆ insts()

◆ last()

Inst * otawa::BasicBlock::last ( void  )

Get the last instruction of the block.

Returns
Block last instruction.

Referenced by otawa::oslice::Manager::next(), and otawa::AbstractCFGBuilder::seq().

◆ overlap() [1/2]

bool otawa::BasicBlock::overlap ( BasicBlock bb) const
inline

Test if the area of the current BB overlaps the memory area of the given BB.

Parameters
bbBB to test for overlapping.
Returns
True if both BB memory areas overlap, false else.

◆ overlap() [2/2]

bool otawa::BasicBlock::overlap ( const MemArea area) const
inline

Test if the area of the current BB overlaps the given memory area.

Parameters
areaMemory area to test with.
Returns
True if both memory areas overlap, false else.

References otawa::MemArea::meet().

◆ size()

int otawa::BasicBlock::size ( void  ) const

Get size of the basic block.

Returns
Block size (in bytes).

References _insts.

Referenced by otawa::cfgio::Output::processBB().

◆ topAddress()

Address otawa::BasicBlock::topAddress ( void  ) const
inline

Get top address, that is, the address of the byte following the basic block.

Parameters
Blocktop address.

Referenced by otawa::AbstractCFGBuilder::buildBBs().

Member Data Documentation

◆ _insts

AllocArray<Inst *> otawa::BasicBlock::_insts
private

Referenced by size().


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