CACAO
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends
cacao::jit::compiler2::MachineBasicBlock Class Reference

A basic block of (scheduled) machine instructions. More...

Inheritance diagram for cacao::jit::compiler2::MachineBasicBlock:
cacao::jit::compiler2::memory::ManagerMixin< MachineBasicBlock >

Public Types

typedef alloc::ordered_list
< MachineInstruction * >::type 
Container
 
typedef Container::iterator iterator
 
typedef Container::const_iterator const_iterator
 
typedef Container::reference reference
 
typedef Container::const_reference const_reference
 
typedef Container::pointer pointer
 
typedef Container::const_pointer const_pointer
 
typedef Container::reverse_iterator reverse_iterator
 
typedef
Container::const_reverse_iterator 
const_reverse_iterator
 
typedef alloc::list
< MachinePhiInst * >::type 
PhiListTy
 
typedef PhiListTy::const_iterator const_phi_iterator
 
typedef alloc::vector
< MachineBasicBlock * >::type 
PredListTy
 
typedef PredListTy::const_iterator const_pred_iterator
 
typedef PredListTy::iterator pred_iterator
 

Public Member Functions

 MachineBasicBlock (const MBBIterator &my_it)
 construct an empty MachineBasicBlock More...
 
bool empty () const
 checks if the basic block has no elements. More...
 
std::size_t size () const
 returns the number of elements More...
 
void push_back (MachineInstruction *value)
 Appends the given element value to the end of the container. More...
 
void push_front (MachineInstruction *value)
 inserts value to the beginning More...
 
iterator insert_before (iterator pos, MachineInstruction *value)
 inserts value before the element pointed to by pos More...
 
iterator insert (iterator pos, MachineInstruction *value)
 inserts value before the element pointed to by pos More...
 
iterator insert_after (iterator pos, MachineInstruction *value)
 inserts value after the element pointed to by pos More...
 
template<class InputIt >
void insert_before (iterator pos, InputIt first, InputIt last)
 inserts elements from range [first, last) before pos More...
 
template<class InputIt >
void insert_after (iterator pos, InputIt first, InputIt last)
 inserts elements from range [first, last) after pos More...
 
iterator erase (iterator pos)
 erases element More...
 
iterator erase (iterator first, iterator last)
 erases elements More...
 
iterator begin ()
 returns an iterator to the beginning More...
 
iterator end ()
 returns an iterator to the end More...
 
const_iterator begin () const
 returns an const iterator to the beginning More...
 
const_iterator end () const
 returns an const iterator to the end More...
 
reverse_iterator rbegin ()
 returns an reverse_iterator to the beginning More...
 
reverse_iterator rend ()
 returns an reverse_iterator to the end More...
 
const_reverse_iterator rbegin () const
 returns an const reverse_iterator to the beginning More...
 
const_reverse_iterator rend () const
 returns an const reverse_iterator to the end More...
 
const_reference front () const
 access the first element More...
 
const_reference back () const
 access the last element More...
 
reference front ()
 access the first element More...
 
reference back ()
 access the last element More...
 
void insert_phi (MachinePhiInst *value)
 Appends the given element value to the list of phis. More...
 
const_phi_iterator phi_begin () const
 returns an const iterator to the phi instructions More...
 
const_phi_iterator phi_end () const
 returns an const iterator to the phi instructions More...
 
std::size_t phi_size () const
 returns the number of phi nodes More...
 
void phi_clear ()
 removes all phi nodes More...
 
void insert_pred (MachineBasicBlock *value)
 Appends the given element value to the list of predecessors. More...
 
const_pred_iterator pred_begin () const
 returns an const iterator to the predecessors More...
 
const_pred_iterator pred_end () const
 returns an const iterator to the predecessors More...
 
pred_iterator pred_begin ()
 returns an iterator to the predecessors More...
 
pred_iterator pred_end ()
 returns an iterator to the predecessors More...
 
