Predator  [unstable] git snapshot
Public Types | Public Member Functions | Private Types | Private Attributes
Block Class Reference

Basic block - a single node in ControlFlow graph. More...

#include <storage.hh>

Collaboration diagram for Block:
Collaboration graph
[legend]

Public Types

typedef TList::const_iterator const_iterator
typedef const_iterator iterator

Public Member Functions

 Block ()
 constructor useful to place objects into std::vector, but do not try to call append() on objects constructed this way.
 Block (ControlFlow *cfg, const char *name)
 created a named basic block
const std::string & name () const
 return name of the basic block
void append (Insn *insn)
 append a given instruction to end of the block
void appendPredecessor (Block *)
const TTargetListtargets () const
 return list of all direct successors
const TTargetListinbound () const
 return list of all direct predecessors
const_iterator begin () const
 return STL-like iterator to go through all the instructions inside
const_iterator end () const
 return STL-like iterator to go through all the instructions inside
const Insnfront () const
 return the first instruction in the basic block
const Insnback () const
 return the last instruction in the basic block
size_t size () const
 return count of instructions inside the basic block
const Insnoperator[] (unsigned idx) const
 direct access to instruction by its index.
const ControlFlowcfg () const
 return the ControlFlow object which the Block belongs to
bool isLoopEntry () const
 return true, if a loop at the level of CFG starts with this block

Private Types

typedef const InsnTList

Private Attributes

TList insns_
TTargetList inbound_
ControlFlowcfg_
std::string name_

Detailed Description

Basic block - a single node in ControlFlow graph.

Once the basic block is ready, it contains (possibly empty) sequence of non-terminating instructions and exactly one terminating instruction.

Definition at line 439 of file storage.hh.

Member Typedef Documentation

typedef TList::const_iterator const_iterator

Definition at line 444 of file storage.hh.

Definition at line 445 of file storage.hh.

typedef const Insn* TList
private

Definition at line 441 of file storage.hh.

Constructor & Destructor Documentation

Block ( )
inline

constructor useful to place objects into std::vector, but do not try to call append() on objects constructed this way.

It would crash on a NULL pointer dereference.

Definition at line 453 of file storage.hh.

Block ( ControlFlow cfg,
const char *  name 
)
inline

created a named basic block

Parameters
cfgpointer to control flow graph where the block belongs to
namename of the basic block being constructed (zero ended C string)

Definition at line 464 of file storage.hh.

Member Function Documentation

void append ( Insn insn)

append a given instruction to end of the block

Parameters
insnInstruction to append.
Note
Given objects are not cloned nor destroyed!
void appendPredecessor ( Block )
const Insn* back ( ) const

return the last instruction in the basic block

Note
This should be a terminal instruction once the CodeStorage model has been built.
const_iterator begin ( ) const
inline

return STL-like iterator to go through all the instructions inside

Definition at line 501 of file storage.hh.

References Block::insns_.

Referenced by ControlFlow::begin().

const ControlFlow* cfg ( ) const
inline

return the ControlFlow object which the Block belongs to

Definition at line 535 of file storage.hh.

References Block::cfg_.

const_iterator end ( ) const
inline

return STL-like iterator to go through all the instructions inside

Definition at line 506 of file storage.hh.

References Block::insns_.

Referenced by ControlFlow::end().

const Insn* front ( ) const

return the first instruction in the basic block

const TTargetList& inbound ( ) const
inline

return list of all direct predecessors

Definition at line 496 of file storage.hh.

References Block::inbound_.

bool isLoopEntry ( ) const

return true, if a loop at the level of CFG starts with this block

const std::string& name ( ) const
inline

return name of the basic block

Definition at line 475 of file storage.hh.

References Block::name_.

const Insn* operator[] ( unsigned  idx) const
inline

direct access to instruction by its index.

Parameters
idxIndex of instruction to access (staring with zero).
Attention
There is no range check performed.

Definition at line 530 of file storage.hh.

References Block::insns_.

size_t size ( ) const
inline

return count of instructions inside the basic block

Definition at line 523 of file storage.hh.

References Block::insns_.

Referenced by ControlFlow::size().

const TTargetList& targets ( ) const

return list of all direct successors

Field Documentation

ControlFlow* cfg_
private

Definition at line 543 of file storage.hh.

Referenced by Block::cfg().

TTargetList inbound_
private

Definition at line 542 of file storage.hh.

Referenced by Block::inbound().

TList insns_
private

Definition at line 541 of file storage.hh.

Referenced by Block::begin(), Block::end(), Block::operator[](), and Block::size().

std::string name_
private

Definition at line 544 of file storage.hh.

Referenced by Block::name().


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