My Project
varnode.hh
Go to the documentation of this file.
1 /* ###
2  * IP: GHIDRA
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
18 #ifndef __CPUI_VARNODE__
19 #define __CPUI_VARNODE__
20 
21 #include "pcoderaw.hh"
22 #include "cover.hh"
23 
24 class HighVariable;
25 
26 class Varnode; // Forward declaration
27 class VarnodeBank;
28 class Merge;
29 class Funcdata;
30 class SymbolEntry;
31 class ValueSet;
32 
35  bool operator()(const Varnode *a,const Varnode *b) const;
36 };
37 
40  bool operator()(const Varnode *a,const Varnode *b) const;
41 };
42 
44 typedef set<Varnode *,VarnodeCompareLocDef> VarnodeLocSet;
45 
47 typedef set<Varnode *,VarnodeCompareDefLoc> VarnodeDefSet;
48 
65 class Varnode {
66 public:
71  mark = 0x01,
72  constant = 0x02,
73  annotation = 0x04,
74  input = 0x08,
75  written = 0x10,
76  insert = 0x20,
77  implied = 0x40,
80  explict = 0x80,
81 
82  typelock = 0x100,
83  namelock = 0x200,
84  nolocalalias = 0x400,
85  volatil = 0x800,
86  spacebase_placeholder = 0x1000,
87 
89  externref = 0x2000,
90  readonly = 0x4000,
91  persist = 0x8000,
92  addrtied = 0x10000,
93  unaffected = 0x20000,
94  spacebase = 0x40000,
95  indirectonly = 0x80000,
96  directwrite = 0x100000,
97  addrforce = 0x200000,
98 
99  mapped = 0x400000,
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
109  };
111  enum addl_flags {
112  activeheritage = 0x01,
113  writemask = 0x02,
114  vacconsume = 0x04,
115  lisconsume = 0x08,
116  ptrcheck = 0x10,
117  ptrflow = 0x20,
118  unsignedprint = 0x40,
119  stack_store = 0x80,
120  locked_input = 0x100
121  };
122 private:
123  mutable uint4 flags;
124  int4 size;
125  uint4 create_index;
126  int2 mergegroup;
127  uint2 addlflags;
128  Address loc;
129 
130  // Heritage fields
131  PcodeOp *def;
132  HighVariable *high;
133  SymbolEntry *mapentry;
134  Datatype *type;
135  VarnodeLocSet::iterator lociter;
136  VarnodeDefSet::iterator defiter;
137  list<PcodeOp *> descend;
138  mutable Cover *cover;
139  mutable union {
142  } temp;
143  uintb consumed;
144  uintb nzm;
145  friend class VarnodeBank;
146  friend class Merge;
147  friend class Funcdata;
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;
153  void setUnaffected(void) { setFlags(Varnode::unaffected); }
154  // These functions should be only private things used by VarnodeBank
155  void setInput(void) { setFlags(Varnode::input|Varnode::coverdirty); }
156  void setDef(PcodeOp *op);
157  bool setSymbolProperties(SymbolEntry *entry);
158  void setSymbolEntry(SymbolEntry *entry);
159  void setSymbolReference(SymbolEntry *entry,int4 off);
160  void addDescend(PcodeOp *op);
161  void eraseDescend(PcodeOp *op);
162  void destroyDescend(void);
163 public:
164  // only to be used by HighVariable
165  void setHigh(HighVariable *tv,int2 mg) { high = tv; mergegroup = mg; }
166 
167  const Address &getAddr(void) const { return (const Address &) loc; }
168  AddrSpace *getSpace(void) const { return loc.getSpace(); }
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; }
174  HighVariable *getHigh(void) const;
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; }
188  bool isConsumeList(void) const { return ((addlflags&Varnode::lisconsume)!=0); }
189  bool isConsumeVacuous(void) const { return ((addlflags&Varnode::vacconsume)!=0); }
190  void setConsumeList(void) { addlflags |= Varnode::lisconsume; }
191  void setConsumeVacuous(void) { addlflags |= Varnode::vacconsume; }
192  void clearConsumeList(void) { addlflags &= ~Varnode::lisconsume; }
193  void clearConsumeVacuous(void) { addlflags &= ~Varnode::vacconsume; }
194  PcodeOp *loneDescend(void) const;
195  Address getUsePoint(const Funcdata &fd) const;
196  int4 printRawNoMarkup(ostream &s) const;
197  void printRaw(ostream &s) const;
198  void printCover(ostream &s) const;
199  void printInfo(ostream &s) const;
200  Varnode(int4 s,const Address &m,Datatype *dt);
201  bool operator<(const Varnode &op2) const;
202  bool operator==(const Varnode &op2) const;
203  bool operator!=(const Varnode &op2) const { return !operator==(op2); }
204  ~Varnode(void);
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;
211  uintb getNZMask(void) const { return nzm; }
212  int4 termOrder(const Varnode *op) const;
213  void printRawHeritage(ostream &s,int4 depth) const;
214  bool isAnnotation(void) const { return ((flags&Varnode::annotation)!=0); }
215  bool isImplied(void) const { return ((flags&Varnode::implied)!=0); }
216  bool isExplicit(void) const { return ((flags&Varnode::explict)!=0); }
217  bool isConstant(void) const { return ((flags&Varnode::constant)!=0); }
218  bool isFree(void) const { return ((flags&(Varnode::written|Varnode::input))==0); }
219  bool isInput(void) const { return ((flags&Varnode::input)!=0); }
220  bool isIllegalInput(void) const { return ((flags&(Varnode::input|Varnode::directwrite))==Varnode::input); }
221  bool isIndirectOnly(void) const { return ((flags&Varnode::indirectonly)!=0); }
222  bool isExternalRef(void) const { return ((flags&Varnode::externref)!=0); }
223  bool hasActionProperty(void) const { return ((flags&(Varnode::readonly|Varnode::volatil))!=0); }
224  bool isReadOnly(void) const { return ((flags&Varnode::readonly)!=0); }
225  bool isVolatile(void) const { return ((flags&Varnode::volatil)!=0); }
226  bool isPersist(void) const { return ((flags&Varnode::persist)!=0); }
227  bool isDirectWrite(void) const { return ((flags&Varnode::directwrite)!=0); }
228 
231  bool isAddrForce(void) const { return ((flags&Varnode::addrforce)!=0); }
232  bool isAutoLive(void) const { return ((flags&Varnode::auto_live)!=0); }
233  bool isMapped(void) const { return ((flags&Varnode::mapped)!=0); }
234  bool isUnaffected(void) const { return ((flags&Varnode::unaffected)!=0); }
235  bool isSpacebase(void) const { return ((flags&Varnode::spacebase)!=0); }
236  bool isReturnAddress(void) const { return ((flags&Varnode::return_address)!=0); }
237  bool isPtrCheck(void) const { return ((addlflags&Varnode::ptrcheck)!=0); }
238  bool isPtrFlow(void) const { return ((addlflags&Varnode::ptrflow)!=0); }
239  bool isSpacebasePlaceholder(void) const { return ((flags&Varnode::spacebase_placeholder)!=0); }
240  bool hasNoLocalAlias(void) const { return ((flags&Varnode::nolocalalias)!=0); }
241  bool isMark(void) const { return ((flags&Varnode::mark)!=0); }
242  bool isActiveHeritage(void) const { return ((addlflags&Varnode::activeheritage)!=0); }
243  bool isStackStore(void) const { return ((addlflags&Varnode::stack_store)!=0); }
244  bool isLockedInput(void) const { return ((addlflags&Varnode::locked_input)!=0); }
245 
248 
251  bool isPrecisLo(void) const { return ((flags&Varnode::precislo)!=0); }
252  bool isPrecisHi(void) const { return ((flags&Varnode::precishi)!=0); }
253  bool isIncidentalCopy(void) const { return ((flags&Varnode::incidental_copy)!=0); }
254  bool isWriteMask(void) const { return ((addlflags&Varnode::writemask)!=0); }
255  bool isUnsignedPrint(void) const { return ((addlflags&Varnode::unsignedprint)!=0); }
256  bool isWritten(void) const { return ((flags&Varnode::written)!=0); }
257 
259  bool hasCover(void) const {
261  bool hasNoDescend(void) const { return descend.empty(); }
262 
264  bool constantMatch(uintb val) const {
265  if (!isConstant()) return false;
266  return (loc.getOffset() == val);
267  }
268 
269  int4 isConstantExtended(uintb &val) const;
270  bool isHeritageKnown(void) const { return ((flags&(Varnode::insert|Varnode::constant|Varnode::annotation))!=0); }
272  bool isTypeLock(void) const { return ((flags&Varnode::typelock)!=0); }
273  bool isNameLock(void) const { return ((flags&Varnode::namelock)!=0); }
274  void setActiveHeritage(void) { addlflags |= Varnode::activeheritage; }
275  void clearActiveHeritage(void) { addlflags &= ~Varnode::activeheritage; }
276  void setMark(void) const { flags |= Varnode::mark; }
277  void clearMark(void) const { flags &= ~Varnode::mark; }
278  void setDirectWrite(void) { flags |= Varnode::directwrite; }
279  void clearDirectWrite(void) { flags &= ~Varnode::directwrite; }
281  void clearAddrForce(void) { clearFlags(Varnode::addrforce | Varnode::auto_live); }
282  void setAutoLive(void) { flags |= Varnode::auto_live; }
283  void clearAutoLive(void) { flags &= ~Varnode::auto_live; }
284  void setImplied(void) { setFlags(Varnode::implied); }
285  void clearImplied(void) { clearFlags(Varnode::implied); }
286  void setExplicit(void) { setFlags(Varnode::explict); }
287  void clearExplicit(void) { clearFlags(Varnode::explict); }
288  void setReturnAddress(void) { flags |= Varnode::return_address; }
289  void clearReturnAddress(void) { flags &= ~Varnode::return_address; }
290  void setPtrCheck(void) { addlflags |= Varnode::ptrcheck; }
291  void clearPtrCheck(void) { addlflags &= ~Varnode::ptrcheck; }
292  void setPtrFlow(void) { addlflags |= Varnode::ptrflow; }
293  void clearPtrFlow(void) { addlflags &= ~Varnode::ptrflow; }
296  void setPrecisLo(void) { setFlags(Varnode::precislo); }
297  void clearPrecisLo(void) { clearFlags(Varnode::precislo); }
298  void setPrecisHi(void) { setFlags(Varnode::precishi); }
299  void clearPrecisHi(void) { clearFlags(Varnode::precishi); }
300  void setWriteMask(void) { addlflags |= Varnode::writemask; }
301  void clearWriteMask(void) { addlflags &= ~Varnode::writemask; }
302  void setUnsignedPrint(void) { addlflags |= Varnode::unsignedprint; }
303  bool updateType(Datatype *ct,bool lock,bool override);
304  void setStackStore(void) { addlflags |= Varnode::stack_store; }
305  void setLockedInput(void) { addlflags |= Varnode::locked_input; }
306  void copySymbol(const Varnode *vn);
307  void copySymbolIfValid(const Varnode *vn);
308  Datatype *getLocalType(void) const;
309  bool copyShadow(const Varnode *op2) const;
310  void saveXml(ostream &s) const;
311  static bool comparePointers(const Varnode *a,const Varnode *b) { return (*a < *b); }
312  // static Varnode *restoreXml(const Element *el,Funcdata &fd,bool coderef);
313 };
314 
325 class VarnodeBank {
326  AddrSpaceManager *manage;
327  AddrSpace *uniq_space;
328  uintm uniqbase;
329  uintm uniqid;
330  uint4 create_index;
331  VarnodeLocSet loc_tree;
332  VarnodeDefSet def_tree;
333  mutable Varnode searchvn;
334  Varnode *xref(Varnode *vn);
335 public:
336  VarnodeBank(AddrSpaceManager *m,AddrSpace *uspace,uintm ubase);
337  void clear(void);
338  ~VarnodeBank(void) { clear(); }
339  int4 numVarnodes(void) const { return loc_tree.size(); }
340  Varnode *create(int4 s,const Address &m,Datatype *ct);
341  Varnode *createDef(int4 s,const Address &m,Datatype *ct,PcodeOp *op);
342  Varnode *createUnique(int4 s,Datatype *ct);
343  Varnode *createDefUnique(int4 s,Datatype *ct,PcodeOp *op);
344  void destroy(Varnode *vn);
345  Varnode *setInput(Varnode *vn);
346  Varnode *setDef(Varnode *vn,PcodeOp *op);
347  void makeFree(Varnode *vn);
348  void replace(Varnode *oldvn,Varnode *newvn);
349  Varnode *find(int4 s,const Address &loc,const Address &pc,uintm uniq=~((uintm)0)) const;
350  Varnode *findInput(int4 s,const Address &loc) const;
351  Varnode *findCoveredInput(int4 s,const Address &loc) const;
352  Varnode *findCoveringInput(int4 s,const Address &loc) const;
353  uint4 getCreateIndex(void) const { return create_index; }
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;
372 #ifdef VARBANK_DEBUG
373  void verifyIntegrity(void) const;
374 #endif
375 };
376 
377 bool contiguous_test(Varnode *vn1,Varnode *vn2);
379  Varnode *vn2);
380 #endif
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&#39;s value is volatile.
Definition: varnode.hh:85
Is this Varnode the low part of a double precision value.
Definition: varnode.hh:103