Ghidra Decompiler Analysis Engine
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 
87  externref = 0x1000,
88  readonly = 0x2000,
89  persist = 0x4000,
90  addrtied = 0x8000,
91  unaffected = 0x10000,
92  spacebase = 0x20000,
93  indirectonly = 0x40000,
94  directwrite = 0x80000,
95  addrforce = 0x100000,
96 
97  mapped = 0x200000,
98  indirect_creation = 0x400000,
99  return_address = 0x800000,
100  coverdirty = 0x1000000,
101  precislo = 0x2000000,
102  precishi = 0x4000000,
103  indirectstorage = 0x8000000,
104  hiddenretparm = 0x10000000,
105  incidental_copy = 0x20000000,
106  autolive_hold = 0x40000000
107  };
109  enum addl_flags {
110  activeheritage = 0x01,
111  writemask = 0x02,
112  vacconsume = 0x04,
113  lisconsume = 0x08,
114  ptrcheck = 0x10,
115  ptrflow = 0x20,
116  unsignedprint = 0x40,
117  stack_store = 0x80,
118  locked_input = 0x100,
120  };
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::addrforce|Varnode::autolive_hold))!=0); }
233  bool isAutoLiveHold(void) const { return ((flags&Varnode::autolive_hold)!=0); }
234  bool isMapped(void) const { return ((flags&Varnode::mapped)!=0); }
235  bool isUnaffected(void) const { return ((flags&Varnode::unaffected)!=0); }
236  bool isSpacebase(void) const { return ((flags&Varnode::spacebase)!=0); }
237  bool isReturnAddress(void) const { return ((flags&Varnode::return_address)!=0); }
238  bool isPtrCheck(void) const { return ((addlflags&Varnode::ptrcheck)!=0); }
239  bool isPtrFlow(void) const { return ((addlflags&Varnode::ptrflow)!=0); }
240  bool isSpacebasePlaceholder(void) const { return ((addlflags&Varnode::spacebase_placeholder)!=0); }
241  bool hasNoLocalAlias(void) const { return ((flags&Varnode::nolocalalias)!=0); }
242  bool isMark(void) const { return ((flags&Varnode::mark)!=0); }
243  bool isActiveHeritage(void) const { return ((addlflags&Varnode::activeheritage)!=0); }
244  bool isStackStore(void) const { return ((addlflags&Varnode::stack_store)!=0); }
245  bool isLockedInput(void) const { return ((addlflags&Varnode::locked_input)!=0); }
246 
249 
252  bool isPrecisLo(void) const { return ((flags&Varnode::precislo)!=0); }
253  bool isPrecisHi(void) const { return ((flags&Varnode::precishi)!=0); }
254  bool isIncidentalCopy(void) const { return ((flags&Varnode::incidental_copy)!=0); }
255  bool isWriteMask(void) const { return ((addlflags&Varnode::writemask)!=0); }
256  bool isUnsignedPrint(void) const { return ((addlflags&Varnode::unsignedprint)!=0); }
257  bool isWritten(void) const { return ((flags&Varnode::written)!=0); }
258 
260  bool hasCover(void) const {
262  bool hasNoDescend(void) const { return descend.empty(); }
263 
265  bool constantMatch(uintb val) const {
266  if (!isConstant()) return false;
267  return (loc.getOffset() == val);
268  }
269 
270  int4 isConstantExtended(uintb &val) const;
271  bool isHeritageKnown(void) const { return ((flags&(Varnode::insert|Varnode::constant|Varnode::annotation))!=0); }
273  bool isTypeLock(void) const { return ((flags&Varnode::typelock)!=0); }
274  bool isNameLock(void) const { return ((flags&Varnode::namelock)!=0); }
275  void setActiveHeritage(void) { addlflags |= Varnode::activeheritage; }
276  void clearActiveHeritage(void) { addlflags &= ~Varnode::activeheritage; }
277  void setMark(void) const { flags |= Varnode::mark; }
278  void clearMark(void) const { flags &= ~Varnode::mark; }
279  void setDirectWrite(void) { flags |= Varnode::directwrite; }
280  void clearDirectWrite(void) { flags &= ~Varnode::directwrite; }
281  void setAddrForce(void) { setFlags(Varnode::addrforce); }
282  void clearAddrForce(void) { clearFlags(Varnode::addrforce); }
283  void setImplied(void) { setFlags(Varnode::implied); }
284  void clearImplied(void) { clearFlags(Varnode::implied); }
285  void setExplicit(void) { setFlags(Varnode::explict); }
286  void clearExplicit(void) { clearFlags(Varnode::explict); }
287  void setReturnAddress(void) { flags |= Varnode::return_address; }
288  void clearReturnAddress(void) { flags &= ~Varnode::return_address; }
289  void setPtrCheck(void) { addlflags |= Varnode::ptrcheck; }
290  void clearPtrCheck(void) { addlflags &= ~Varnode::ptrcheck; }
291  void setPtrFlow(void) { addlflags |= Varnode::ptrflow; }
292  void clearPtrFlow(void) { addlflags &= ~Varnode::ptrflow; }
293  void setSpacebasePlaceholder(void) { addlflags |= Varnode::spacebase_placeholder; }
294  void clearSpacebasePlaceholder(void) { addlflags &= ~Varnode::spacebase_placeholder; }
295  void setPrecisLo(void) { setFlags(Varnode::precislo); }
296  void clearPrecisLo(void) { clearFlags(Varnode::precislo); }
297  void setPrecisHi(void) { setFlags(Varnode::precishi); }
298  void clearPrecisHi(void) { clearFlags(Varnode::precishi); }
299  void setWriteMask(void) { addlflags |= Varnode::writemask; }
300  void clearWriteMask(void) { addlflags &= ~Varnode::writemask; }
301  void setAutoLiveHold(void) { flags |= Varnode::autolive_hold; }
302  void clearAutoLiveHold(void) { flags &= ~Varnode::autolive_hold; }
303  void setUnsignedPrint(void) { addlflags |= Varnode::unsignedprint; }
304  bool updateType(Datatype *ct,bool lock,bool override);
305  void setStackStore(void) { addlflags |= Varnode::stack_store; }
306  void setLockedInput(void) { addlflags |= Varnode::locked_input; }
307  void copySymbol(const Varnode *vn);
308  void copySymbolIfValid(const Varnode *vn);
309  Datatype *getLocalType(void) const;
310  bool copyShadow(const Varnode *op2) const;
311  void saveXml(ostream &s) const;
312  static bool comparePointers(const Varnode *a,const Varnode *b) { return (*a < *b); }
313  static void printRaw(ostream &s,const Varnode *vn);
314  // static Varnode *restoreXml(const Element *el,Funcdata &fd,bool coderef);
315 };
316 
327 class VarnodeBank {
328  AddrSpaceManager *manage;
329  AddrSpace *uniq_space;
330  uintm uniqbase;
331  uintm uniqid;
332  uint4 create_index;
333  VarnodeLocSet loc_tree;
334  VarnodeDefSet def_tree;
335  mutable Varnode searchvn;
336  Varnode *xref(Varnode *vn);
337 public:
338  VarnodeBank(AddrSpaceManager *m,AddrSpace *uspace,uintm ubase);
339  void clear(void);
340  ~VarnodeBank(void) { clear(); }
341  int4 numVarnodes(void) const { return loc_tree.size(); }
342  Varnode *create(int4 s,const Address &m,Datatype *ct);
343  Varnode *createDef(int4 s,const Address &m,Datatype *ct,PcodeOp *op);
344  Varnode *createUnique(int4 s,Datatype *ct);
345  Varnode *createDefUnique(int4 s,Datatype *ct,PcodeOp *op);
346  void destroy(Varnode *vn);
347  Varnode *setInput(Varnode *vn);
348  Varnode *setDef(Varnode *vn,PcodeOp *op);
349  void makeFree(Varnode *vn);
350  void replace(Varnode *oldvn,Varnode *newvn);
351  Varnode *find(int4 s,const Address &loc,const Address &pc,uintm uniq=~((uintm)0)) const;
352  Varnode *findInput(int4 s,const Address &loc) const;
353  Varnode *findCoveredInput(int4 s,const Address &loc) const;
354  Varnode *findCoveringInput(int4 s,const Address &loc) const;
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(); }
358  VarnodeLocSet::const_iterator beginLoc(AddrSpace *spaceid) const;
359  VarnodeLocSet::const_iterator endLoc(AddrSpace *spaceid) const;
360  VarnodeLocSet::const_iterator beginLoc(const Address &addr) const;
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;
366  VarnodeLocSet::const_iterator beginLoc(int4 s,const Address &addr,const Address &pc,uintm uniq) 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;
374 #ifdef VARBANK_DEBUG
375  void verifyIntegrity(void) const;
376 #endif
377 };
378 
379 bool contiguous_test(Varnode *vn1,Varnode *vn2);
381  Varnode *vn2);
382 #endif
Varnode::namelock
@ namelock
The Name of the Varnode is locked.
Definition: varnode.hh:83
VarnodeCompareDefLoc::operator()
bool operator()(const Varnode *a, const Varnode *b) const
Functional comparison operator.
Definition: varnode.cc:52
Varnode::persist
@ persist
Persists after (and before) function.
Definition: varnode.hh:89
Varnode::updateType
bool updateType(Datatype *ct, bool lock, bool override)
(Possibly) set the Datatype given various restrictions
Definition: varnode.cc:419
Varnode::printInfo
void printInfo(ostream &s) const
Print raw attribute info about the Varnode.
Definition: varnode.cc:255
Varnode::getHigh
HighVariable * getHigh(void) const
Get the high-level variable associated with this Varnode.
Definition: varnode.cc:80
AddrSpace
A region where processor data is stored.
Definition: space.hh:73
Varnode::insert
@ insert
Definition: varnode.hh:76
VarnodeBank::find
Varnode * find(int4 s, const Address &loc, const Address &pc, uintm uniq=~((uintm) 0)) const
Find a Varnode.
Definition: varnode.cc:1074
VarnodeBank::setInput
Varnode * setInput(Varnode *vn)
Mark a Varnode as an input to the function.
Definition: varnode.cc:992
Varnode::ptrcheck
@ ptrcheck
The Varnode value is NOT a pointer.
Definition: varnode.hh:114
VarnodeCompareLocDef
Compare two Varnode pointers by location then definition.
Definition: varnode.hh:34
Varnode::hiddenretparm
@ hiddenretparm
Does this varnode point to the return value storage location.
Definition: varnode.hh:104
VarnodeBank::endLoc
VarnodeLocSet::const_iterator endLoc(AddrSpace *spaceid) const
Ending of Varnodes in given address space sorted by location.
Definition: varnode.cc:1182
Varnode::mark
@ mark
Prevents infinite loops.
Definition: varnode.hh:71
Varnode::printRaw
void printRaw(ostream &s) const
Print a simple identifier plus additional info identifying Varnode with SSA form.
Definition: varnode.cc:634
Varnode::directwrite
@ directwrite
(could be) Directly affected by a valid input
Definition: varnode.hh:94
Varnode::nolocalalias
@ nolocalalias
There are no aliases pointing to this varnode.
Definition: varnode.hh:84
Varnode::printCover
void printCover(ostream &s) const
Print raw coverage info about the Varnode.
Definition: varnode.cc:242
Varnode::implied
@ implied
This varnode is a temporary variable.
Definition: varnode.hh:79
Varnode::lisconsume
@ lisconsume
In consume worklist.
Definition: varnode.hh:113
Varnode::stack_store
@ stack_store
Created by an explicit STORE.
Definition: varnode.hh:117
Merge
Class for merging low-level Varnodes into high-level HighVariables.
Definition: merge.hh:80
VarnodeBank::endDef
VarnodeDefSet::const_iterator endDef(uint4 fl) const
End of varnodes with set definition property.
Definition: varnode.cc:1440
VarnodeBank::makeFree
void makeFree(Varnode *vn)
Convert a Varnode to be free.
Definition: varnode.cc:950
Varnode::vacconsume
@ vacconsume
Vacuous consume.
Definition: varnode.hh:112
Varnode::writemask
@ writemask
Should not be considered a write in heritage calculation.
Definition: varnode.hh:111
Varnode::addl_flags
addl_flags
Additional boolean properties on a Varnode.
Definition: varnode.hh:109
Varnode::isHeritageKnown
bool isHeritageKnown(void) const
Return true if this Varnode is linked into the SSA tree.
Definition: varnode.hh:272
VarnodeBank::createDefUnique
Varnode * createDefUnique(int4 s, Datatype *ct, PcodeOp *op)
Create a temporary Varnode as output of a PcodeOp.
Definition: varnode.cc:1060
Address::getOffset
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
Varnode::overlap
int4 overlap(const Varnode &op) const
Return relative point of overlap between two Varnodes.
Definition: varnode.cc:170
Varnode::loneDescend
PcodeOp * loneDescend(void) const
Return unique reading PcodeOp, or null if there are zero or more than 1.
Definition: varnode.cc:569
Varnode::typelock
@ typelock
The Dataype of the Varnode is locked.
Definition: varnode.hh:82
PcodeOp
Lowest level operation of the p-code language.
Definition: op.hh:58
Varnode::unaffected
@ unaffected
Input which is unaffected by the function.
Definition: varnode.hh:91
SymbolEntry
A storage location for a particular Symbol.
Definition: database.hh:51
Varnode::ptrflow
@ ptrflow
If this varnode flows to or from a pointer.
Definition: varnode.hh:115
Varnode::spacebase
@ spacebase
This is a base register for an address space.
Definition: varnode.hh:92
Varnode::copySymbolIfValid
void copySymbolIfValid(const Varnode *vn)
Copy symbol info from vn if constant value matches.
Definition: varnode.cc:455
VarnodeCompareDefLoc
Compare two Varnode pointers by definition then location.
Definition: varnode.hh:39
Varnode
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
Varnode::externref
@ externref
Varnode address is specially mapped by the loader.
Definition: varnode.hh:87
Varnode::coverdirty
@ coverdirty
Cover is not upto date.
Definition: varnode.hh:100
Varnode::activeheritage
@ activeheritage
The varnode is actively being heritaged.
Definition: varnode.hh:110
Varnode::intersects
bool intersects(const Varnode &op) const
Return true if the storage locations intersect.
Definition: varnode.cc:113
Varnode::isConstantExtended
int4 isConstantExtended(uintb &val) const
Definition: varnode.cc:695
Varnode::characterizeOverlap
int4 characterizeOverlap(const Varnode &op) const
Return 0, 1, or 2 for "no overlap", "partial overlap", "identical storage".
Definition: varnode.cc:147
Varnode::mapped
@ mapped
Varnode has a database entry associated with it.
Definition: varnode.hh:97
ValueSet
A range of values attached to a Varnode within a data-flow subsystem.
Definition: rangeutil.hh:111
Varnode::return_address
@ return_address
Is the varnode storage for a return address.
Definition: varnode.hh:99
Varnode::volatil
@ volatil
This varnode's value is volatile.
Definition: varnode.hh:85
VarnodeBank::create
Varnode * create(int4 s, const Address &m, Datatype *ct)
Create a free Varnode object.
Definition: varnode.cc:884
Varnode::constantMatch
bool constantMatch(uintb val) const
Return true if this is a constant with value val.
Definition: varnode.hh:265
Varnode::annotation
@ annotation
This varnode is an annotation and has no dataflow.
Definition: varnode.hh:73
Varnode::copySymbol
void copySymbol(const Varnode *vn)
Copy symbol info from vn.
Definition: varnode.cc:438
Cover
A description of the topological scope of a single variable object.
Definition: cover.hh:68
Varnode::isAddrTied
bool isAddrTied(void) const
Are all Varnodes at this storage location components of the same high-level variable?
Definition: varnode.hh:230
Address::getSpace
AddrSpace * getSpace(void) const
Get the address space.
Definition: address.hh:294
Address
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
Varnode::isIndirectZero
bool isIndirectZero(void) const
Is this just a special placeholder representing INDIRECT creation?
Definition: varnode.hh:248
VarnodeBank::findCoveringInput
Varnode * findCoveringInput(int4 s, const Address &loc) const
Find an input Varnode covering a range.
Definition: varnode.cc:1147
Funcdata
Container for data structures associated with a single function.
Definition: funcdata.hh:45
Datatype
The base datatype class for the decompiler.
Definition: type.hh:62
Varnode::~Varnode
~Varnode(void)
Destructor.
Definition: varnode.cc:555
Varnode::contains
int4 contains(const Varnode &op) const
Return info about the containment of op in this.
Definition: varnode.cc:97
Varnode::Varnode
Varnode(int4 s, const Address &m, Datatype *dt)
Construct a free Varnode.
Definition: varnode.cc:523
Varnode::input
@ input
This varnode has no ancestor.
Definition: varnode.hh:74
Varnode::hasCover
bool hasCover(void) const
Does this have Cover information?
Definition: varnode.hh:260
Varnode::varnode_flags
varnode_flags
Definition: varnode.hh:70
Varnode::printRawHeritage
void printRawHeritage(ostream &s, int4 depth) const
Print a simple SSA subtree rooted at this.
Definition: varnode.cc:654
Varnode::precishi
@ precishi
Is this Varnode the high part of a double precision value.
Definition: varnode.hh:102
cover.hh
Classes describing the topological scope of variables within a function.
Varnode::precislo
@ precislo
Is this Varnode the low part of a double precision value.
Definition: varnode.hh:101
Varnode::constant
@ constant
The varnode is constant.
Definition: varnode.hh:72
HighVariable
A high-level variable modeled as a list of low-level variables, each written once.
Definition: variable.hh:38
Varnode::saveXml
void saveXml(ostream &s) const
Save a description of this as an XML tag.
Definition: varnode.cc:816
Varnode::getUsePoint
Address getUsePoint(const Funcdata &fd) const
Get Address when this Varnode first comes into scope.
Definition: varnode.cc:589
Varnode::printRawNoMarkup
int4 printRawNoMarkup(ostream &s) const
Print a simple identifier for the Varnode.
Definition: varnode.cc:604
VarnodeBank::beginLoc
VarnodeLocSet::const_iterator beginLoc(AddrSpace *spaceid) const
Beginning of Varnodes in given address space sorted by location.
Definition: varnode.cc:1171
VarnodeBank::findCoveredInput
Varnode * findCoveredInput(int4 s, const Address &loc) const
Find an input Varnode contained within this range.
Definition: varnode.cc:1119
VarnodeBank::VarnodeBank
VarnodeBank(AddrSpaceManager *m, AddrSpace *uspace, uintm ubase)
Construct the container.
Definition: varnode.cc:852
Varnode::getLocalType
Datatype * getLocalType(void) const
Calculate type of Varnode based on local information.
Definition: varnode.cc:726
VarnodeDefSet
set< Varnode *, VarnodeCompareDefLoc > VarnodeDefSet
A set of Varnodes sorted by definition (then location)
Definition: varnode.hh:47
findContiguousWhole
Varnode * findContiguousWhole(Funcdata &data, Varnode *vn1, Varnode *vn2)
Retrieve the whole Varnode given pieces.
Definition: varnode.cc:1616
Varnode::spacebase_placeholder
@ spacebase_placeholder
value at a specific point in the code
Definition: varnode.hh:119
Varnode::operator<
bool operator<(const Varnode &op2) const
Comparison operator on Varnode.
Definition: varnode.cc:478
VarnodeBank::clear
void clear(void)
Clear out all Varnodes and reset counters.
Definition: varnode.cc:864
Varnode::written
@ written
This varnode has a defining op (def is nonzero)
Definition: varnode.hh:75
VarnodeBank::setDef
Varnode * setDef(Varnode *vn, PcodeOp *op)
Change Varnode to be defined by the given PcodeOp.
Definition: varnode.cc:1014
Varnode::incidental_copy
@ incidental_copy
Do copies of this varnode happen as a side-effect.
Definition: varnode.hh:105
Varnode::readonly
@ readonly
Varnode is stored at a readonly location.
Definition: varnode.hh:88
Varnode::termOrder
int4 termOrder(const Varnode *op) const
Compare two Varnodes based on their term order.
Definition: varnode.cc:787
Varnode::copyShadow
bool copyShadow(const Varnode *op2) const
Are this and op2 copied from the same source?
Definition: varnode.cc:764
VarnodeBank::createUnique
Varnode * createUnique(int4 s, Datatype *ct)
Create a temporary varnode.
Definition: varnode.cc:899
contiguous_test
bool contiguous_test(Varnode *vn1, Varnode *vn2)
Test if Varnodes are pieces of a whole.
Definition: varnode.cc:1585
pcoderaw.hh
Raw descriptions of varnodes and p-code ops.
VarnodeBank::beginDef
VarnodeDefSet::const_iterator beginDef(uint4 fl) const
Beginning of varnodes with set definition property.
Definition: varnode.cc:1402
VarnodeBank::destroy
void destroy(Varnode *vn)
Remove a Varnode from the container.
Definition: varnode.cc:910
AddrSpaceManager
A manager for different address spaces.
Definition: translate.hh:218
VarnodeBank::replace
void replace(Varnode *oldvn, Varnode *newvn)
Replace every read of one Varnode with another.
Definition: varnode.cc:966
Varnode::valueSet
ValueSet * valueSet
Value set associated with this when performing Value Set Analysis.
Definition: varnode.hh:141
Varnode::autolive_hold
@ autolive_hold
Temporarily block dead-code removal of this.
Definition: varnode.hh:106
Varnode::addrforce
@ addrforce
Varnode is used to force variable into an address.
Definition: varnode.hh:95
Varnode::unsignedprint
@ unsignedprint
Constant that must be explicitly printed as unsigned.
Definition: varnode.hh:116
VarnodeBank::findInput
Varnode * findInput(int4 s, const Address &loc) const
Find an input Varnode.
Definition: varnode.cc:1099
Varnode::indirectonly
@ indirectonly
If all uses of illegalinput varnode are inputs to INDIRECT.
Definition: varnode.hh:93
VarnodeBank::createDef
Varnode * createDef(int4 s, const Address &m, Datatype *ct, PcodeOp *op)
Create a Varnode as the output of a PcodeOp.
Definition: varnode.cc:1045
Varnode::dataType
Datatype * dataType
Temporary data-type associated with this for use in type propagate algorithm.
Definition: varnode.hh:140
Varnode::explict
@ explict
This varnode CANNOT be a temporary variable.
Definition: varnode.hh:80
Varnode::isExtraOut
bool isExtraOut(void) const
Is this Varnode created indirectly by a CALL operation?
Definition: varnode.hh:251
VarnodeCompareLocDef::operator()
bool operator()(const Varnode *a, const Varnode *b) const
Functional comparison operator.
Definition: varnode.cc:26
VarnodeLocSet
set< Varnode *, VarnodeCompareLocDef > VarnodeLocSet
A set of Varnodes sorted by location (then by definition)
Definition: varnode.hh:44
VarnodeBank
A container for Varnode objects from a specific function.
Definition: varnode.hh:327
Varnode::locked_input
@ locked_input
Input that exists even if its unused.
Definition: varnode.hh:118
Varnode::indirect_creation
@ indirect_creation
The value in this Varnode is created indirectly.
Definition: varnode.hh:98
Varnode::indirectstorage
@ indirectstorage
Is this Varnode storing a pointer to the actual symbol.
Definition: varnode.hh:103
Varnode::addrtied
@ addrtied
High-level variable is tied to address.
Definition: varnode.hh:90
Varnode::operator==
bool operator==(const Varnode &op2) const
Equality operator.
Definition: varnode.cc:501