|
Ghidra 11.4.2
Ghidra internal decompiler documentation.
|
Build p-code from a pre-parsed instruction. More...
#include <sleigh.hh>
Public Member Functions | |
| SleighBuilder (ParserWalker *w, DisassemblyCache *dcache, PcodeCacher *pc, AddrSpace *cspc, AddrSpace *uspc, uint4 umask) | |
| Constructor. | |
| virtual void | appendBuild (OpTpl *bld, int4 secnum) |
| virtual void | delaySlot (OpTpl *op) |
| virtual void | setLabel (OpTpl *op) |
| virtual void | appendCrossBuild (OpTpl *bld, int4 secnum) |
Public Member Functions inherited from ghidra::PcodeBuilder | |
| PcodeBuilder (uint4 lbcnt) | |
| uint4 | getLabelBase (void) const |
| ParserWalker * | getCurrentWalker () const |
| void | build (ConstructTpl *construct, int4 secnum) |
Private Member Functions | |
| virtual void | dump (OpTpl *op) |
| void | buildEmpty (Constructor *ct, int4 secnum) |
| Build a named p-code section of a constructor that contains only implied BUILD directives. | |
| void | generateLocation (const VarnodeTpl *vntpl, VarnodeData &vn) |
| Generate a concrete VarnodeData object from the given template (VarnodeTpl) | |
| AddrSpace * | generatePointer (const VarnodeTpl *vntpl, VarnodeData &vn) |
| Generate a pointer VarnodeData from a dynamic template (VarnodeTpl) | |
| void | generatePointerAdd (PcodeData *op, const VarnodeTpl *vntpl) |
| Add in an additional offset to the address of a dynamic Varnode. | |
| void | setUniqueOffset (const Address &addr) |
| Set uniquifying bits for the current instruction. | |
Private Attributes | |
| AddrSpace * | const_space |
| The constant address space. | |
| AddrSpace * | uniq_space |
| The unique address space. | |
| uintb | uniquemask |
| Mask of address bits to use to uniquify temporary registers. | |
| uintb | uniqueoffset |
| Uniquifier bits for this instruction. | |
| DisassemblyCache * | discache |
| Cache of disassembled instructions. | |
| PcodeCacher * | cache |
| Cache accumulating p-code data for the instruction. | |
Additional Inherited Members | |
Protected Attributes inherited from ghidra::PcodeBuilder | |
| ParserWalker * | walker |
Build p-code from a pre-parsed instruction.
Through the build() method, this walks the parse tree and prepares data for final emission as p-code. (The final emitting is done separately through the PcodeCacher.emit() method). Generally, only p-code for one instruction is prepared. But, through the delay-slot mechanism, build() may recursively visit additional instructions.
| ghidra::SleighBuilder::SleighBuilder | ( | ParserWalker * | w, |
| DisassemblyCache * | dcache, | ||
| PcodeCacher * | pc, | ||
| AddrSpace * | cspc, | ||
| AddrSpace * | uspc, | ||
| uint4 | umask | ||
| ) |
| w | is the parsed instruction |
| dcache | is a cache of nearby instruction parses |
| pc | will hold the PcodeData and VarnodeData objects produced by this builder |
| cspc | is the constant address space |
| uspc | is the unique address space |
| umask | is the mask to use to find unique bits within an Address |
References cache, const_space, discache, ghidra::Address::getOffset(), uniq_space, uniquemask, and uniqueoffset.
|
virtual |
Implements ghidra::PcodeBuilder.
|
virtual |
Implements ghidra::PcodeBuilder.
|
private |
Build a named p-code section of a constructor that contains only implied BUILD directives.
If a named section of a constructor is empty, we still need to walk through any subtables that might contain p-code in their named sections. This method treats each subtable operand as an implied build directive, in the otherwise empty section.
| ct | is the matching currently Constructor being built |
| secnum | is the particular named section number to build |
References buildEmpty().
Referenced by buildEmpty().
|
virtual |
Implements ghidra::PcodeBuilder.
|
privatevirtual |
Implements ghidra::PcodeBuilder.
|
private |
Generate a concrete VarnodeData object from the given template (VarnodeTpl)
| vntpl | is the template to reference |
| vn | is the object to fill in with concrete values |
References ghidra::calc_mask(), const_space, ghidra::VarnodeData::offset, ghidra::VarnodeData::size, ghidra::VarnodeData::space, uniq_space, uniqueoffset, and ghidra::AddrSpace::wrapOffset().
|
private |
Generate a pointer VarnodeData from a dynamic template (VarnodeTpl)
The symbol represents a value referenced through a dynamic pointer. This method generates the varnode representing the pointer itself and also returns the address space in anticipation of generating the LOAD or STORE that actually manipulates the value.
| vntpl | is the dynamic template to reference |
| vn | is the object to fill with concrete values |
References ghidra::calc_mask(), const_space, ghidra::VarnodeData::offset, ghidra::VarnodeData::size, ghidra::VarnodeData::space, uniq_space, uniqueoffset, and ghidra::AddrSpace::wrapOffset().
|
private |
Add in an additional offset to the address of a dynamic Varnode.
The Varnode is ultimately read/written via LOAD/STORE operation AND has undergone a truncation operation, so an additional offset needs to get added to the pointer referencing the Varnode.
| op | is the LOAD/STORE operation being generated |
| vntpl | is the dynamic Varnode |
References ghidra::PcodeCacher::allocateInstruction(), ghidra::PcodeCacher::allocateVarnodes(), cache, const_space, ghidra::CPUI_INT_ADD, ghidra::AddrSpace::getTrans(), ghidra::Translate::getUniqueStart(), ghidra::PcodeData::invar, ghidra::PcodeData::isize, ghidra::VarnodeData::offset, ghidra::PcodeData::opc, ghidra::PcodeData::outvar, ghidra::Translate::RUNTIME_BITRANGE_EA, ghidra::VarnodeData::size, ghidra::VarnodeData::space, and uniq_space.
|
virtual |
Implements ghidra::PcodeBuilder.
|
private |
Set uniquifying bits for the current instruction.
Bits used to make temporary registers unique across multiple instructions are generated based on the given address.
| addr | is the given Address |
References ghidra::Address::getOffset(), uniquemask, and uniqueoffset.