mc2lib
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
mc2lib::codegen::Op< Backend, EvtStateT > Class Template Referenceabstract

#include <compiler.hpp>

Inheritance diagram for mc2lib::codegen::Op< Backend, EvtStateT >:
mc2lib::codegen::armv7::Delay mc2lib::codegen::armv7::DMB_ST mc2lib::codegen::armv7::Return mc2lib::codegen::strong::Delay mc2lib::codegen::strong::Return

Public Types

typedef EvtStateT EvtState
 
typedef std::shared_ptr< OpPtr
 
typedef std::vector< PtrThread
 
typedef Thread::const_iterator ThreadIt
 
typedef std::unordered_map< types::Pid, ThreadThreads
 
typedef std::vector< std::pair< ThreadIt, ThreadIt > > ThreadItStack
 
typedef std::vector< const Op * > ThreadConst
 
typedef ThreadConst::const_iterator ThreadConstIt
 
typedef std::function< std::size_t(Op *, types::InstPtr, Backend *, EvtState *, void *, std::size_t)> Callback
 
typedef std::vector< CallbackCallbackStack
 

Public Member Functions

 Op (types::Pid pid)
 
virtual ~Op ()
 
virtual void AdvanceThread (ThreadItStack *it_stack) const
 
virtual Ptr Clone () const =0
 
virtual void Reset ()=0
 
virtual bool EnableEmit (EvtState *evts)=0
 
virtual void InsertPo (ThreadConstIt before, EvtState *evts)=0
 
virtual void RegisterCallback (CallbackStack *callback_stack)
 
virtual std::size_t Emit (types::InstPtr start, Backend *backend, EvtState *evts, void *code, std::size_t len)=0
 
virtual const mc::EventLastEvent (const mc::Event *next_event, EvtState *evts) const =0
 
virtual const mc::EventFirstEvent (const mc::Event *prev_event, EvtState *evts) const =0
 
virtual bool UpdateObs (types::InstPtr ip, int part, types::Addr addr, const types::WriteID *from_id, std::size_t size, EvtState *evts)=0
 
types::Pid pid () const
 
void set_pid (types::Pid pid)
 

Private Attributes

types::Pid pid_
 

Friends

template<class T >
Threads ExtractThreads (T *container)
 
std::size_t threads_size (const Threads &threads)
 

Detailed Description

template<class Backend, class EvtStateT>
class mc2lib::codegen::Op< Backend, EvtStateT >

Baseclass for Operation implementations.

Member Typedef Documentation

§ Callback

template<class Backend, class EvtStateT>
typedef std::function<std::size_t(Op *, types::InstPtr, Backend *, EvtState *, void *, std::size_t)> mc2lib::codegen::Op< Backend, EvtStateT >::Callback

§ CallbackStack

template<class Backend, class EvtStateT>
typedef std::vector<Callback> mc2lib::codegen::Op< Backend, EvtStateT >::CallbackStack

§ EvtState

template<class Backend, class EvtStateT>
typedef EvtStateT mc2lib::codegen::Op< Backend, EvtStateT >::EvtState

§ Ptr

template<class Backend, class EvtStateT>
typedef std::shared_ptr<Op> mc2lib::codegen::Op< Backend, EvtStateT >::Ptr

§ Thread

template<class Backend, class EvtStateT>
typedef std::vector<Ptr> mc2lib::codegen::Op< Backend, EvtStateT >::Thread

§ ThreadConst

template<class Backend, class EvtStateT>
typedef std::vector<const Op *> mc2lib::codegen::Op< Backend, EvtStateT >::ThreadConst

§ ThreadConstIt

template<class Backend, class EvtStateT>
typedef ThreadConst::const_iterator mc2lib::codegen::Op< Backend, EvtStateT >::ThreadConstIt

§ ThreadIt

template<class Backend, class EvtStateT>
typedef Thread::const_iterator mc2lib::codegen::Op< Backend, EvtStateT >::ThreadIt

§ ThreadItStack

template<class Backend, class EvtStateT>
typedef std::vector<std::pair<ThreadIt, ThreadIt> > mc2lib::codegen::Op< Backend, EvtStateT >::ThreadItStack

§ Threads

template<class Backend, class EvtStateT>
typedef std::unordered_map<types::Pid, Thread> mc2lib::codegen::Op< Backend, EvtStateT >::Threads

Constructor & Destructor Documentation

§ Op()

template<class Backend, class EvtStateT>
mc2lib::codegen::Op< Backend, EvtStateT >::Op ( types::Pid  pid)
inlineexplicit

§ ~Op()

template<class Backend, class EvtStateT>
virtual mc2lib::codegen::Op< Backend, EvtStateT >::~Op ( )
inlinevirtual

Member Function Documentation

§ AdvanceThread()