std::size_t pred_size () const
 returns the number of predecessor nodes More...
 
MachineBasicBlockget_predecessor (std::size_t i) const
 Get the i'th predecessor. More...
 
std::size_t get_predecessor_index (MachineBasicBlock *MBB) const
 Get predecessor index. More...
 
MIIterator convert (iterator pos)
 get a MIIterator form a iterator More...
 
MIIterator convert (reverse_iterator pos)
 get a MIIterator form a iterator More...
 
MIIterator mi_first ()
 returns an MIIterator to the first element More...
 
MIIterator mi_last ()
 returns an MIIterator to the last element (included) More...
 
MBBIterator self_iterator () const
 get self iterator More...
 
MachineInstructionScheduleget_parent () const
 get parent More...
 
OStreamprint (OStream &OS) const
 print More...
 
bool operator== (const MachineBasicBlock &other) const
 equality operator More...
 

Static Public Member Functions

static iterator convert (MIIterator pos)
 get a iterator form a MIIterator More...
 
- Static Public Member Functions inherited from cacao::jit::compiler2::memory::ManagerMixin< MachineBasicBlock >
static voidoperator new (std::size_t size) throw (std::bad_alloc)
 normal new More...
 
static voidoperator new (std::size_t size, void *ptr) throw ()
 placement new More...
 
static voidoperator new (std::size_t size, const std::nothrow_t &nt) throw ()
 nothrow new More...
 
static void operator delete (void *pMemory) throw ()
 normal delete More...
 
static void operator delete (void *pMemory, void *ptr) throw ()
 placement delete More...
 
static void operator delete (void *pMemory, const std::nothrow_t &) throw ()
 nothrow delete More...
 
static voidoperator new[] (std::size_t size) throw (std::bad_alloc)
 normal new[] More...
 
static voidoperator new[] (std::size_t size, void *ptr) throw ()
 placement new[] More...
 
static voidoperator new[] (std::size_t size, const std::nothrow_t &nt) throw ()
 nothrow new[] More...
 
static void operator delete[] (void *pMemory) throw ()
 normal delete[] More...
 
static void operator delete[] (void *pMemory, void *ptr) throw ()
 placement delete[] More...
 
static void operator delete[] (void *pMemory, const std::nothrow_t &) throw ()
 nothrow delete[] More...
 

Private Member Functions

void update (MachineInstruction *MI)
 update instruction block More...
 
 MachineBasicBlock ()
 empty constructor More...
 

Private Attributes

std::size_t id
 
MBBIterator my_it
 
Container list
 
PhiListTy phi
 
PredListTy predecessors
 

Static Private Attributes

static std::size_t id_counter = 0
 

Friends

class MBBBuilder
 
class MachineInstructionSchedule
 

Detailed Description

A basic block of (scheduled) machine instructions.

A MachineBasicBlock contains an ordered collection of MachineInstructions. These MachineInstructions can be accessed via MIIterators. These "smart-iterators" are not only used for access but also for ordering MachineInstructions.

Once a MachineInstruction is added, the MachineBasicBlock takes over the responsability for deleting it.

Definition at line 143 of file MachineBasicBlock.hpp.

Member Typedef Documentation

Definition at line 147 of file MachineBasicBlock.hpp.

Definition at line 157 of file MachineBasicBlock.hpp.

Definition at line 151 of file MachineBasicBlock.hpp.

Definition at line 160 of file MachineBasicBlock.hpp.

Definition at line 149 of file MachineBasicBlock.hpp.

Definition at line 154 of file MachineBasicBlock.hpp.

Definition at line 145 of file MachineBasicBlock.hpp.

Definition at line 146 of file MachineBasicBlock.hpp.

Definition at line 156 of file MachineBasicBlock.hpp.

Definition at line 150 of file MachineBasicBlock.hpp.

Definition at line 161 of file MachineBasicBlock.hpp.

