|
decompiler 1.0.0
|
P-code semantics for Constructor in a SLEIGH specification. More...
#include <semantics.hh>
Public Member Functions | |
| ConstructTpl (void) | |
| Construct an empty ConstructTpl. | |
| ~ConstructTpl (void) | |
| Destructor. More... | |
| uint4 | delaySlot (void) const |
| Return the number of bytes in the delay slot. | |
| uint4 | numLabels (void) const |
| Get the number of labels. | |
| const vector< OpTpl * > & | getOpvec (void) const |
| Get the sequence of p-code operations. | |
| HandleTpl * | getResult (void) const |
| Get the export result. | |
| bool | addOp (OpTpl *ot) |
| Add an operation to the end of the sequence. More... | |
| bool | addOpList (const vector< OpTpl * > &oplist) |
| Add a list of operations to the end of the sequence. More... | |
| void | setResult (HandleTpl *t) |
| Set the export HandleTpl for this. | |
| int4 | fillinBuild (vector< int4 > &check, AddrSpace *const_space) |
| Make sure there is a build directive for all sub-constructors. More... | |
| bool | buildOnly (void) const |
| Check if all operations are build directives. More... | |
| void | changeHandleIndex (const vector< int4 > &handmap) |
| Remap handle indices for all operations. More... | |
| void | setInput (VarnodeTpl *vn, int4 index, int4 slot) |
| Set the VarnodeTpl input for a particular OpTpl in the sequence. More... | |
| void | setOutput (VarnodeTpl *vn, int4 index) |
| Set the VarnodeTpl output for a particular OpTpl in the sequence. More... | |
| void | deleteOps (const vector< int4 > &indices) |
| Delete the given set of operations. More... | |
| void | encode (Encoder &encoder, int4 sectionid) const |
| Encode details of this semantic sequence to an output stream. More... | |
| int4 | decode (Decoder &decoder) |
| Decode a semantic sequence from a stream. More... | |
Protected Member Functions | |
| void | setOpvec (vector< OpTpl * > &opvec) |
| Set the sequence of OpTpl. | |
| void | setNumLabels (uint4 val) |
| Set the number of labels. | |
Protected Attributes | |
| uint4 | delayslot |
| (Minimum) number of bytes in the delay slot | |
| uint4 | numlabels |
| Number of label templates. | |
| vector< OpTpl * > | vec |
| Sequence of operations performed by the Constructor. | |
| HandleTpl * | result |
| Final exported value (or NULL) | |
Friends | |
| class | SleighCompile |
P-code semantics for Constructor in a SLEIGH specification.
This encodes a sequence of OpTpl representing the semantic action of the Constructor, and if present, the HandleTpl representing the final exported value.
| ghidra::ConstructTpl::~ConstructTpl | ( | void | ) |
| bool ghidra::ConstructTpl::addOp | ( | OpTpl * | ot | ) |
Add an operation to the end of the sequence.
The added OpTpl can be a normal operation, which will be executed directly, or it can be a directive, like a build or delayslot, which may ultimately decode to multiple operations. Additionally, an OpTpl can represent a label, used to resolve internal p-code branches.
| ot | is the OpTpl to add |
References DELAY_SLOT, delayslot, ghidra::OpTpl::getIn(), ghidra::VarnodeTpl::getOffset(), ghidra::OpTpl::getOpcode(), ghidra::ConstTpl::getReal(), LABELBUILD, numlabels, and vec.
Referenced by addOpList().
| bool ghidra::ConstructTpl::addOpList | ( | const vector< OpTpl * > & | oplist | ) |
Add a list of operations to the end of the sequence.
| oplist | is the list of operations to add |
References addOp().
| bool ghidra::ConstructTpl::buildOnly | ( | void | ) | const |
Check if all operations are build directives.
References BUILD, ghidra::OpTpl::getOpcode(), and vec.
| void ghidra::ConstructTpl::changeHandleIndex | ( | const vector< int4 > & | handmap | ) |
Remap handle indices for all operations.
Each OpTpl operation is remapped using the given array of handle indices
| handmap | is the given array of new handle indices |
References BUILD, ghidra::HandleTpl::changeHandleIndex(), ghidra::OpTpl::changeHandleIndex(), ghidra::OpTpl::getIn(), ghidra::VarnodeTpl::getOffset(), ghidra::OpTpl::getOpcode(), ghidra::ConstTpl::getReal(), result, ghidra::VarnodeTpl::setOffset(), and vec.
| int4 ghidra::ConstructTpl::decode | ( | Decoder & | decoder | ) |
Decode a semantic sequence from a stream.
| decoder | is the stream to decode from |
References ghidra::Decoder::closeElement(), ghidra::HandleTpl::decode(), ghidra::OpTpl::decode(), delayslot, ghidra::Decoder::getNextAttributeId(), numlabels, ghidra::Decoder::openElement(), ghidra::Decoder::peekElement(), ghidra::Decoder::readSignedInteger(), result, and vec.
| void ghidra::ConstructTpl::deleteOps | ( | const vector< int4 > & | indices | ) |
Delete the given set of operations.
| indices | is an array of the indices indicating the positions of the OpTpl to be deleted |
References vec.
Referenced by ghidra::ConsistencyChecker::applyOptimization().
| void ghidra::ConstructTpl::encode | ( | Encoder & | encoder, |
| int4 | sectionid | ||
| ) | const |
Encode details of this semantic sequence to an output stream.
| encoder | is the output stream |
| sectionid | is the id of the specific Constructor section to associate with this sequence |
References ghidra::Encoder::closeElement(), delayslot, ghidra::HandleTpl::encode(), encode(), numlabels, ghidra::Encoder::openElement(), result, vec, and ghidra::Encoder::writeSignedInteger().
Referenced by encode(), ghidra::InjectPayloadSleigh::printTemplate(), and ghidra::ExecutablePcodeSleigh::printTemplate().
| int4 ghidra::ConstructTpl::fillinBuild | ( | vector< int4 > & | check, |
| AddrSpace * | const_space | ||
| ) |
Make sure there is a build directive for all sub-constructors.
For any sub-constructor that does not already one, a new build directive is added to the front of the operation sequence.
| check | is an array of integers, initialized to 0, used to mark sub-constructors with a directive. |
| const_space | is the constant address space |
References ghidra::OpTpl::addInput(), BUILD, ghidra::OpTpl::getIn(), ghidra::VarnodeTpl::getOffset(), ghidra::OpTpl::getOpcode(), ghidra::ConstTpl::getReal(), ghidra::ConstTpl::real, and vec.
Referenced by ghidra::SleighCompile::finalizeSections().
| void ghidra::ConstructTpl::setInput | ( | VarnodeTpl * | vn, |
| int4 | index, | ||
| int4 | slot | ||
| ) |
Set the VarnodeTpl input for a particular OpTpl in the sequence.
For use with optimization routines.
| vn | is the new input |
| index | is the position of the operation within the sequence |
| slot | is the input slot to replace with the new input |
References ghidra::OpTpl::getIn(), ghidra::OpTpl::setInput(), and vec.
Referenced by ghidra::ConsistencyChecker::applyOptimization().
| void ghidra::ConstructTpl::setOutput | ( | VarnodeTpl * | vn, |
| int4 | index | ||
| ) |
Set the VarnodeTpl output for a particular OpTpl in the sequence.
For use with optimization routines.
| vn | is the new output |
| index | is the position of the operation within the sequence |
References ghidra::OpTpl::getOut(), ghidra::OpTpl::setOutput(), and vec.
Referenced by ghidra::ConsistencyChecker::applyOptimization().