template<class Backend, class EvtStateT>
virtual void mc2lib::codegen::Op< Backend, EvtStateT >::AdvanceThread ( ThreadItStack it_stack) const
inlinevirtual

§ Clone()

template<class Backend, class EvtStateT>
virtual Ptr mc2lib::codegen::Op< Backend, EvtStateT >::Clone ( ) const
pure virtual

§ Emit()

template<class Backend, class EvtStateT>
virtual std::size_t mc2lib::codegen::Op< Backend, EvtStateT >::Emit ( types::InstPtr  start,
Backend *  backend,
EvtState evts,
void *  code,
std::size_t  len 
)
pure virtual

Emit machine code.

Parameters
startInstruction pointer to first instruction when executing.
[in,out]backendArchitecture backend.
[in,out]evtsPointer to EvtState instance of calling Compiler.
[out]codePointer to memory to be copied into.
lenMaximum lenth of code.
Returns
Size of emitted code.

Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.

§ EnableEmit()

template<class Backend, class EvtStateT>
virtual bool mc2lib::codegen::Op< Backend, EvtStateT >::EnableEmit ( EvtState evts)
pure virtual

Prepares the operation for emit; common emit code.

Parameters
[in,out]evtsPointer to EvtState instance of calling Compiler.
Returns
true if can emit; false otherwise.

Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.

§ FirstEvent()

template<class Backend, class EvtStateT>
virtual const mc::Event* mc2lib::codegen::Op< Backend, EvtStateT >::FirstEvent ( const mc::Event prev_event,
EvtState evts 
) const
pure virtual

Accessor for first event generated.

Parameters
prev_eventEvent before first in program order; nullptr if none exists.
[in,out]evtsPointer to EvtState instance maintained by Compiler.
Returns
First event in program-order; nullptr if none exists.

Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.

§ InsertPo()

template<class Backend, class EvtStateT>
virtual void mc2lib::codegen::Op< Backend, EvtStateT >::InsertPo ( ThreadConstIt  before,
EvtState evts 
)
pure virtual

Generate static program-order relation.

Parameters
beforePointer to last Op; nullptr if none exists.
[in,out]evtsPointer to EvtState instance maintained by Compiler.

§ LastEvent()

template<class Backend, class EvtStateT>
virtual const mc::Event* mc2lib::codegen::Op< Backend, EvtStateT >::LastEvent ( const mc::Event next_event,
EvtState evts 
) const
pure virtual

Accessor for last event generated. Also used to insert additional ordering based on passed next_event (e.g. fences).

Parameters
next_eventEvent after last in program order; nullptr if none exists.
[in,out]evtsPointer to EvtState instance maintained by Compiler.
Returns
Last event in program-order; nullptr if none exists.

Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.

§ pid()

template<class Backend, class EvtStateT>
types::Pid mc2lib::codegen::Op< Backend, EvtStateT >::pid ( ) const
inline

§ RegisterCallback()

template<class Backend, class EvtStateT>
virtual void mc2lib::codegen::Op< Backend, EvtStateT >::RegisterCallback ( CallbackStack callback_stack)
inlinevirtual

Optionally register callback.

Parameters
[out]callback_stackPointer to callback_stack with which to register the callback.

Reimplemented in mc2lib::codegen::armv7::DMB_ST.

§ Reset()

template<class Backend, class EvtStateT>
virtual void mc2lib::codegen::Op< Backend, EvtStateT >::Reset ( )
pure virtual

§ set_pid()

template<class Backend, class EvtStateT>
void mc2lib::codegen::Op< Backend, EvtStateT >::set_pid ( types::Pid  pid)
inline

§ UpdateObs()

template<class Backend, class EvtStateT>
virtual bool mc2lib::codegen::Op< Backend, EvtStateT >::UpdateObs ( types::InstPtr  ip,
int  part,
types::Addr  addr,
const types::WriteID from_id,
std::size_t  size,
EvtState evts 
)
pure virtual

Updates dynamic observation for instruction's memory operation.

Parameters
ipInstruction pointer of instruction for which a value was observed.
partWhich part of an instruction; e.g., if an instruction generates multiple memory events, part can be used to denote which.
addrAddress for observed operation.
from_idPointer to observed memory (WriteIDs).
sizeTotal size of observed memory operations in from_id; implementation should assert expected size.
[in,out]evtsPointer to EvtState instance maintained by Compiler.
Returns
Success or not.

Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.

Friends And Related Function Documentation

§ ExtractThreads

template<class Backend, class EvtStateT>
template<class T >
Threads ExtractThreads ( T *  container)
friend

§ threads_size

template<class Backend, class EvtStateT>
std::size_t threads_size ( const Threads threads)
friend

Member Data Documentation

§ pid_

template<class Backend, class EvtStateT>
types::Pid mc2lib::codegen::Op< Backend, EvtStateT >::pid_
private

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