|
decompiler 1.0.0
|
An abstract, SLEIGH specific, p-code generator. More...
#include <semantics.hh>
Public Member Functions | |
| PcodeBuilder (uint4 lbcnt) | |
| Construct with a starting label index. | |
| virtual | ~PcodeBuilder (void) |
| Destructor. | |
| uint4 | getLabelBase (void) const |
| Get the starting label index for this builder. | |
| ParserWalker * | getCurrentWalker () const |
| Get the current instruction context. | |
| void | build (ConstructTpl *construct, int4 secnum) |
| Build the semantics for the given constructor. More... | |
| virtual void | appendBuild (OpTpl *bld, int4 secnum)=0 |
| Execute or filter a build directive in sequence. More... | |
| virtual void | delaySlot (OpTpl *op)=0 |
| Execute or filter a delayslot directive in sequence. More... | |
| virtual void | setLabel (OpTpl *op)=0 |
| Process or filter a label in sequence. More... | |
| virtual void | appendCrossBuild (OpTpl *bld, int4 secnum)=0 |
| Process or filter a crossbuild directive in sequence. More... | |
Protected Member Functions | |
| virtual void | dump (OpTpl *op)=0 |
| Output/build the given p-code operation. More... | |
Protected Attributes | |
| ParserWalker * | walker |
| Current instruction context. | |
Private Attributes | |
| uint4 | labelbase |
| Starting label index for this builder. | |
| uint4 | labelcount |
| Current number of defined labels. | |
An abstract, SLEIGH specific, p-code generator.
This is a base class for output, filtering, or otherwise processing sequences of p-code for a single instruction decoded by the SLEIGH engine. The ConstructTpl of the root constructor for the instruction is fed to the build() method. Each normal p-code operation then makes it to the dump() method in sequence for processing. Hook points are provided to recurse into different instructions/constructors via build, delayslot, and crossbuild directives.
|
pure virtual |
Execute or filter a build directive in sequence.
Any recursion through build directives into ConstructTpl for sub-constructors happens here.
| bld | is the build directive, which encodes the particular sub-construction |
| secnum | is the current section number of the constructor |
Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.
Referenced by build().
|
pure virtual |
Process or filter a crossbuild directive in sequence.
Any recursion through crossbuild directives into new instructions and sections happens here.
| bld | is the crossbuild directive |
| secnum | is the current section number being processed |
Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.
Referenced by build().
| void ghidra::PcodeBuilder::build | ( | ConstructTpl * | construct, |
| int4 | secnum | ||
| ) |
Build the semantics for the given constructor.
Process all the semantic operations in the given ConstructTpl, handling directives and labels.
| construct | is the given ConstructTpl sequence |
| secnum | is the section number associated with the sequence |
References appendBuild(), appendCrossBuild(), BUILD, CROSSBUILD, DELAY_SLOT, delaySlot(), dump(), ghidra::OpTpl::getOpcode(), ghidra::ConstructTpl::getOpvec(), labelbase, LABELBUILD, labelcount, ghidra::ConstructTpl::numLabels(), and setLabel().
Referenced by ghidra::SleighBuilder::appendBuild(), ghidra::SleighBuilder::appendCrossBuild(), ghidra::SleighBuilder::buildEmpty(), ghidra::SleighBuilder::delaySlot(), ghidra::SleighCompile::expandMacros(), ghidra::InjectPayloadSleigh::inject(), ghidra::ExecutablePcodeSleigh::inject(), and ghidra::Sleigh::oneInstruction().
|
pure virtual |
Execute or filter a delayslot directive in sequence.
Any recursion through delayslot directives into new instructions happens here.
| op | is the delayslot directive, which encodes the number of bytes in the particular delay slot. |
Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.
Referenced by build().
|
protectedpure virtual |
Output/build the given p-code operation.
This is the main hook point for different p-code generation strategies. It is called once, in sequence, for each p-code operation generated for a specific instruction. Directives and labels have had the opportunity to be expanded or filtered by other methods.
| op | is the p-code operation to process |
Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.
Referenced by build().
|
pure virtual |
Process or filter a label in sequence.
The builder has the opportunity to record exactly where in sequence the given label occurs.
| op | is the OpTpl encoding the label index |
Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.
Referenced by build().