Definition at line 159 of file MachineBasicBlock.hpp.

Definition at line 148 of file MachineBasicBlock.hpp.

Definition at line 153 of file MachineBasicBlock.hpp.

Constructor & Destructor Documentation

cacao::jit::compiler2::MachineBasicBlock::MachineBasicBlock ( const MBBIterator my_it)
inline

construct an empty MachineBasicBlock

Definition at line 164 of file MachineBasicBlock.hpp.

cacao::jit::compiler2::MachineBasicBlock::MachineBasicBlock ( )
inlineprivate

empty constructor

Definition at line 279 of file MachineBasicBlock.hpp.

Member Function Documentation

MachineBasicBlock::const_reference cacao::jit::compiler2::MachineBasicBlock::back ( ) const
inline

access the last element

Definition at line 413 of file MachineBasicBlock.hpp.

MachineBasicBlock::reference cacao::jit::compiler2::MachineBasicBlock::back ( )
inline

access the last element

Definition at line 419 of file MachineBasicBlock.hpp.

MachineBasicBlock::iterator cacao::jit::compiler2::MachineBasicBlock::begin ( )
inline

returns an iterator to the beginning

Definition at line 386 of file MachineBasicBlock.hpp.

MachineBasicBlock::const_iterator cacao::jit::compiler2::MachineBasicBlock::begin ( ) const
inline

returns an const iterator to the beginning

Definition at line 392 of file MachineBasicBlock.hpp.

MIIterator cacao::jit::compiler2::MachineBasicBlock::convert ( iterator  pos)
inline

get a MIIterator form a iterator

Definition at line 422 of file MachineBasicBlock.hpp.

MIIterator cacao::jit::compiler2::MachineBasicBlock::convert ( reverse_iterator  pos)
inline

get a MIIterator form a iterator

Definition at line 428 of file MachineBasicBlock.hpp.

MachineBasicBlock::iterator cacao::jit::compiler2::MachineBasicBlock::convert ( MIIterator  pos)
inlinestatic

get a iterator form a MIIterator

Definition at line 431 of file MachineBasicBlock.hpp.

bool cacao::jit::compiler2::MachineBasicBlock::empty ( ) const
inline

checks if the basic block has no elements.

Definition at line 328 of file MachineBasicBlock.hpp.

MachineBasicBlock::iterator cacao::jit::compiler2::MachineBasicBlock::end ( )
inline

returns an iterator to the end

Definition at line 389 of file MachineBasicBlock.hpp.

MachineBasicBlock::const_iterator cacao::jit::compiler2::MachineBasicBlock::end ( ) const
inline

returns an const iterator to the end

Definition at line 395 of file MachineBasicBlock.hpp.

MachineBasicBlock::iterator cacao::jit::compiler2::MachineBasicBlock::erase ( iterator  pos)
inline

erases element

Definition at line 379 of file MachineBasicBlock.hpp.

MachineBasicBlock::iterator cacao::jit::compiler2::MachineBasicBlock::erase ( iterator  first,
iterator  last 
)
inline

erases elements

Definition at line 383 of file MachineBasicBlock.hpp.

MachineBasicBlock::const_reference cacao::jit::compiler2::MachineBasicBlock::front ( ) const
inline

access the first element

Definition at line 410 of file MachineBasicBlock.hpp.

MachineBasicBlock::reference cacao::jit::compiler2::MachineBasicBlock::front ( )
inline

access the first element

Definition at line 416 of file MachineBasicBlock.hpp.

MachineInstructionSchedule * cacao::jit::compiler2::MachineBasicBlock::get_parent ( ) const
inline

get parent

Definition at line 445 of file MachineBasicBlock.hpp.

MachineBasicBlock * cacao::jit::compiler2::MachineBasicBlock::get_predecessor ( std::size_t  i) const
inline

Get the i'th predecessor.

Definition at line 486 of file MachineBasicBlock.hpp.

