decompiler  1.0.0
Public Member Functions | Private Attributes | List of all members
PcodeOpRaw Class Reference

A low-level representation of a single pcode operation. More...

#include <pcoderaw.hh>

Public Member Functions

void setBehavior (OpBehavior *be)
 Set the opcode for this op. More...
 
OpBehaviorgetBehavior (void) const
 Retrieve the behavior for this op. More...
 
OpCode getOpcode (void) const
 Get the opcode for this op. More...
 
void setSeqNum (const Address &a, uintm b)
 Set the sequence number. More...
 
const SeqNumgetSeqNum (void) const
 Retrieve the sequence number. More...
 
const AddressgetAddr (void) const
 Get address of this operation. More...
 
void setOutput (VarnodeData *o)
 Set the output varnode for this op. More...
 
VarnodeDatagetOutput (void) const
 Retrieve the output varnode for this op. More...
 
void addInput (VarnodeData *i)
 Add an additional input varnode to this op. More...
 
void clearInputs (void)
 Remove all input varnodes to this op. More...
 
int4 numInput (void) const
 Get the number of input varnodes to this op. More...
 
VarnodeDatagetInput (int4 i) const
 Get the i-th input varnode for this op. More...
 

Private Attributes

OpBehaviorbehave
 The opcode for this operation.
 
SeqNum seq
 Identifying address and index of this operation.
 
VarnodeDataout
 Output varnode triple.
 
vector< VarnodeData * > in
 Raw varnode inputs to this op.
 

Detailed Description

A low-level representation of a single pcode operation.

This is just the minimum amount of data to represent a pcode operation An opcode, sequence number, optional output varnode and input varnodes

Member Function Documentation

◆ addInput()

void PcodeOpRaw::addInput ( VarnodeData i)
inline

Add an additional input varnode to this op.

A PcodeOpRaw is initially created with no input varnodes. Inputs are added with this method. Varnodes are added in order, so the first addInput call creates input 0, for example.

Parameters
iis the varnode to be added as input

References in.

Referenced by PcodeEmitCache::dump().

◆ clearInputs()

void PcodeOpRaw::clearInputs ( void  )
inline

Remove all input varnodes to this op.

If the inputs to a pcode operation need to be changed, this routine clears the existing inputs so new ones can be added.

References in.

◆ getAddr()

const Address & PcodeOpRaw::getAddr ( void  ) const
inline

Get address of this operation.

This is a convenience function to get the address of the machine instruction (of which this pcode op is a translation)

Returns
the machine instruction address

References SeqNum::getAddr(), and seq.

Referenced by EmulateMemory::executeBranchind(), EmulateMemory::executeCallind(), and EmulateSnippet::getExecuteAddress().

◆ getBehavior()

OpBehavior * PcodeOpRaw::getBehavior ( void  ) const
inline

Retrieve the behavior for this op.

Get the underlying behavior object for this pcode operation. From this object you can determine how the object evaluates inputs to get the output

Returns
the behavior object

References behave.

Referenced by EmulatePcodeCache::establishOp(), and EmulateSnippet::setCurrentOp().

◆ getInput()

VarnodeData * PcodeOpRaw::getInput ( int4  i) const
inline

Get the i-th input varnode for this op.

Input varnodes are indexed starting at 0. This retrieves the input varnode by index. The index must be in range, or unpredicatable behavior will result. Use the numInput method to get the number of inputs.

Parameters
iis the index of the desired input
Returns
the desired input varnode

References in.

Referenced by EmulateSnippet::checkForLegalCode(), BreakTableCallBack::doPcodeOpBreak(), EmulateSnippet::executeBinary(), EmulateMemory::executeBinary(), EmulateSnippet::executeBranch(), EmulateMemory::executeBranch(), EmulatePcodeCache::executeBranch(), EmulateMemory::executeBranchind(), EmulateMemory::executeCall(), EmulateMemory::executeCallind(), EmulateSnippet::executeCbranch(), EmulateMemory::executeCbranch(), EmulateSnippet::executeLoad(), EmulateMemory::executeLoad(), EmulateMemory::executeStore(), EmulateSnippet::executeUnary(), and EmulateMemory::executeUnary().

◆ getOpcode()

OpCode PcodeOpRaw::getOpcode ( void  ) const
inline

◆ getOutput()

VarnodeData * PcodeOpRaw::getOutput ( void  ) const
inline

Retrieve the output varnode for this op.

Most pcode operations have an output varnode. This routine retrieves that varnode.

Returns
the output varnode or null if there is no output

References out.

Referenced by EmulateSnippet::checkForLegalCode(), EmulateSnippet::executeBinary(), EmulateMemory::executeBinary(), EmulateSnippet::executeLoad(), EmulateMemory::executeLoad(), EmulateSnippet::executeUnary(), and EmulateMemory::executeUnary().

◆ getSeqNum()

const SeqNum & PcodeOpRaw::getSeqNum ( void  ) const
inline

Retrieve the sequence number.

Every pcode operation has a sequence number which associates the operation with the address of the machine instruction being translated and an index number for this operation within the translation.

Returns
a reference to the sequence number

References seq.

◆ numInput()

int4 PcodeOpRaw::numInput ( void  ) const
inline

Get the number of input varnodes to this op.

Returns
the number of inputs

References in.

Referenced by EmulateSnippet::checkForLegalCode().

◆ setBehavior()

void PcodeOpRaw::setBehavior ( OpBehavior be)
inline

Set the opcode for this op.

The core behavior for this operation is controlled by an OpBehavior object which knows how output is determined given inputs. This routine sets that object

Parameters
beis the behavior object

References behave.

Referenced by PcodeEmitCache::dump().

◆ setOutput()

void PcodeOpRaw::setOutput ( VarnodeData o)
inline

Set the output varnode for this op.

Most pcode operations output to a varnode. This routine sets what that varnode is.

Parameters
ois the varnode to set as output

References out.

Referenced by PcodeEmitCache::dump().

◆ setSeqNum()

void PcodeOpRaw::setSeqNum ( const Address a,
uintm  b 
)
inline

Set the sequence number.

Every pcode operation has a sequence number which associates the operation with the address of the machine instruction being translated and an order number which provides an index for this particular operation within the entire translation of the machine instruction

Parameters
ais the instruction address
bis the order number

References seq.

Referenced by PcodeEmitCache::dump().


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