Ghidra Decompiler Analysis Engine
|
Go to the documentation of this file.
16 #ifndef __CPUI_MERGE__
17 #define __CPUI_MERGE__
35 bool operator<(
const HighEdge &op2)
const {
if (a==op2.a)
return (b<op2.b);
return (a<op2.a); }
49 bool operator<(
const BlockVarnode &op2)
const {
return (index < op2.index); }
50 Varnode *getVarnode(
void)
const {
return vn; }
51 int4 getIndex(
void)
const {
return index; }
52 static int4
findFront(int4 blocknum,
const vector<BlockVarnode> &list);
82 map<HighEdge,bool> highedgemap;
83 vector<PcodeOp *> copyTrims;
90 static bool mergeTestBasic(
Varnode *vn);
91 static void findSingleCopy(
HighVariable *high,vector<Varnode *> &singlelist);
94 static bool shadowedVarnode(
const Varnode *vn);
95 static void findAllIntoCopies(
HighVariable *high,vector<PcodeOp *> ©Ins,
bool filterTemps);
97 bool collectCorrectable(
const vector<Varnode *> &vlist,list<PcodeOp *> &oplist,vector<int4> &slotlist,
100 void snipReads(
Varnode *vn,list<PcodeOp *> &markedop);
101 void snipIndirect(
PcodeOp *indop);
102 void eliminateIntersect(
Varnode *vn,
const vector<BlockVarnode> &blocksort);
103 void unifyAddress(VarnodeLocSet::const_iterator startiter,VarnodeLocSet::const_iterator enditer);
104 void trimOpOutput(
PcodeOp *op);
105 void trimOpInput(
PcodeOp *op,int4 slot);
106 void mergeRangeMust(VarnodeLocSet::const_iterator startiter,VarnodeLocSet::const_iterator enditer);
108 void mergeIndirect(
PcodeOp *indop);
109 void mergeLinear(vector<HighVariable *> &highvec);
112 void buildDominantCopy(
HighVariable *high,vector<PcodeOp *> ©,int4 pos,int4 size);
113 void markRedundantCopies(
HighVariable *high,vector<PcodeOp *> ©,int4 pos,int4 size);
124 void mergeByDatatype(VarnodeLocSet::const_iterator startiter,VarnodeLocSet::const_iterator enditer);
132 #ifdef MERGEMULTI_DEBUG
133 void verifyHighCovers(
void);
151 int4 result = a->wholecover.
compareTo(b->wholecover);
153 Varnode *v1 = a->getInstance( 0 );
154 Varnode *v2 = b->getInstance( 0 );
156 if ( v1->getAddr() == v2->getAddr() ) {
162 else if ( def2 == (
PcodeOp *) 0 ) {
165 return (def1->getAddr() < def2->getAddr());
167 return (v1->getAddr() < v2->getAddr());
A record for caching a Cover intersection test between two HighVariable objects.
Definition: merge.hh:29
bool operator<(const HighEdge &op2) const
Comparator.
Definition: merge.hh:35
Class for merging low-level Varnodes into high-level HighVariables.
Definition: merge.hh:80
void mergeAdjacent(void)
Speculatively merge Varnodes that are input/output to the same p-code op.
Definition: merge.cc:881
void mergeMarker(void)
Force the merge of input and output Varnodes to MULTIEQUAL and INDIRECT ops.
Definition: merge.cc:800
bool intersection(HighVariable *a, HighVariable *b)
Test the intersection of two HighVariables and cache the result.
Definition: merge.cc:1481
static int4 findFront(int4 blocknum, const vector< BlockVarnode > &list)
Find the first Varnode defined in the BlockBasic of the given index.
Definition: merge.cc:41
void processCopyTrims(void)
Try to reduce/eliminate COPYs produced by the merge trimming process.
Definition: merge.cc:1265
void mergeByDatatype(VarnodeLocSet::const_iterator startiter, VarnodeLocSet::const_iterator enditer)
Try to merge all HighVariables in the given range that have the same data-type.
Definition: merge.cc:298
void set(Varnode *v)
Set this as representing the given Varnode.
Definition: merge.cc:22
Lowest level operation of the p-code language.
Definition: op.hh:58
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
int4 compareTo(const Cover &op2) const
Give ordering of this and another Cover.
Definition: cover.cc:221
void mergeMultiEntry(void)
Merge together Varnodes mapped to SymbolEntrys from the same Symbol.
Definition: merge.cc:819
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
void mergeOpcode(OpCode opc)
Try to force merges of input to output for all p-code ops of a given type.
Definition: merge.cc:265
Container for data structures associated with a single function.
Definition: funcdata.hh:45
The base datatype class for the decompiler.
Definition: type.hh:62
bool hideShadows(HighVariable *high)
Hide shadow Varnodes related to the given HighVariable by consolidating COPY chains.
Definition: merge.cc:968
A high-level variable modeled as a list of low-level variables, each written once.
Definition: variable.hh:38
The PcodeOp and PcodeOpBank classes.
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
void markInternalCopies(void)
Mark redundant/internal COPY PcodeOps.
Definition: merge.cc:1294
Helper class associating a Varnode with the block where it is defined.
Definition: merge.hh:44
void mergeAddrTied(void)
Force the merge of address tried Varnodes.
Definition: merge.cc:523
void inflate(Varnode *a, HighVariable *high)
Inflate the Cover of a given Varnode with a HighVariable.
Definition: merge.cc:1546
bool inflateTest(Varnode *a, HighVariable *high)
Test if we can inflate the Cover of the given Varnode without incurring intersections.
Definition: merge.cc:1567
bool mergeTest(HighVariable *high, vector< HighVariable * > &tmplist)
Test for intersections between a given HighVariable and a list of other HighVariables.
Definition: merge.cc:1594