decompiler 1.0.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
ghidra::PcodeBuilder Class Referenceabstract

An abstract, SLEIGH specific, p-code generator. More...

#include <semantics.hh>

Inheritance diagram for ghidra::PcodeBuilder:
ghidra::MacroBuilder ghidra::SleighBuilder

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.
 

Detailed Description

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.

Member Function Documentation

◆ appendBuild()

virtual void ghidra::PcodeBuilder::appendBuild ( OpTpl *  bld,
int4  secnum 
)
pure virtual

Execute or filter a build directive in sequence.

Any recursion through build directives into ConstructTpl for sub-constructors happens here.

Parameters
bldis the build directive, which encodes the particular sub-construction
secnumis the current section number of the constructor

Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.

Referenced by build().

◆ appendCrossBuild()

virtual void ghidra::PcodeBuilder::appendCrossBuild ( OpTpl *  bld,
int4  secnum 
)
pure virtual

Process or filter a crossbuild directive in sequence.

Any recursion through crossbuild directives into new instructions and sections happens here.

Parameters
bldis the crossbuild directive
secnumis the current section number being processed

Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.

Referenced by build().

◆ build()

void ghidra::PcodeBuilder::build ( ConstructTpl *  construct,
int4  secnum 
)

◆ delaySlot()

virtual void ghidra::PcodeBuilder::delaySlot ( OpTpl *  op)
pure virtual

Execute or filter a delayslot directive in sequence.

Any recursion through delayslot directives into new instructions happens here.

Parameters
opis the delayslot directive, which encodes the number of bytes in the particular delay slot.

Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.

Referenced by build().

◆ dump()

virtual void ghidra::PcodeBuilder::dump ( OpTpl *  op)
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.

Parameters
opis the p-code operation to process

Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.

Referenced by build().

◆ setLabel()

virtual void ghidra::PcodeBuilder::setLabel ( OpTpl *  op)
pure virtual

Process or filter a label in sequence.

The builder has the opportunity to record exactly where in sequence the given label occurs.

Parameters
opis the OpTpl encoding the label index

Implemented in ghidra::SleighBuilder, and ghidra::MacroBuilder.

Referenced by build().


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