Ghidra Decompiler Analysis Engine
|
Go to the documentation of this file.
18 #ifndef __CPUI_VARNODE__
19 #define __CPUI_VARNODE__
135 VarnodeLocSet::iterator lociter;
136 VarnodeDefSet::iterator defiter;
137 list<PcodeOp *> descend;
138 mutable Cover *cover;
148 void updateCover(
void)
const;
149 void calcCover(
void)
const;
150 void clearCover(
void)
const;
151 void setFlags(uint4 fl)
const;
152 void clearFlags(uint4 fl)
const;
159 void setSymbolReference(
SymbolEntry *entry,int4 off);
161 void eraseDescend(
PcodeOp *op);
162 void destroyDescend(
void);
165 void setHigh(
HighVariable *tv,int2 mg) { high = tv; mergegroup = mg; }
167 const Address &getAddr(
void)
const {
return (
const Address &) loc; }
169 uintb getOffset(
void)
const {
return loc.
getOffset(); }
170 int4 getSize(
void)
const {
return size; }
171 int2 getMergeGroup(
void)
const {
return mergegroup; }
172 PcodeOp *getDef(
void) {
return def; }
173 const PcodeOp *getDef(
void)
const {
return (
const PcodeOp *) def; }
175 SymbolEntry *getSymbolEntry(
void)
const {
return mapentry; }
176 uint4 getFlags(
void)
const {
return flags; }
177 Datatype *getType(
void)
const {
return type; }
178 void setTempType(
Datatype *t)
const { temp.dataType = t; }
179 Datatype *getTempType(
void)
const {
return temp.dataType; }
180 void setValueSet(
ValueSet *v)
const { temp.valueSet = v; }
181 ValueSet *getValueSet(
void)
const {
return temp.valueSet; }
182 uint4 getCreateIndex(
void)
const {
return create_index; }
183 Cover *getCover(
void)
const { updateCover();
return cover; }
184 list<PcodeOp *>::const_iterator beginDescend(
void)
const {
return descend.begin(); }
185 list<PcodeOp *>::const_iterator endDescend(
void)
const {
return descend.end(); }
186 uintb getConsume(
void)
const {
return consumed; }
187 void setConsume(uintb val) { consumed = val; }
211 uintb getNZMask(
void)
const {
return nzm; }
242 bool isMark(
void)
const {
return ((flags&
Varnode::mark)!=0); }
262 bool hasNoDescend(
void)
const {
return descend.empty(); }
266 if (!isConstant())
return false;
311 void saveXml(ostream &s)
const;
312 static bool comparePointers(
const Varnode *a,
const Varnode *b) {
return (*a < *b); }
341 int4 numVarnodes(
void)
const {
return loc_tree.size(); }
355 uint4 getCreateIndex(
void)
const {
return create_index; }
356 VarnodeLocSet::const_iterator
beginLoc(
void)
const {
return loc_tree.begin(); }
357 VarnodeLocSet::const_iterator
endLoc(
void)
const {
return loc_tree.end(); }
361 VarnodeLocSet::const_iterator
endLoc(
const Address &addr)
const;
362 VarnodeLocSet::const_iterator
beginLoc(int4 s,
const Address &addr)
const;
363 VarnodeLocSet::const_iterator
endLoc(int4 s,
const Address &addr)
const;
364 VarnodeLocSet::const_iterator
beginLoc(int4 s,
const Address &addr,uint4 fl)
const;
365 VarnodeLocSet::const_iterator
endLoc(int4 s,
const Address &addr,uint4 fl)
const;
367 VarnodeLocSet::const_iterator
endLoc(int4 s,
const Address &addr,
const Address &pc,uintm uniq)
const;
368 VarnodeDefSet::const_iterator
beginDef(
void)
const {
return def_tree.begin(); }
369 VarnodeDefSet::const_iterator
endDef(
void)
const {
return def_tree.end(); }
370 VarnodeDefSet::const_iterator
beginDef(uint4 fl)
const;
371 VarnodeDefSet::const_iterator
endDef(uint4 fl)
const;
372 VarnodeDefSet::const_iterator
beginDef(uint4 fl,
const Address &addr)
const;
373 VarnodeDefSet::const_iterator
endDef(uint4 fl,
const Address &addr)
const;
375 void verifyIntegrity(
void)
const;
@ namelock
The Name of the Varnode is locked.
Definition: varnode.hh:83
bool operator()(const Varnode *a, const Varnode *b) const
Functional comparison operator.
Definition: varnode.cc:52
@ persist
Persists after (and before) function.
Definition: varnode.hh:89
bool updateType(Datatype *ct, bool lock, bool override)
(Possibly) set the Datatype given various restrictions
Definition: varnode.cc:419
void printInfo(ostream &s) const
Print raw attribute info about the Varnode.
Definition: varnode.cc:255
HighVariable * getHigh(void) const
Get the high-level variable associated with this Varnode.
Definition: varnode.cc:80
A region where processor data is stored.
Definition: space.hh:73
@ insert
Definition: varnode.hh:76
Varnode * find(int4 s, const Address &loc, const Address &pc, uintm uniq=~((uintm) 0)) const
Find a Varnode.
Definition: varnode.cc:1074
Varnode * setInput(Varnode *vn)
Mark a Varnode as an input to the function.
Definition: varnode.cc:992
@ ptrcheck
The Varnode value is NOT a pointer.
Definition: varnode.hh:114
Compare two Varnode pointers by location then definition.
Definition: varnode.hh:34
@ hiddenretparm
Does this varnode point to the return value storage location.
Definition: varnode.hh:104
VarnodeLocSet::const_iterator endLoc(AddrSpace *spaceid) const
Ending of Varnodes in given address space sorted by location.
Definition: varnode.cc:1182
@ mark
Prevents infinite loops.
Definition: varnode.hh:71
void printRaw(ostream &s) const
Print a simple identifier plus additional info identifying Varnode with SSA form.
Definition: varnode.cc:634
@ directwrite
(could be) Directly affected by a valid input
Definition: varnode.hh:94
@ nolocalalias
There are no aliases pointing to this varnode.
Definition: varnode.hh:84
void printCover(ostream &s) const
Print raw coverage info about the Varnode.
Definition: varnode.cc:242
@ implied
This varnode is a temporary variable.
Definition: varnode.hh:79
@ lisconsume
In consume worklist.
Definition: varnode.hh:113
@ stack_store
Created by an explicit STORE.
Definition: varnode.hh:117
Class for merging low-level Varnodes into high-level HighVariables.
Definition: merge.hh:80
VarnodeDefSet::const_iterator endDef(uint4 fl) const
End of varnodes with set definition property.
Definition: varnode.cc:1440
void makeFree(Varnode *vn)
Convert a Varnode to be free.
Definition: varnode.cc:950
@ vacconsume
Vacuous consume.
Definition: varnode.hh:112
@ writemask
Should not be considered a write in heritage calculation.
Definition: varnode.hh:111
addl_flags
Additional boolean properties on a Varnode.
Definition: varnode.hh:109
bool isHeritageKnown(void) const
Return true if this Varnode is linked into the SSA tree.
Definition: varnode.hh:272
Varnode * createDefUnique(int4 s, Datatype *ct, PcodeOp *op)
Create a temporary Varnode as output of a PcodeOp.
Definition: varnode.cc:1060
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
int4 overlap(const Varnode &op) const
Return relative point of overlap between two Varnodes.
Definition: varnode.cc:170
PcodeOp * loneDescend(void) const
Return unique reading PcodeOp, or null if there are zero or more than 1.
Definition: varnode.cc:569
@ typelock
The Dataype of the Varnode is locked.
Definition: varnode.hh:82
Lowest level operation of the p-code language.
Definition: op.hh:58
@ unaffected
Input which is unaffected by the function.
Definition: varnode.hh:91
A storage location for a particular Symbol.
Definition: database.hh:51
@ ptrflow
If this varnode flows to or from a pointer.
Definition: varnode.hh:115
@ spacebase
This is a base register for an address space.
Definition: varnode.hh:92
void copySymbolIfValid(const Varnode *vn)
Copy symbol info from vn if constant value matches.
Definition: varnode.cc:455
Compare two Varnode pointers by definition then location.
Definition: varnode.hh:39
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
@ externref
Varnode address is specially mapped by the loader.
Definition: varnode.hh:87
@ coverdirty
Cover is not upto date.
Definition: varnode.hh:100
@ activeheritage
The varnode is actively being heritaged.
Definition: varnode.hh:110
bool intersects(const Varnode &op) const
Return true if the storage locations intersect.
Definition: varnode.cc:113
int4 isConstantExtended(uintb &val) const
Definition: varnode.cc:695
int4 characterizeOverlap(const Varnode &op) const
Return 0, 1, or 2 for "no overlap", "partial overlap", "identical storage".
Definition: varnode.cc:147
@ mapped
Varnode has a database entry associated with it.
Definition: varnode.hh:97
A range of values attached to a Varnode within a data-flow subsystem.
Definition: rangeutil.hh:111
@ return_address
Is the varnode storage for a return address.
Definition: varnode.hh:99
@ volatil
This varnode's value is volatile.
Definition: varnode.hh:85
Varnode * create(int4 s, const Address &m, Datatype *ct)
Create a free Varnode object.
Definition: varnode.cc:884
bool constantMatch(uintb val) const
Return true if this is a constant with value val.
Definition: varnode.hh:265
@ annotation
This varnode is an annotation and has no dataflow.
Definition: varnode.hh:73
void copySymbol(const Varnode *vn)
Copy symbol info from vn.
Definition: varnode.cc:438
A description of the topological scope of a single variable object.
Definition: cover.hh:68
bool isAddrTied(void) const
Are all Varnodes at this storage location components of the same high-level variable?
Definition: varnode.hh:230
AddrSpace * getSpace(void) const
Get the address space.
Definition: address.hh:294
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
bool isIndirectZero(void) const
Is this just a special placeholder representing INDIRECT creation?
Definition: varnode.hh:248
Varnode * findCoveringInput(int4 s, const Address &loc) const
Find an input Varnode covering a range.
Definition: varnode.cc:1147
Container for data structures associated with a single function.
Definition: funcdata.hh:45
The base datatype class for the decompiler.
Definition: type.hh:62
~Varnode(void)
Destructor.
Definition: varnode.cc:555
int4 contains(const Varnode &op) const
Return info about the containment of op in this.
Definition: varnode.cc:97
Varnode(int4 s, const Address &m, Datatype *dt)
Construct a free Varnode.
Definition: varnode.cc:523
@ input
This varnode has no ancestor.
Definition: varnode.hh:74
bool hasCover(void) const
Does this have Cover information?
Definition: varnode.hh:260
varnode_flags
Definition: varnode.hh:70
void printRawHeritage(ostream &s, int4 depth) const
Print a simple SSA subtree rooted at this.
Definition: varnode.cc:654
@ precishi
Is this Varnode the high part of a double precision value.
Definition: varnode.hh:102
Classes describing the topological scope of variables within a function.
@ precislo
Is this Varnode the low part of a double precision value.
Definition: varnode.hh:101
@ constant
The varnode is constant.
Definition: varnode.hh:72
A high-level variable modeled as a list of low-level variables, each written once.
Definition: variable.hh:38
void saveXml(ostream &s) const
Save a description of this as an XML tag.
Definition: varnode.cc:816
Address getUsePoint(const Funcdata &fd) const
Get Address when this Varnode first comes into scope.
Definition: varnode.cc:589
int4 printRawNoMarkup(ostream &s) const
Print a simple identifier for the Varnode.
Definition: varnode.cc:604
VarnodeLocSet::const_iterator beginLoc(AddrSpace *spaceid) const
Beginning of Varnodes in given address space sorted by location.
Definition: varnode.cc:1171
Varnode * findCoveredInput(int4 s, const Address &loc) const
Find an input Varnode contained within this range.
Definition: varnode.cc:1119
VarnodeBank(AddrSpaceManager *m, AddrSpace *uspace, uintm ubase)
Construct the container.
Definition: varnode.cc:852
Datatype * getLocalType(void) const
Calculate type of Varnode based on local information.
Definition: varnode.cc:726
set< Varnode *, VarnodeCompareDefLoc > VarnodeDefSet
A set of Varnodes sorted by definition (then location)
Definition: varnode.hh:47
Varnode * findContiguousWhole(Funcdata &data, Varnode *vn1, Varnode *vn2)
Retrieve the whole Varnode given pieces.
Definition: varnode.cc:1616
@ spacebase_placeholder
value at a specific point in the code
Definition: varnode.hh:119
bool operator<(const Varnode &op2) const
Comparison operator on Varnode.
Definition: varnode.cc:478
void clear(void)
Clear out all Varnodes and reset counters.
Definition: varnode.cc:864
@ written
This varnode has a defining op (def is nonzero)
Definition: varnode.hh:75
Varnode * setDef(Varnode *vn, PcodeOp *op)
Change Varnode to be defined by the given PcodeOp.
Definition: varnode.cc:1014
@ incidental_copy
Do copies of this varnode happen as a side-effect.
Definition: varnode.hh:105
@ readonly
Varnode is stored at a readonly location.
Definition: varnode.hh:88
int4 termOrder(const Varnode *op) const
Compare two Varnodes based on their term order.
Definition: varnode.cc:787
bool copyShadow(const Varnode *op2) const
Are this and op2 copied from the same source?
Definition: varnode.cc:764
Varnode * createUnique(int4 s, Datatype *ct)
Create a temporary varnode.
Definition: varnode.cc:899
bool contiguous_test(Varnode *vn1, Varnode *vn2)
Test if Varnodes are pieces of a whole.
Definition: varnode.cc:1585
Raw descriptions of varnodes and p-code ops.
VarnodeDefSet::const_iterator beginDef(uint4 fl) const
Beginning of varnodes with set definition property.
Definition: varnode.cc:1402
void destroy(Varnode *vn)
Remove a Varnode from the container.
Definition: varnode.cc:910
A manager for different address spaces.
Definition: translate.hh:218
void replace(Varnode *oldvn, Varnode *newvn)
Replace every read of one Varnode with another.
Definition: varnode.cc:966
ValueSet * valueSet
Value set associated with this when performing Value Set Analysis.
Definition: varnode.hh:141
@ autolive_hold
Temporarily block dead-code removal of this.
Definition: varnode.hh:106
@ addrforce
Varnode is used to force variable into an address.
Definition: varnode.hh:95
@ unsignedprint
Constant that must be explicitly printed as unsigned.
Definition: varnode.hh:116
Varnode * findInput(int4 s, const Address &loc) const
Find an input Varnode.
Definition: varnode.cc:1099
@ indirectonly
If all uses of illegalinput varnode are inputs to INDIRECT.
Definition: varnode.hh:93
Varnode * createDef(int4 s, const Address &m, Datatype *ct, PcodeOp *op)
Create a Varnode as the output of a PcodeOp.
Definition: varnode.cc:1045
Datatype * dataType
Temporary data-type associated with this for use in type propagate algorithm.
Definition: varnode.hh:140
@ explict
This varnode CANNOT be a temporary variable.
Definition: varnode.hh:80
bool isExtraOut(void) const
Is this Varnode created indirectly by a CALL operation?
Definition: varnode.hh:251
bool operator()(const Varnode *a, const Varnode *b) const
Functional comparison operator.
Definition: varnode.cc:26
set< Varnode *, VarnodeCompareLocDef > VarnodeLocSet
A set of Varnodes sorted by location (then by definition)
Definition: varnode.hh:44
A container for Varnode objects from a specific function.
Definition: varnode.hh:327
@ locked_input
Input that exists even if its unused.
Definition: varnode.hh:118
@ indirect_creation
The value in this Varnode is created indirectly.
Definition: varnode.hh:98
@ indirectstorage
Is this Varnode storing a pointer to the actual symbol.
Definition: varnode.hh:103
@ addrtied
High-level variable is tied to address.
Definition: varnode.hh:90
bool operator==(const Varnode &op2) const
Equality operator.
Definition: varnode.cc:501