18 #ifndef __CPUI_VARNODE__ 19 #define __CPUI_VARNODE__ 86 spacebase_placeholder = 0x1000,
95 indirectonly = 0x80000,
96 directwrite = 0x100000,
100 indirect_creation = 0x800000,
101 return_address = 0x1000000,
102 coverdirty = 0x2000000,
103 precislo = 0x4000000,
104 precishi = 0x8000000,
105 indirectstorage = 0x10000000,
106 hiddenretparm = 0x20000000,
107 incidental_copy = 0x40000000,
108 auto_live = 0x80000000
112 activeheritage = 0x01,
118 unsignedprint = 0x40,
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);
184 list<PcodeOp *>::const_iterator
beginDescend(
void)
const {
return descend.begin(); }
185 list<PcodeOp *>::const_iterator
endDescend(
void)
const {
return descend.end(); }
194 PcodeOp *loneDescend(
void)
const;
196 int4 printRawNoMarkup(ostream &s)
const;
198 void printCover(ostream &s)
const;
199 void printInfo(ostream &s)
const;
201 bool operator<(
const Varnode &op2)
const;
202 bool operator==(
const Varnode &op2)
const;
205 bool intersects(
const Varnode &op)
const;
206 bool intersects(
const Address &op2loc,int4 op2size)
const;
207 int4 contains(
const Varnode &op)
const;
208 int4 characterizeOverlap(
const Varnode &op)
const;
209 int4 overlap(
const Varnode &op)
const;
210 int4 overlap(
const Address &op2loc,int4 op2size)
const;
212 int4 termOrder(
const Varnode *op)
const;
213 void printRawHeritage(ostream &s,int4 depth)
const;
265 if (!isConstant())
return false;
269 int4 isConstantExtended(uintb &val)
const;
303 bool updateType(
Datatype *ct,
bool lock,
bool override);
306 void copySymbol(
const Varnode *vn);
307 void copySymbolIfValid(
const Varnode *vn);
309 bool copyShadow(
const Varnode *op2)
const;
310 void saveXml(ostream &s)
const;
354 VarnodeLocSet::const_iterator
beginLoc(
void)
const {
return loc_tree.begin(); }
355 VarnodeLocSet::const_iterator
endLoc(
void)
const {
return loc_tree.end(); }
356 VarnodeLocSet::const_iterator beginLoc(
AddrSpace *spaceid)
const;
357 VarnodeLocSet::const_iterator endLoc(
AddrSpace *spaceid)
const;
358 VarnodeLocSet::const_iterator beginLoc(
const Address &addr)
const;
359 VarnodeLocSet::const_iterator endLoc(
const Address &addr)
const;
360 VarnodeLocSet::const_iterator beginLoc(int4 s,
const Address &addr)
const;
361 VarnodeLocSet::const_iterator endLoc(int4 s,
const Address &addr)
const;
362 VarnodeLocSet::const_iterator beginLoc(int4 s,
const Address &addr,uint4 fl)
const;
363 VarnodeLocSet::const_iterator endLoc(int4 s,
const Address &addr,uint4 fl)
const;
364 VarnodeLocSet::const_iterator beginLoc(int4 s,
const Address &addr,
const Address &pc,uintm uniq)
const;
365 VarnodeLocSet::const_iterator endLoc(int4 s,
const Address &addr,
const Address &pc,uintm uniq)
const;
366 VarnodeDefSet::const_iterator
beginDef(
void)
const {
return def_tree.begin(); }
367 VarnodeDefSet::const_iterator
endDef(
void)
const {
return def_tree.end(); }
368 VarnodeDefSet::const_iterator beginDef(uint4 fl)
const;
369 VarnodeDefSet::const_iterator endDef(uint4 fl)
const;
370 VarnodeDefSet::const_iterator beginDef(uint4 fl,
const Address &addr)
const;
371 VarnodeDefSet::const_iterator endDef(uint4 fl,
const Address &addr)
const;
373 void verifyIntegrity(
void)
const;
bool isVolatile(void) const
Is this a volatile storage location?
Definition: varnode.hh:225
bool isMapped(void) const
Is there or should be formal symbol information associated with this?
Definition: varnode.hh:233
Varnode address is specially mapped by the loader.
Definition: varnode.hh:89
void clearSpacebasePlaceholder(void)
Clear the stackpointer tracking mark.
Definition: varnode.hh:295
A region where processor data is stored.
Definition: space.hh:73
bool isSpacebasePlaceholder(void) const
Is this used specifically to track stackpointer values?
Definition: varnode.hh:239
bool isPrecisLo(void) const
Is this the low portion of a double precision value?
Definition: varnode.hh:251
Datatype * getTempType(void) const
Get the temporary Datatype (used during type propagation)
Definition: varnode.hh:179
The base datatype class for the decompiler.
Definition: type.hh:62
bool isReadOnly(void) const
Is this a read-only storage location?
Definition: varnode.hh:224
bool constantMatch(uintb val) const
Return true if this is a constant with value val.
Definition: varnode.hh:264
A storage location for a particular Symbol.
Definition: database.hh:51
void setAutoLive(void)
Mark varnode as exempt from dead-code removal.
Definition: varnode.hh:282
VarnodeLocSet::const_iterator endLoc(void) const
End of location list.
Definition: varnode.hh:355
Is this Varnode the high part of a double precision value.
Definition: varnode.hh:104
Is the varnode storage for a return address.
Definition: varnode.hh:101
A manager for different address spaces.
Definition: translate.hh:218
Class for merging low-level Varnodes into high-level HighVariables.
Definition: merge.hh:80
bool isInput(void) const
Is this an SSA input node?
Definition: varnode.hh:219
uintb getNZMask(void) const
Get the mask of bits within this that are known to be zero.
Definition: varnode.hh:211
bool hasCover(void) const
Does this have Cover information?
Definition: varnode.hh:259
Is this varnode automatically considered live, never removed as dead-code.
Definition: varnode.hh:108
void setTempType(Datatype *t) const
Set the temporary Datatype.
Definition: varnode.hh:178
void setPtrFlow(void)
Set this as flowing to or from pointer.
Definition: varnode.hh:292
Raw descriptions of varnodes and p-code ops.
Do copies of this varnode happen as a side-effect.
Definition: varnode.hh:107
Varnode has a database entry associated with it.
Definition: varnode.hh:99
bool isAutoLive(void) const
Is this varnode exempt from dead-code removal?
Definition: varnode.hh:232
Container for data structures associated with a single function.
Definition: funcdata.hh:45
Compare two Varnode pointers by location then definition.
Definition: varnode.hh:34
uintb getConsume(void) const
Get mask of consumed bits.
Definition: varnode.hh:186
Classes describing the topological scope of variables within a function.
void setPrecisHi(void)
Mark this as the high portion of a double precision value.
Definition: varnode.hh:298
bool isExplicit(void) const
Is this an explicitly printed variable?
Definition: varnode.hh:216
void setActiveHeritage(void)
Mark this as currently being linked into the SSA tree.
Definition: varnode.hh:274
Varnode * findContiguousWhole(Funcdata &data, Varnode *vn1, Varnode *vn2)
Retrieve the whole Varnode given pieces.
Definition: varnode.cc:1606
bool isConstant(void) const
Is this a constant?
Definition: varnode.hh:217
bool isAnnotation(void) const
Is this an annotation?
Definition: varnode.hh:214
void clearPrecisLo(void)
Clear the mark indicating a double precision portion.
Definition: varnode.hh:297
void setConsumeList(void)
Set marker used by dead-code algorithm.
Definition: varnode.hh:190
This varnode is an annotation and has no dataflow.
Definition: varnode.hh:73
void setImplied(void)
Mark this as an implied variable in the final C source.
Definition: varnode.hh:284
void clearAutoLive(void)
Clear exemption for dead-code removal.
Definition: varnode.hh:283
uint4 getCreateIndex(void) const
Get the creation index.
Definition: varnode.hh:182
Cover * getCover(void) const
Get Varnode coverage information.
Definition: varnode.hh:183
void clearConsumeVacuous(void)
Clear marker used by dead-code algorithm.
Definition: varnode.hh:193
bool isAddrTied(void) const
Are all Varnodes at this storage location components of the same high-level variable?
Definition: varnode.hh:230
Varnode is stored at a readonly location.
Definition: varnode.hh:90
void printRaw(ostream &s) const
Print raw p-code op descriptions to a stream.
Definition: funcdata.cc:181
bool isNameLock(void) const
Does this have a locked name?
Definition: varnode.hh:273
bool operator()(const Varnode *a, const Varnode *b) const
Functional comparison operator.
Definition: varnode.cc:26
bool isUnaffected(void) const
Is this a value that is supposed to be preserved across the function?
Definition: varnode.hh:234
This varnode CANNOT be a temporary variable.
Definition: varnode.hh:80
varnode_flags
Definition: varnode.hh:70
bool isLockedInput(void) const
Is always an input, even if unused.
Definition: varnode.hh:244
bool isIncidentalCopy(void) const
Does this varnode get copied as a side-effect.
Definition: varnode.hh:253
PcodeOp * getDef(void)
Get the defining PcodeOp of this Varnode.
Definition: varnode.hh:172
The varnode is constant.
Definition: varnode.hh:72
bool isWritten(void) const
Does this have a defining write operation?
Definition: varnode.hh:256
bool isTypeLock(void) const
Does this have a locked Datatype?
Definition: varnode.hh:272
Definition: varnode.hh:86
void clearImplied(void)
Clear the implied mark on this Varnode.
Definition: varnode.hh:285
void setLockedInput(void)
Mark as existing input, even if unused.
Definition: varnode.hh:305
bool hasNoLocalAlias(void) const
Are there (not) any local pointers that might affect this?
Definition: varnode.hh:240
This varnode has a defining op (def is nonzero)
Definition: varnode.hh:75
void clearReturnAddress(void)
Clear return address attribute.
Definition: varnode.hh:289
void clearPrecisHi(void)
Clear the mark indicating a double precision portion.
Definition: varnode.hh:299
Varnode is used to force variable into an address.
Definition: varnode.hh:97
void clearAddrForce(void)
Clear the forcing attribute.
Definition: varnode.hh:281
void clearActiveHeritage(void)
Mark this as not (actively) being linked into the SSA tree.
Definition: varnode.hh:275
~VarnodeBank(void)
Destructor.
Definition: varnode.hh:338
void setStackStore(void)
Mark as produced by explicit CPUI_STORE.
Definition: varnode.hh:304
If all uses of illegalinput varnode are inputs to INDIRECT.
Definition: varnode.hh:95
void setExplicit(void)
Mark this as an explicit variable in the final C source.
Definition: varnode.hh:286
bool isPersist(void) const
Does this storage location persist beyond the end of the function?
Definition: varnode.hh:226
void setDirectWrite(void)
Mark this as directly affected by a legal input.
Definition: varnode.hh:278
The value in this Varnode is created indirectly.
Definition: varnode.hh:100
Datatype * dataType
Temporary data-type associated with this for use in type propagate algorithm.
Definition: varnode.hh:140
Lowest level operation of the p-code language.
Definition: op.hh:58
const PcodeOp * getDef(void) const
Get the defining PcodeOp.
Definition: varnode.hh:173
bool isIndirectZero(void) const
Is this just a special placeholder representing INDIRECT creation?
Definition: varnode.hh:247
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
Prevents infinite loops.
Definition: varnode.hh:71
void setAddrForce(void)
Mark as forcing a value into this particular storage location.
Definition: varnode.hh:280
Persists after (and before) function.
Definition: varnode.hh:91
bool isActiveHeritage(void) const
Is this currently being traced by the Heritage algorithm?
Definition: varnode.hh:242
Input that exists even if its unused.
Definition: varnode.hh:120
bool isWriteMask(void) const
Is this (not) considered a true write location when calculating SSA form?
Definition: varnode.hh:254
AddrSpace * getSpace(void) const
Get the address space.
Definition: address.hh:294
Compare two Varnode pointers by definition then location.
Definition: varnode.hh:39
Datatype * getType(void) const
Get the Datatype associated with this Varnode.
Definition: varnode.hh:177
uint4 getCreateIndex(void) const
Get the next creation index to be assigned.
Definition: varnode.hh:353
High-level variable is tied to address.
Definition: varnode.hh:92
bool isIllegalInput(void) const
Is this an abnormal input to the function?
Definition: varnode.hh:220
bool isSpacebase(void) const
Is this location used to store the base point for a virtual address space?
Definition: varnode.hh:235
Created by an explicit STORE.
Definition: varnode.hh:119
void clearPtrCheck(void)
Clear the pointer check mark on this Varnode.
Definition: varnode.hh:291
Constant that must be explicitly printed as unsigned.
Definition: varnode.hh:118
SymbolEntry * getSymbolEntry(void) const
Get symbol and scope information associated with this Varnode.
Definition: varnode.hh:175
ValueSet * valueSet
Value set associated with this when performing Value Set Analysis.
Definition: varnode.hh:141
The Name of the Varnode is locked.
Definition: varnode.hh:83
void clearMark(void) const
Clear the mark on this Varnode.
Definition: varnode.hh:277
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
bool contiguous_test(Varnode *vn1, Varnode *vn2)
Test if Varnodes are pieces of a whole.
Definition: varnode.cc:1575
VarnodeLocSet::const_iterator beginLoc(void) const
Beginning of location list.
Definition: varnode.hh:354
bool isUnsignedPrint(void) const
Must this be printed as unsigned.
Definition: varnode.hh:255
(could be) Directly affected by a valid input
Definition: varnode.hh:96
void setPtrCheck(void)
Set this as checked for a constant symbol reference.
Definition: varnode.hh:290
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
In consume worklist.
Definition: varnode.hh:115
int2 getMergeGroup(void) const
Get the forced merge group of this Varnode.
Definition: varnode.hh:171
void setPrecisLo(void)
Mark this as the low portion of a double precision value.
Definition: varnode.hh:296
bool isIndirectOnly(void) const
Is this read only by INDIRECT operations?
Definition: varnode.hh:221
A description of the topological scope of a single variable object.
Definition: cover.hh:68
uint4 getFlags(void) const
Get all the boolean attributes.
Definition: varnode.hh:176
bool hasNoDescend(void) const
Return true if nothing reads this Varnode.
Definition: varnode.hh:261
AddrSpace * getSpace(void) const
Get the AddrSpace storing this Varnode.
Definition: varnode.hh:168
set< Varnode *, VarnodeCompareDefLoc > VarnodeDefSet
A set of Varnodes sorted by definition (then location)
Definition: varnode.hh:47
void saveXml(ostream &s, uint8 id, bool savetree) const
Emit an XML description of this function to stream.
Definition: funcdata.cc:687
const Address & getAddr(void) const
Get the storage Address.
Definition: varnode.hh:167
int4 getSize(void) const
Get the number of bytes this Varnode stores.
Definition: varnode.hh:170
static bool comparePointers(const Varnode *a, const Varnode *b)
Compare Varnodes as pointers.
Definition: varnode.hh:311
VarnodeDefSet::const_iterator endDef(void) const
End of Varnodes sorted by definition.
Definition: varnode.hh:367
void clearExplicit(void)
Clear the explicit mark on this Varnode.
Definition: varnode.hh:287
bool isFree(void) const
Is this free, not in SSA form?
Definition: varnode.hh:218
bool isConsumeVacuous(void) const
Get marker used by dead-code algorithm.
Definition: varnode.hh:189
bool isImplied(void) const
Is this an implied variable?
Definition: varnode.hh:215
Definition: varnode.hh:76
This varnode is a temporary variable.
Definition: varnode.hh:79
void setReturnAddress(void)
Mark as storage location for a return address.
Definition: varnode.hh:288
list< PcodeOp * >::const_iterator beginDescend(void) const
Get iterator to list of syntax tree descendants (reads)
Definition: varnode.hh:184
Input which is unaffected by the function.
Definition: varnode.hh:93
void setConsume(uintb val)
Set the mask of consumed bits (used by dead-code algorithm)
Definition: varnode.hh:187
The Varnode value is NOT a pointer.
Definition: varnode.hh:116
void setUnsignedPrint(void)
Force this to be printed as unsigned.
Definition: varnode.hh:302
void clearDirectWrite(void)
Mark this as not directly affected by a legal input.
Definition: varnode.hh:279
bool isExternalRef(void) const
Is this storage location mapped by the loader to an external location?
Definition: varnode.hh:222
This is a base register for an address space.
Definition: varnode.hh:94
bool isPrecisHi(void) const
Is this the high portion of a double precision value?
Definition: varnode.hh:252
int4 numVarnodes(void) const
Get number of Varnodes this contains.
Definition: varnode.hh:339
VarnodeDefSet::const_iterator beginDef(void) const
Beginning of Varnodes sorted by definition.
Definition: varnode.hh:366
bool isPtrFlow(void) const
Does this varnode flow to or from a known pointer.
Definition: varnode.hh:238
A high-level variable modeled as a list of low-level variables, each written once.
Definition: variable.hh:38
bool isMark(void) const
Has this been visited by the current algorithm?
Definition: varnode.hh:241
bool isExtraOut(void) const
Is this Varnode created indirectly by a CALL operation?
Definition: varnode.hh:250
ValueSet * getValueSet(void) const
Get the temporary ValueSet record.
Definition: varnode.hh:181
bool isAddrForce(void) const
Is this value forced into a particular storage location?
Definition: varnode.hh:231
There are no aliases pointing to this varnode.
Definition: varnode.hh:84
The Dataype of the Varnode is locked.
Definition: varnode.hh:82
void setMark(void) const
Mark this Varnode for breadcrumb algorithms.
Definition: varnode.hh:276
void setConsumeVacuous(void)
Set marker used by dead-code algorithm.
Definition: varnode.hh:191
void setWriteMask(void)
Mark this as not a true write when computing SSA form.
Definition: varnode.hh:300
A container for Varnode objects from a specific function.
Definition: varnode.hh:325
If this varnode flows to or from a pointer.
Definition: varnode.hh:117
uintb getOffset(void) const
Get the offset (within its AddrSpace) where this is stored.
Definition: varnode.hh:169
bool isStackStore(void) const
Was this originally produced by an explicit STORE.
Definition: varnode.hh:243
void setHigh(HighVariable *tv, int2 mg)
Set the HighVariable owning this Varnode.
Definition: varnode.hh:165
void clearWriteMask(void)
Clear the mark indicating this is not a true write.
Definition: varnode.hh:301
set< Varnode *, VarnodeCompareLocDef > VarnodeLocSet
A set of Varnodes sorted by location (then by definition)
Definition: varnode.hh:44
bool isDirectWrite(void) const
Is this value affected by a legitimate function input.
Definition: varnode.hh:227
list< PcodeOp * >::const_iterator endDescend(void) const
Get the end iterator to list of descendants.
Definition: varnode.hh:185
bool isConsumeList(void) const
Get marker used by dead-code algorithm.
Definition: varnode.hh:188
bool isPtrCheck(void) const
Has this been checked as a constant pointer to a mapped symbol?
Definition: varnode.hh:237
void clearConsumeList(void)
Clear marker used by dead-code algorithm.
Definition: varnode.hh:192
void clearPtrFlow(void)
Indicate that this varnode is not flowing to or from pointer.
Definition: varnode.hh:293
Vacuous consume.
Definition: varnode.hh:114
Should not be considered a write in heritage calculation.
Definition: varnode.hh:113
Cover is not upto date.
Definition: varnode.hh:102
bool operator!=(const Varnode &op2) const
Inequality operator.
Definition: varnode.hh:203
The varnode is actively being heritaged.
Definition: varnode.hh:112
void setSpacebasePlaceholder(void)
Mark this as a special Varnode for tracking stackpointer values.
Definition: varnode.hh:294
addl_flags
Additional boolean properties on a Varnode.
Definition: varnode.hh:111
A range of values attached to a Varnode within a data-flow subsystem.
Definition: rangeutil.hh:111
bool isReturnAddress(void) const
Is this storage for a calls return address?
Definition: varnode.hh:236
This varnode has no ancestor.
Definition: varnode.hh:74
bool hasActionProperty(void) const
Will this Varnode be replaced dynamically?
Definition: varnode.hh:223
void setValueSet(ValueSet *v) const
Set the temporary ValueSet record.
Definition: varnode.hh:180
This varnode's value is volatile.
Definition: varnode.hh:85
Is this Varnode the low part of a double precision value.
Definition: varnode.hh:103