mc2lib
|
#include <compiler.hpp>
Public Types | |
typedef EvtStateT | EvtState |
typedef std::shared_ptr< Op > | Ptr |
typedef std::vector< Ptr > | Thread |
typedef Thread::const_iterator | ThreadIt |
typedef std::unordered_map< types::Pid, Thread > | Threads |
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< Callback > | CallbackStack |
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::Event * | LastEvent (const mc::Event *next_event, EvtState *evts) const =0 |
virtual const mc::Event * | FirstEvent (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) |
Baseclass for Operation implementations.
typedef std::function<std::size_t(Op *, types::InstPtr, Backend *, EvtState *, void *, std::size_t)> mc2lib::codegen::Op< Backend, EvtStateT >::Callback |
typedef std::vector<Callback> mc2lib::codegen::Op< Backend, EvtStateT >::CallbackStack |
typedef EvtStateT mc2lib::codegen::Op< Backend, EvtStateT >::EvtState |
typedef std::shared_ptr<Op> mc2lib::codegen::Op< Backend, EvtStateT >::Ptr |
typedef std::vector<Ptr> mc2lib::codegen::Op< Backend, EvtStateT >::Thread |
typedef std::vector<const Op *> mc2lib::codegen::Op< Backend, EvtStateT >::ThreadConst |
typedef ThreadConst::const_iterator mc2lib::codegen::Op< Backend, EvtStateT >::ThreadConstIt |
typedef Thread::const_iterator mc2lib::codegen::Op< Backend, EvtStateT >::ThreadIt |
typedef std::vector<std::pair<ThreadIt, ThreadIt> > mc2lib::codegen::Op< Backend, EvtStateT >::ThreadItStack |
typedef std::unordered_map<types::Pid, Thread> mc2lib::codegen::Op< Backend, EvtStateT >::Threads |
|
inlineexplicit |
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in mc2lib::codegen::strong::ReadSequence.
|
pure virtual |
Clone the instance.
Implemented in mc2lib::codegen::strong::ReadSequence, mc2lib::codegen::armv7::DMB_ST, mc2lib::codegen::strong::CacheFlush, mc2lib::codegen::armv7::Write, mc2lib::codegen::armv7::ReadAddrDp, mc2lib::codegen::strong::ReadModifyWrite, mc2lib::codegen::armv7::Read, mc2lib::codegen::strong::Write, mc2lib::codegen::strong::ReadAddrDp, mc2lib::codegen::armv7::Delay, mc2lib::codegen::armv7::Return, mc2lib::codegen::strong::Read, mc2lib::codegen::strong::Delay, and mc2lib::codegen::strong::Return.
|
pure virtual |
Emit machine code.
start | Instruction pointer to first instruction when executing. | |
[in,out] | backend | Architecture backend. |
[in,out] | evts | Pointer to EvtState instance of calling Compiler. |
[out] | code | Pointer to memory to be copied into. |
len | Maximum lenth of code. |
Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.
|
pure virtual |
Prepares the operation for emit; common emit code.
[in,out] | evts | Pointer to EvtState instance of calling Compiler. |
Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.
|
pure virtual |
Accessor for first event generated.
prev_event | Event before first in program order; nullptr if none exists. | |
[in,out] | evts | Pointer to EvtState instance maintained by Compiler. |
Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.
|
pure virtual |
|
pure virtual |
Accessor for last event generated. Also used to insert additional ordering based on passed next_event (e.g. fences).
next_event | Event after last in program order; nullptr if none exists. | |
[in,out] | evts | Pointer to EvtState instance maintained by Compiler. |
Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.
|
inline |
|
inlinevirtual |
Optionally register callback.
[out] | callback_stack | Pointer to callback_stack with which to register the callback. |
Reimplemented in mc2lib::codegen::armv7::DMB_ST.
|
pure virtual |
Provide Reset, as emit functions may modify the state of an Op to store information to map instructions to events.
Implemented in mc2lib::codegen::strong::ReadSequence, mc2lib::codegen::armv7::DMB_ST, mc2lib::codegen::strong::CacheFlush, mc2lib::codegen::armv7::Write, mc2lib::codegen::strong::ReadModifyWrite, mc2lib::codegen::armv7::Read, mc2lib::codegen::strong::Write, mc2lib::codegen::armv7::Delay, mc2lib::codegen::armv7::Return, mc2lib::codegen::strong::Read, mc2lib::codegen::strong::Delay, and mc2lib::codegen::strong::Return.
|
inline |
|
pure virtual |
Updates dynamic observation for instruction's memory operation.
ip | Instruction pointer of instruction for which a value was observed. | |
part | Which part of an instruction; e.g., if an instruction generates multiple memory events, part can be used to denote which. | |
addr | Address for observed operation. | |
from_id | Pointer to observed memory (WriteIDs). | |
size | Total size of observed memory operations in from_id; implementation should assert expected size. | |
[in,out] | evts | Pointer to EvtState instance maintained by Compiler. |
Implemented in mc2lib::codegen::NullOp< Backend, EvtState >.
|
friend |
|
friend |
|
private |