std::size_t cacao::jit::compiler2::MachineBasicBlock::get_predecessor_index ( MachineBasicBlock MBB) const
inline

Get predecessor index.

Returns
the predecessor index of MBB or pred_size() if not found

Definition at line 491 of file MachineBasicBlock.hpp.

MachineBasicBlock::iterator cacao::jit::compiler2::MachineBasicBlock::insert ( iterator  pos,
MachineInstruction value 
)
inline

inserts value before the element pointed to by pos

Note
for standard library compatibility.

Definition at line 350 of file MachineBasicBlock.hpp.

MachineBasicBlock::iterator cacao::jit::compiler2::MachineBasicBlock::insert_after ( iterator  pos,
MachineInstruction value 
)
inline

inserts value after the element pointed to by pos

Definition at line 356 of file MachineBasicBlock.hpp.

template<class InputIt >
void cacao::jit::compiler2::MachineBasicBlock::insert_after ( iterator  pos,
InputIt  first,
InputIt  last 
)
inline

inserts elements from range [first, last) after pos

Definition at line 371 of file MachineBasicBlock.hpp.

MachineBasicBlock::iterator cacao::jit::compiler2::MachineBasicBlock::insert_before ( iterator  pos,
MachineInstruction value 
)
inline

inserts value before the element pointed to by pos

Definition at line 344 of file MachineBasicBlock.hpp.

template<class InputIt >
void cacao::jit::compiler2::MachineBasicBlock::insert_before ( iterator  pos,
InputIt  first,
InputIt  last 
)
inline

inserts elements from range [first, last) before pos

Definition at line 363 of file MachineBasicBlock.hpp.

void cacao::jit::compiler2::MachineBasicBlock::insert_phi ( MachinePhiInst value)
inline

Appends the given element value to the list of phis.

Definition at line 452 of file MachineBasicBlock.hpp.

void cacao::jit::compiler2::MachineBasicBlock::insert_pred ( MachineBasicBlock value)
inline

Appends the given element value to the list of predecessors.

Note
Ensure that the PHI instructions are updated as well.

Definition at line 468 of file MachineBasicBlock.hpp.

MIIterator cacao::jit::compiler2::MachineBasicBlock::mi_first ( )
inline

returns an MIIterator to the first element

Definition at line 434 of file MachineBasicBlock.hpp.

MIIterator cacao::jit::compiler2::MachineBasicBlock::mi_last ( )
inline

returns an MIIterator to the last element (included)

Definition at line 438 of file MachineBasicBlock.hpp.

bool cacao::jit::compiler2::MachineBasicBlock::operator== ( const MachineBasicBlock other) const
inline

equality operator

Definition at line 501 of file MachineBasicBlock.hpp.

MachineBasicBlock::const_phi_iterator cacao::jit::compiler2::MachineBasicBlock::phi_begin ( ) const
inline

returns an const iterator to the phi instructions

Definition at line 455 of file MachineBasicBlock.hpp.

void cacao::jit::compiler2::MachineBasicBlock::phi_clear ( )
inline

removes all phi nodes

Definition at line 464 of file MachineBasicBlock.hpp.

MachineBasicBlock::const_phi_iterator cacao::jit::compiler2::MachineBasicBlock::phi_end ( ) const
inline

returns an const iterator to the phi instructions

Definition at line 458 of file MachineBasicBlock.hpp.

std::size_t cacao::jit::compiler2::MachineBasicBlock::phi_size ( ) const
inline

returns the number of phi nodes

Definition at line 461 of file MachineBasicBlock.hpp.

MachineBasicBlock::const_pred_iterator cacao::jit::compiler2::MachineBasicBlock::pred_begin ( ) const
inline

returns an const iterator to the predecessors

Definition at line 471 of file MachineBasicBlock.hpp.

MachineBasicBlock::pred_iterator cacao::jit::compiler2::MachineBasicBlock::pred_begin ( )
inline

