decompiler 1.0.0
Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
ghidra::ExprTree Class Reference

A p-code expression tree. More...

#include <pcodecompile.hh>

Public Member Functions

 ExprTree (void)
 Construct an empty expression.
 
 ExprTree (VarnodeTpl *vn)
 Construct an expression with a single VarnodeTpl. More...
 
 ~ExprTree (void)
 Destructor.
 
void setOutput (VarnodeTpl *newout)
 Force the output of the expression to be a new VarnodeTpl. More...
 
VarnodeTpl * getOut (void)
 Get the root VarnodeTpl.
 
const ConstTpl & getSize (void) const
 Get the size of the root VarnodeTpl.
 

Static Public Member Functions

static vector< OpTpl * > * appendParams (OpTpl *op, vector< ExprTree * > *param)
 Create a new raw expression by appending an array of VarnodeTpl, as inputs, to a new root OpTpl. More...
 
static vector< OpTpl * > * toVector (ExprTree *expr)
 Convert an expression to a raw array of OpTpl. More...
 

Private Attributes

vector< OpTpl * > * ops
 Flattened ops making up the expression.
 
VarnodeTpl * outvn
 Root VarnodeTpl: Copy of the output from the final OpTpl (or NULL)
 

Friends

class PcodeCompile
 

Detailed Description

A p-code expression tree.

A single connected tree of OpTpl and VarnodeTpl nodes, with either a root VarnodeTpl or a root OpTpl with no output. The OpTpl are stored in the flattened order the will be emitted as.

Constructor & Destructor Documentation

◆ ExprTree()

ghidra::ExprTree::ExprTree ( VarnodeTpl *  vn)

Construct an expression with a single VarnodeTpl.

Parameters
vnis the expression root

References ops, and outvn.

Member Function Documentation

◆ appendParams()

vector< OpTpl * > * ghidra::ExprTree::appendParams ( OpTpl *  op,
vector< ExprTree * > *  param 
)
static

Create a new raw expression by appending an array of VarnodeTpl, as inputs, to a new root OpTpl.

The OpTpl may already have inputs. The root VarnodeTpl from each ExprTree passed in is appended to the list of input parameters of the OpTpl, creating a single new expression. The original ExprTrees and their container are all destroyed. The new expression is returned, in raw form, as a flattened array of OpTpl.

Parameters
opis the new root OpTpl
paramis the list of expressions, each with a root VarnodeTpl
Returns
the new raw expression as an array of OpTpl

References ghidra::OpTpl::addInput(), and outvn.

Referenced by ghidra::SleighCompile::createMacroUse(), ghidra::PcodeCompile::createUserOpNoOut(), and ghidra::PcodeCompile::createVariadic().

◆ setOutput()

void ghidra::ExprTree::setOutput ( VarnodeTpl *  newout)

Force the output of the expression to be a new VarnodeTpl.

Parameters
newoutis the new output being forced

References ghidra::OpTpl::addInput(), ghidra::OpTpl::clearOutput(), ghidra::CPUI_COPY, ghidra::VarnodeTpl::isUnnamed(), ops, outvn, and ghidra::OpTpl::setOutput().

Referenced by ghidra::PcodeCompile::newOutput().

◆ toVector()

vector< OpTpl * > * ghidra::ExprTree::toVector ( ExprTree *  expr)
static

Convert an expression to a raw array of OpTpl.

The flattened array of OpTpl is stripped from the ExprTree, which is then destroyed.

Parameters
expris the expression to convert to an array
Returns
the raw array of OpTpl

References ops.

Referenced by ghidra::PcodeCompile::newOutput().


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