mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends
m::wasm::Block Struct Referencefinal

Represents a code block, i.e. More...

#include <WasmDSL.hpp>

Collaboration diagram for m::wasm::Block:
[legend]

Public Member Functions

 Block (bool attach_to_parent)
 Create an anonymous Block.
 
 Block (std::string name, bool attach_to_parent)
 Create a named Block and set it active in the current Module.
 
 Block (const char *name, bool attach_to_parent)
 Create a named Block and set it active in the current Module.
 
 Block (Block &&other)
 
 ~Block ()
 
Blockoperator= (Block &&other)
 
bool has_name () const
 
std::string name () const
 
bool empty () const
 Returns whether this Block is empty, i.e.
 
void attach_to (Block &other)
 Attaches this Block to the given Block other.
 
void attach_to_current ()
 Attaches this Block to the wasm::Block currently active in the Module.
 
void go_to () const
 Emits a jump to the end of this Block.
 
void go_to (PrimitiveExpr< bool, 1 > cond) const
 Emits a jump to the end of this Block iff cond is fulfilled.
 
void dump (std::ostream &out) const
 
void dump () const
 

Private Member Functions

 Block ()=default
 
 Block (::wasm::Block *block, bool attach_to_parent)
 Create a new Block for a given ::wasm::Block.
 
::wasm::Block & get () const
 
::wasm::Block & previous () const
 
void attach_to (::wasm::Block &other)
 

Private Attributes

::wasm::Block * this_block_ = nullptr
 

‍this block, can be nullptr if default-constructed or the block has already been attached


 
::wasm::Block * parent_block_ = nullptr
 

‍the parent block, before this block was created


 
bool attach_to_parent_ = false
 

‍whether this block attaches itself to its parent block


 

Friends

template<typename T >
struct Function
 
struct BlockUser
 
struct If
 
struct Loop
 
struct DoWhile
 
void swap (Block &first, Block &second)
 
std::ostream & operator<< (std::ostream &out, const Block &B)
 

Detailed Description

Represents a code block, i.e.

a sequential sequence of code. Necessary to compose conditional control flow and useful for simultaneous code generation at several locations.

Definition at line 1004 of file WasmDSL.hpp.

Constructor & Destructor Documentation

◆ Block() [1/6]

m::wasm::Block::Block ( )
privatedefault

◆ Block() [2/6]

m::wasm::Block::Block ( ::wasm::Block *  block,
bool  attach_to_parent 
)
inlineprivate

Create a new Block for a given ::wasm::Block.

Definition at line 1032 of file WasmDSL.hpp.

References M_insist.

◆ Block() [3/6]

m::wasm::Block::Block ( bool  attach_to_parent)
inlineexplicit

Create an anonymous Block.

Definition at line 1044 of file WasmDSL.hpp.

◆ Block() [4/6]

m::wasm::Block::Block ( std::string  name,
bool  attach_to_parent 
)
inlineexplicit

Create a named Block and set it active in the current Module.

Definition at line 1046 of file WasmDSL.hpp.

◆ Block() [5/6]

m::wasm::Block::Block ( const char *  name,
bool  attach_to_parent 
)
inlineexplicit

Create a named Block and set it active in the current Module.

Definition at line 1050 of file WasmDSL.hpp.

◆ Block() [6/6]

m::wasm::Block::Block ( Block &&  other)
inline

Definition at line 1052 of file WasmDSL.hpp.

References m::swap().

◆ ~Block()

m::wasm::Block::~Block ( )
inline

Definition at line 1054 of file WasmDSL.hpp.

References m::and, and M_notnull.

Member Function Documentation

◆ attach_to() [1/2]

void m::wasm::Block::attach_to ( ::wasm::Block &  other)
inlineprivate

Definition at line 1065 of file WasmDSL.hpp.

◆ attach_to() [2/2]

void m::wasm::Block::attach_to ( Block other)
inline

Attaches this Block to the given Block other.

Definition at line 1078 of file WasmDSL.hpp.

References M_insist, M_notnull, and this_block_.

◆ attach_to_current()

void m::wasm::Block::attach_to_current ( )
inline

◆ dump() [1/2]

void m::wasm::Block::dump ( ) const
inline

Definition at line 1112 of file WasmDSL.hpp.

References dump().

Referenced by dump().

◆ dump() [2/2]

void m::wasm::Block::dump ( std::ostream &  out) const
inline

Definition at line 1111 of file WasmDSL.hpp.

◆ empty()

bool m::wasm::Block::empty ( ) const
inline

Returns whether this Block is empty, i.e.

contains to expressions.

Definition at line 1075 of file WasmDSL.hpp.

Referenced by m::wasm::and().

◆ get()

::wasm::Block & m::wasm::Block::get ( ) const
inlineprivate

Definition at line 1062 of file WasmDSL.hpp.

References M_notnull.

Referenced by m::wasm::Loop::Loop(), m::wasm::ReturnL(), and m::wasm::If::~If().

◆ go_to() [1/2]

void m::wasm::Block::go_to ( ) const
inline

Emits a jump to the end of this Block.

Definition at line 1090 of file WasmDSL.hpp.

Referenced by m::wasm::GOTO().

◆ go_to() [2/2]

void m::wasm::Block::go_to ( PrimitiveExpr< bool, 1 >  cond) const
inline

Emits a jump to the end of this Block iff cond is fulfilled.

Definition at line 6983 of file WasmDSL.hpp.

◆ has_name()

bool m::wasm::Block::has_name ( ) const
inline

Definition at line 1071 of file WasmDSL.hpp.

References m::wasm::bool.

◆ name()

std::string m::wasm::Block::name ( ) const
inline

Definition at line 1072 of file WasmDSL.hpp.

References M_insist.

Referenced by m::wasm::Loop::Loop().

◆ operator=()

Block & m::wasm::Block::operator= ( Block &&  other)
inline

Definition at line 1059 of file WasmDSL.hpp.

References m::swap().

◆ previous()

::wasm::Block & m::wasm::Block::previous ( ) const
inlineprivate

Definition at line 1063 of file WasmDSL.hpp.

References M_notnull.

Friends And Related Function Documentation

◆ BlockUser

friend struct BlockUser
friend

Definition at line 1007 of file WasmDSL.hpp.

◆ DoWhile

friend struct DoWhile
friend

Definition at line 1010 of file WasmDSL.hpp.

◆ Function

template<typename T >
friend struct Function
friend

Definition at line 1006 of file WasmDSL.hpp.

◆ If

friend struct If
friend

Definition at line 1008 of file WasmDSL.hpp.

◆ Loop

friend struct Loop
friend

Definition at line 1009 of file WasmDSL.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const Block B 
)
friend

Definition at line 1094 of file WasmDSL.hpp.

◆ swap

void swap ( Block first,
Block second 
)
friend

Definition at line 1021 of file WasmDSL.hpp.

Field Documentation

◆ attach_to_parent_

bool m::wasm::Block::attach_to_parent_ = false
private

‍whether this block attaches itself to its parent block

Definition at line 1018 of file WasmDSL.hpp.

◆ parent_block_

::wasm::Block* m::wasm::Block::parent_block_ = nullptr
private

‍the parent block, before this block was created

Definition at line 1016 of file WasmDSL.hpp.

◆ this_block_

::wasm::Block* m::wasm::Block::this_block_ = nullptr
private

‍this block, can be nullptr if default-constructed or the block has already been attached

Definition at line 1014 of file WasmDSL.hpp.

Referenced by attach_to(), and m::wasm::BlockUser::BlockUser().


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