returns an iterator to the predecessors

Definition at line 477 of file MachineBasicBlock.hpp.

MachineBasicBlock::const_pred_iterator cacao::jit::compiler2::MachineBasicBlock::pred_end ( ) const
inline

returns an const iterator to the predecessors

Definition at line 474 of file MachineBasicBlock.hpp.

MachineBasicBlock::pred_iterator cacao::jit::compiler2::MachineBasicBlock::pred_end ( )
inline

returns an iterator to the predecessors

Definition at line 480 of file MachineBasicBlock.hpp.

std::size_t cacao::jit::compiler2::MachineBasicBlock::pred_size ( ) const
inline

returns the number of predecessor nodes

Definition at line 483 of file MachineBasicBlock.hpp.

OStream & cacao::jit::compiler2::MachineBasicBlock::print ( OStream OS) const

print

Definition at line 44 of file MachineBasicBlock.cpp.

void cacao::jit::compiler2::MachineBasicBlock::push_back ( MachineInstruction value)
inline

Appends the given element value to the end of the container.

Definition at line 334 of file MachineBasicBlock.hpp.

void cacao::jit::compiler2::MachineBasicBlock::push_front ( MachineInstruction value)
inline

inserts value to the beginning

Definition at line 339 of file MachineBasicBlock.hpp.

MachineBasicBlock::reverse_iterator cacao::jit::compiler2::MachineBasicBlock::rbegin ( )
inline

returns an reverse_iterator to the beginning

Definition at line 398 of file MachineBasicBlock.hpp.

MachineBasicBlock::const_reverse_iterator cacao::jit::compiler2::MachineBasicBlock::rbegin ( ) const
inline

returns an const reverse_iterator to the beginning

Definition at line 404 of file MachineBasicBlock.hpp.

MachineBasicBlock::reverse_iterator cacao::jit::compiler2::MachineBasicBlock::rend ( )
inline

returns an reverse_iterator to the end

Definition at line 401 of file MachineBasicBlock.hpp.

MachineBasicBlock::const_reverse_iterator cacao::jit::compiler2::MachineBasicBlock::rend ( ) const
inline

returns an const reverse_iterator to the end

Definition at line 407 of file MachineBasicBlock.hpp.

MBBIterator cacao::jit::compiler2::MachineBasicBlock::self_iterator ( ) const
inline

get self iterator

Definition at line 442 of file MachineBasicBlock.hpp.

std::size_t cacao::jit::compiler2::MachineBasicBlock::size ( ) const
inline

returns the number of elements

Definition at line 331 of file MachineBasicBlock.hpp.

void cacao::jit::compiler2::MachineBasicBlock::update ( MachineInstruction MI)
private

update instruction block

Definition at line 48 of file MachineBasicBlock.cpp.

Friends And Related Function Documentation

friend class MachineInstructionSchedule
friend

Definition at line 285 of file MachineBasicBlock.hpp.

friend class MBBBuilder
friend

Definition at line 284 of file MachineBasicBlock.hpp.

Field Documentation

std::size_t cacao::jit::compiler2::MachineBasicBlock::id
private

Definition at line 276 of file MachineBasicBlock.hpp.

std::size_t cacao::jit::compiler2::MachineBasicBlock::id_counter = 0
staticprivate

Definition at line 275 of file MachineBasicBlock.hpp.

Container cacao::jit::compiler2::MachineBasicBlock::list
private

Definition at line 280 of file MachineBasicBlock.hpp.

MBBIterator cacao::jit::compiler2::MachineBasicBlock::my_it
private

Definition at line 277 of file MachineBasicBlock.hpp.

PhiListTy cacao::jit::compiler2::MachineBasicBlock::phi
private

Definition at line 281 of file MachineBasicBlock.hpp.

PredListTy cacao::jit::compiler2::MachineBasicBlock::predecessors
private

Definition at line 282 of file MachineBasicBlock.hpp.


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