ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
etiss::instr::Instruction Class Reference

holds information and translation callbacks for an instruction. More...

#include <Instruction.h>

Inheritance diagram for etiss::instr::Instruction:
Inheritance graph
[legend]
Collaboration diagram for etiss::instr::Instruction:
Collaboration graph
[legend]

Public Member Functions

 Instruction (const OPCode &opc, const std::string &name)
 
template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
 Instruction (unsigned width, const T code, const T mask, const std::string &name)
 
virtual std::string print (std::string indent, I pos, unsigned pfillwidth, bool printunused=false)
 
bool addCallback (std::function< bool(BitArray &, etiss::CodeSet &, InstructionContext &)> callback, uint32_t builtinGroups, const std::set< uint32_t > &groups=std::set< uint32_t >())
 
bool translate (BitArray &, CodeSet &cs, InstructionContext &context)
 
uint32_tpresentBuiltinGroups ()
 
std::set< uint32_t > & presentGroups ()
 
std::string printASM (BitArray &)
 
void setASMPrinter (std::function< std::string(BitArray &, Instruction &)> printer)
 
std::string toString () const
 
- Public Member Functions inherited from etiss::ToString
 ToString ()
 
virtual ~ToString ()
 

Static Public Member Functions

static std::string printASMSimple (BitArray &ba, Instruction &instr)
 

Public Attributes

etiss_del_como(Instruction) enum class BUILTINGROUP const BitArray::size_type width
 
const OPCode opc_
 
const std::string name_
 

Private Attributes

std::list< std::tuple< std::function< bool(BitArray &, etiss::CodeSet &, InstructionContext &)>, uint32_t, std::set< uint32_t > > > callbacks_
 
uint32_t builtinGroups_
 
std::set< uint32_tgroups_
 
std::function< std::string(BitArray &, Instruction &)> printer_
 

Detailed Description

holds information and translation callbacks for an instruction.

    Location in an instruction translation tree:
    ModedInstructionSetVariableInstructionSet (e.g. for mode 0)
            ↳ InstructionSet (e.g. 32 bit)
                ↳ Instruction (e.g. LDR, STR)
            ↳ InstructionSet (e.g. 16 bit)

Definition at line 392 of file Instruction.h.

Constructor & Destructor Documentation

◆ Instruction() [1/2]

etiss::instr::Instruction::Instruction ( const OPCode opc,
const std::string &  name 
)

Definition at line 266 of file Instruction.cpp.

◆ Instruction() [2/2]

template<typename T , typename = typename std::enable_if<std::is_integral<T>::value, T>::type>
etiss::instr::Instruction::Instruction ( unsigned  width,
const T  code,
const T  mask,
const std::string &  name 
)
inline

Definition at line 416 of file Instruction.h.

Member Function Documentation

◆ addCallback()

bool etiss::instr::Instruction::addCallback ( std::function< bool(BitArray &, etiss::CodeSet &, InstructionContext &)>  callback,
uint32_t  builtinGroups,
const std::set< uint32_t > &  groups = std::set<uint32_t>() 
)

◆ presentBuiltinGroups()

uint32_t & etiss::instr::Instruction::presentBuiltinGroups ( )

Definition at line 330 of file Instruction.cpp.

References builtinGroups_.

Referenced by CPUArch_finalizeInstrSet().

Here is the caller graph for this function:

◆ presentGroups()

std::set< uint32_t > & etiss::instr::Instruction::presentGroups ( )

Definition at line 334 of file Instruction.cpp.

References groups_.

◆ print()

std::string etiss::instr::Instruction::print ( std::string  indent,
I  pos,
unsigned  pfillwidth,
bool  printunused = false 
)
virtual

Definition at line 277 of file Instruction.cpp.

References name_.

◆ printASM()

std::string etiss::instr::Instruction::printASM ( BitArray ba)

Definition at line 339 of file Instruction.cpp.

References printer_.

Referenced by etiss::Translation::disasm(), and etiss::plugin::PrintInstruction::finalizeInstrSet().

Here is the caller graph for this function:

◆ printASMSimple()

std::string etiss::instr::Instruction::printASMSimple ( BitArray ba,
Instruction instr 
)
static

Definition at line 270 of file Instruction.cpp.

References name_.

Referenced by setASMPrinter().

Here is the caller graph for this function:

◆ setASMPrinter()

void etiss::instr::Instruction::setASMPrinter ( std::function< std::string(BitArray &, Instruction &)>  printer)

Definition at line 344 of file Instruction.cpp.

References printASMSimple(), and printer_.

Referenced by etiss::instr::InstructionDefinition::addTo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

std::string etiss::instr::Instruction::toString ( ) const
inline

Definition at line 428 of file Instruction.h.

References name_.

◆ translate()

bool etiss::instr::Instruction::translate ( BitArray ba,
CodeSet cs,
InstructionContext context 
)

Definition at line 320 of file Instruction.cpp.

References callbacks_.

Referenced by etiss::Translation::translateBlock().

Here is the caller graph for this function:

Member Data Documentation

◆ builtinGroups_

uint32_t etiss::instr::Instruction::builtinGroups_
private

Definition at line 397 of file Instruction.h.

Referenced by addCallback(), and presentBuiltinGroups().

◆ callbacks_

std::list<std::tuple<std::function<bool(BitArray &, etiss::CodeSet &, InstructionContext &)>, uint32_t, std::set<uint32_t> > > etiss::instr::Instruction::callbacks_
private

Definition at line 396 of file Instruction.h.

Referenced by addCallback(), and translate().

◆ groups_

std::set<uint32_t> etiss::instr::Instruction::groups_
private

Definition at line 398 of file Instruction.h.

Referenced by addCallback(), and presentGroups().

◆ name_

const std::string etiss::instr::Instruction::name_

Definition at line 410 of file Instruction.h.

Referenced by print(), printASMSimple(), and toString().

◆ opc_

const OPCode etiss::instr::Instruction::opc_

◆ printer_

std::function<std::string(BitArray &, Instruction &)> etiss::instr::Instruction::printer_
private

Definition at line 399 of file Instruction.h.

Referenced by printASM(), and setASMPrinter().

◆ width

etiss_del_como (Instruction) enum class BUILTINGROUP const BitArray::size_type etiss::instr::Instruction::width

Definition at line 408 of file Instruction.h.


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