Ghidra Decompiler Analysis Engine
op.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_OP__
19 #define __CPUI_OP__
20 
21 #include "typeop.hh"
22 
32 class IopSpace : public AddrSpace {
33 public:
34  IopSpace(AddrSpaceManager *m,const Translate *t,const string &nm,int4 ind);
35  virtual void saveXmlAttributes(ostream &s,uintb offset) const { s << " space=\"iop\""; }
36  virtual void saveXmlAttributes(ostream &s,uintb offset,int4 size) const { s << " space=\"iop\""; }
37  virtual void printRaw(ostream &s,uintb offset) const;
38  virtual void saveXml(ostream &s) const;
39  virtual void restoreXml(const Element *el);
40 };
41 
57 
58 class PcodeOp {
59  friend class BlockBasic; // Just insert_before, insert_after, setOrder
60  friend class Funcdata;
61  friend class PcodeOpBank;
62  friend class VarnodeBank; // Only uses setInput
63 public:
66  enum {
67  startbasic = 1,
68  branch = 2,
69  call = 4,
70  returns = 0x8,
71  nocollapse = 0x10,
72  dead = 0x20,
73  marker = 0x40,
74  booloutput = 0x80,
77  boolean_flip = 0x100,
78  fallthru_true = 0x200,
79  indirect_source = 0x400,
80  coderef = 0x800,
81  startmark = 0x1000,
82  mark = 0x2000,
83  commutative = 0x4000,
84  unary = 0x8000,
85  binary = 0x10000,
86  special = 0x20000,
87  ternary = 0x40000,
88  splittingbranch = 0x80000,
89  nonprinting = 0x100000,
90  halt = 0x200000,
91  badinstruction = 0x400000,
92  unimplemented = 0x800000,
93  noreturn = 0x1000000,
94  missing = 0x2000000,
95  spacebase_ptr = 0x4000000,
96  indirect_creation = 0x8000000,
97  calculated_bool = 0x10000000,
98  has_callspec = 0x20000000,
99  ptrflow = 0x40000000,
100  indirect_store = 0x80000000
101  };
102  enum {
105  modified = 4,
106  warning = 8,
109  };
110 private:
111  TypeOp *opcode;
112  mutable uint4 flags;
113  mutable uint4 addlflags;
114  SeqNum start;
115  BlockBasic *parent;
116  list<PcodeOp *>::iterator basiciter;
117  list<PcodeOp *>::iterator insertiter;
118  list<PcodeOp *>::iterator codeiter;
119  Varnode *output;
120  vector<Varnode *> inrefs;
121 
122  // Only used by Funcdata
123  void setOpcode(TypeOp *t_op);
124  void setOutput(Varnode *vn) { output = vn; }
125  void clearInput(int4 slot) { inrefs[slot] = (Varnode *)0; }
126  void setInput(Varnode *vn,int4 slot) { inrefs[slot] = vn; }
127  void setFlag(uint4 fl) { flags |= fl; }
128  void clearFlag(uint4 fl) { flags &= ~fl; }
129  void setAdditionalFlag(uint4 fl) { addlflags |= fl; }
130  void clearAdditionalFlag(uint4 fl) { addlflags &= ~fl; }
131  void flipFlag(uint4 fl) { flags ^= fl; }
132  void setNumInputs(int4 num);
133  void removeInput(int4 slot);
134  void insertInput(int4 slot);
135  void setOrder(uintm ord) { start.setOrder(ord); }
136  void setParent(BlockBasic *p) { parent = p; }
137  void setBasicIter(list<PcodeOp *>::iterator iter) { basiciter = iter; }
138 
139 public:
140  PcodeOp(int4 s,const SeqNum &sq);
141  ~PcodeOp(void) {}
142  int4 numInput(void) const { return inrefs.size(); }
143  Varnode *getOut(void) { return output; }
144  const Varnode *getOut(void) const { return (const Varnode *) output; }
145  Varnode *getIn(int4 slot) { return inrefs[slot]; }
146  const Varnode *getIn(int4 slot) const { return (const Varnode *) inrefs[slot]; }
147  const BlockBasic *getParent(void) const { return (const BlockBasic *) parent; }
148  BlockBasic *getParent(void) { return parent; }
149  const Address &getAddr(void) const { return start.getAddr(); }
150  uintm getTime(void) const { return start.getTime(); }
151  const SeqNum &getSeqNum(void) const { return start; }
152  list<PcodeOp *>::iterator getInsertIter(void) const { return insertiter; }
153  list<PcodeOp *>::iterator getBasicIter(void) const { return basiciter; }
154  int4 getSlot(const Varnode *vn) const { int4 i,n; n=inrefs.size(); for(i=0;i<n;++i) if (inrefs[i]==vn) break; return i; }
156  int4 getRepeatSlot(const Varnode *vn,int4 firstSlot,list<PcodeOp *>::const_iterator iter) const;
162  bool isDead(void) const { return ((flags&PcodeOp::dead)!=0); }
163  bool isAssignment(void) const { return (output!=(Varnode *)0); }
164  bool isCall(void) const { return ((flags&PcodeOp::call)!=0); }
165  bool isCallWithoutSpec(void) const { return ((flags&(PcodeOp::call|PcodeOp::has_callspec))==PcodeOp::call); }
167  bool isMarker(void) const { return ((flags&PcodeOp::marker)!=0); }
168  bool isIndirectCreation(void) const { return ((flags&PcodeOp::indirect_creation)!=0); }
169  bool isIndirectStore(void) const { return ((flags&PcodeOp::indirect_store)!=0); }
170  bool notPrinted(void) const { return ((flags&(PcodeOp::marker|PcodeOp::nonprinting|PcodeOp::noreturn))!=0); }
173  bool isBoolOutput(void) const { return ((flags&PcodeOp::booloutput)!=0); }
174  bool isBranch(void) const { return ((flags&PcodeOp::branch)!=0); }
175  bool isCallOrBranch(void) const { return ((flags&(PcodeOp::branch|PcodeOp::call))!=0); }
178  bool isFlowBreak(void) const { return ((flags&(PcodeOp::branch|PcodeOp::returns))!=0); }
180  bool isBooleanFlip(void) const { return ((flags&PcodeOp::boolean_flip)!=0); }
182  bool isFallthruTrue(void) const { return ((flags&PcodeOp::fallthru_true)!=0); }
183  bool isCodeRef(void) const { return ((flags&PcodeOp::coderef)!=0); }
184  bool isInstructionStart(void) const { return ((flags&PcodeOp::startmark)!=0); }
185  bool isBlockStart(void) const { return ((flags&PcodeOp::startbasic)!=0); }
186  bool isModified(void) const { return ((addlflags&PcodeOp::modified)!=0); }
187  bool isMark(void) const { return ((flags&PcodeOp::mark)!=0); }
188  void setMark(void) const { flags |= PcodeOp::mark; }
189  bool isWarning(void) const { return ((addlflags&PcodeOp::warning)!=0); }
190  void clearMark(void) const { flags &= ~PcodeOp::mark; }
191  bool isIndirectSource(void) const { return ((flags&PcodeOp::indirect_source)!=0); }
192  void setIndirectSource(void) { flags |= PcodeOp::indirect_source; }
193  void clearIndirectSource(void) { flags &= ~PcodeOp::indirect_source; }
194  bool isPtrFlow(void) const { return ((flags&PcodeOp::ptrflow)!=0); }
195  void setPtrFlow(void) { flags |= PcodeOp::ptrflow; }
196  bool isSplitting(void) const { return ((flags&PcodeOp::splittingbranch)!=0); }
197  bool doesSpecialPropagation(void) const { return ((addlflags&PcodeOp::special_prop)!=0); }
198  bool doesSpecialPrinting(void) const { return ((addlflags&PcodeOp::special_print)!=0); }
199  bool isIncidentalCopy(void) const { return ((addlflags&PcodeOp::incidental_copy)!=0); }
200  bool isCalculatedBool(void) const { return ((flags&(PcodeOp::calculated_bool|PcodeOp::booloutput))!=0); }
203  bool isCpoolTransformed(void) const { return ((addlflags&PcodeOp::is_cpool_transformed)!=0); }
204  bool isCollapsible(void) const;
205  bool usesSpacebasePtr(void) const { return ((flags&PcodeOp::spacebase_ptr)!=0); }
207  uintm getCseHash(void) const;
208  bool isCseMatch(const PcodeOp *op) const;
209  bool isMoveable(const PcodeOp *point) const;
210  TypeOp *getOpcode(void) const { return opcode; }
211  OpCode code(void) const { return opcode->getOpcode(); }
212  bool isCommutative(void) const { return ((flags & PcodeOp::commutative)!=0); }
213  uintb collapse(bool &markedInput) const;
214  void collapseConstantSymbol(Varnode *newConst) const;
215  PcodeOp *nextOp(void) const;
216  PcodeOp *previousOp(void) const;
217  PcodeOp *target(void) const;
218  uintb getNZMaskLocal(bool cliploop) const;
219  int4 compareOrder(const PcodeOp *bop) const;
220  void printRaw(ostream &s) const { opcode->printRaw(s,this); }
221  const string &getOpName(void) const { return opcode->getName(); }
222  void printDebug(ostream &s) const;
223  void saveXml(ostream &s) const;
224  static PcodeOp *getOpFromConst(const Address &addr) { return (PcodeOp *)(uintp)addr.getOffset(); }
226 
227  Datatype *outputTypeLocal(void) const { return opcode->getOutputLocal(this); }
228  Datatype *inputTypeLocal(int4 slot) const { return opcode->getInputLocal(this,slot); }
229  bool markExplicitUnsigned(int4 slot) { return opcode->markExplicitUnsigned(this,slot); }
230  bool inheritsSign(void) const { return opcode->inheritsSign(); }
231 };
232 
236 struct PcodeOpNode {
238  int4 slot;
239  PcodeOpNode(void) { op = (PcodeOp *)0; slot = 0; }
240  PcodeOpNode(PcodeOp *o,int4 s) { op = o; slot = s; }
241 };
242 
244 typedef map<SeqNum,PcodeOp *> PcodeOpTree;
245 
253 class PcodeOpBank {
254  PcodeOpTree optree;
255  list<PcodeOp *> deadlist;
256  list<PcodeOp *> alivelist;
257  list<PcodeOp *> storelist;
258  list<PcodeOp *> loadlist;
259  list<PcodeOp *> returnlist;
260  list<PcodeOp *> useroplist;
261  list<PcodeOp *> deadandgone;
262  uintm uniqid;
263  void addToCodeList(PcodeOp *op);
264  void removeFromCodeList(PcodeOp *op);
265  void clearCodeLists(void);
266 public:
267  void clear(void);
268  PcodeOpBank(void) { uniqid = 0; }
269  ~PcodeOpBank(void) { clear(); }
270  void setUniqId(uintm val) { uniqid = val; }
271  uintm getUniqId(void) const { return uniqid; }
272  PcodeOp *create(int4 inputs,const Address &pc);
273  PcodeOp *create(int4 inputs,const SeqNum &sq);
274  void destroy(PcodeOp *op);
275  void destroyDead(void);
276  void changeOpcode(PcodeOp *op,TypeOp *newopc);
277  void markAlive(PcodeOp *op);
278  void markDead(PcodeOp *op);
279  void insertAfterDead(PcodeOp *op,PcodeOp *prev);
280  void moveSequenceDead(PcodeOp *firstop,PcodeOp *lastop,PcodeOp *prev);
281  void markIncidentalCopy(PcodeOp *firstop,PcodeOp *lastop);
282  bool empty(void) const { return optree.empty(); }
283  PcodeOp *target(const Address &addr) const;
284  PcodeOp *findOp(const SeqNum &num) const;
285  PcodeOp *fallthru(const PcodeOp *op) const;
286 
288  PcodeOpTree::const_iterator beginAll(void) const { return optree.begin(); }
289 
291  PcodeOpTree::const_iterator endAll(void) const { return optree.end(); }
292 
294  PcodeOpTree::const_iterator begin(const Address &addr) const;
295 
297  PcodeOpTree::const_iterator end(const Address &addr) const;
298 
300  list<PcodeOp *>::const_iterator beginAlive(void) const { return alivelist.begin(); }
301 
303  list<PcodeOp *>::const_iterator endAlive(void) const { return alivelist.end(); }
304 
306  list<PcodeOp *>::const_iterator beginDead(void) const { return deadlist.begin(); }
307 
309  list<PcodeOp *>::const_iterator endDead(void) const { return deadlist.end(); }
310 
312  list<PcodeOp *>::const_iterator begin(OpCode opc) const;
313 
315  list<PcodeOp *>::const_iterator end(OpCode opc) const;
316 };
317 
318 extern int4 functionalEqualityLevel(Varnode *vn1,Varnode *vn2,Varnode **res1,Varnode **res2);
319 extern bool functionalEquality(Varnode *vn1,Varnode *vn2);
320 extern bool functionalDifference(Varnode *vn1,Varnode *vn2,int4 depth);
321 
322 #endif
TypeOp::inheritsSign
bool inheritsSign(void) const
Return true if the op-code inherits it signedness from its inputs.
Definition: typeop.hh:107
PcodeOpBank::markIncidentalCopy
void markIncidentalCopy(PcodeOp *firstop, PcodeOp *lastop)
Mark any COPY ops in the given range as incidental.
Definition: op.cc:928
PcodeOp::usesSpacebasePtr
bool usesSpacebasePtr(void) const
Return true if this LOADs or STOREs from a dynamic spacebase pointer.
Definition: op.hh:206
SeqNum::getTime
uintm getTime(void) const
Get the time field of a sequence number.
Definition: address.hh:129
PcodeOpBank::fallthru
PcodeOp * fallthru(const PcodeOp *op) const
Find the PcodeOp considered a fallthru of the given PcodeOp.
Definition: op.cc:967
PcodeOpBank::begin
PcodeOpTree::const_iterator begin(const Address &addr) const
Start of all PcodeOps at one Address.
Definition: op.cc:1003
AddrSpace
A region where processor data is stored.
Definition: space.hh:73
PcodeOp::compareOrder
int4 compareOrder(const PcodeOp *bop) const
Compare the control-flow order of this and bop.
Definition: op.cc:721
PcodeOp::indirect_store
@ indirect_store
CPUI_INDIRECT is caused by CPUI_STORE.
Definition: op.hh:100
VarnodeBank::setInput
Varnode * setInput(Varnode *vn)
Mark a Varnode as an input to the function.
Definition: varnode.cc:992
IopSpace
Space for storing internal PcodeOp pointers as addresses.
Definition: op.hh:32
PcodeOp::commutative
@ commutative
Order of input parameters does not matter.
Definition: op.hh:83
SeqNum
A class for uniquely labelling and comparing PcodeOps.
Definition: address.hh:111
PcodeOpBank::endDead
list< PcodeOp * >::const_iterator endDead(void) const
End of all PcodeOps marked as dead.
Definition: op.hh:309
PcodeOp::isCpoolTransformed
bool isCpoolTransformed(void) const
Return true if we have already examined this cpool.
Definition: op.hh:203
PcodeOp::special_prop
@ special_prop
Does some special form of datatype propagation.
Definition: op.hh:103
PcodeOpBank::target
PcodeOp * target(const Address &addr) const
Find the first executing PcodeOp for a target address.
Definition: op.cc:946
PcodeOpBank
Container class for PcodeOps associated with a single function.
Definition: op.hh:253
PcodeOp::dead
@ dead
This operation is dead.
Definition: op.hh:72
PcodeOpBank::moveSequenceDead
void moveSequenceDead(PcodeOp *firstop, PcodeOp *lastop, PcodeOp *prev)
Move a sequence of PcodeOps to a point in the dead list.
Definition: op.cc:913
PcodeOp::isCallWithoutSpec
bool isCallWithoutSpec(void) const
Return true if this op acts as call but does not have a full specification.
Definition: op.hh:166
PcodeOp::isBoolOutput
bool isBoolOutput(void) const
Return true if this op produces a boolean output.
Definition: op.hh:173
functionalEqualityLevel
int4 functionalEqualityLevel(Varnode *vn1, Varnode *vn2, Varnode **res1, Varnode **res2)
Try to determine if vn1 and vn2 contain the same value.
Definition: op.cc:1101
PcodeOpBank::endAll
PcodeOpTree::const_iterator endAll(void) const
End of all PcodeOps in sequence number order.
Definition: op.hh:291
PcodeOp::ternary
@ ternary
Evaluate as ternary operator (or higher)
Definition: op.hh:87
PcodeOp::getHaltType
uint4 getHaltType(void) const
Get type which indicates unusual halt in control-flow.
Definition: op.hh:160
PcodeOp::returns
@ returns
This instruction returns to caller.
Definition: op.hh:70
PcodeOpBank::beginDead
list< PcodeOp * >::const_iterator beginDead(void) const
Start of all PcodeOps marked as dead.
Definition: op.hh:306
PcodeOp::special
@ special
Cannot be evaluated (without special processing)
Definition: op.hh:86
functionalDifference
bool functionalDifference(Varnode *vn1, Varnode *vn2, int4 depth)
Return true if vn1 and vn2 are verifiably different values.
Definition: op.cc:1200
typeop.hh
Data-type and behavior information associated with specific p-code op-codes.
PcodeOpBank::markDead
void markDead(PcodeOp *op)
Mark the given PcodeOp as dead.
Definition: op.cc:885
PcodeOp::PcodeOp
PcodeOp(int4 s, const SeqNum &sq)
Construct an unattached PcodeOp.
Definition: op.cc:71
PcodeOp::getRepeatSlot
int4 getRepeatSlot(const Varnode *vn, int4 firstSlot, list< PcodeOp * >::const_iterator iter) const
Find the slot for a given Varnode, which may be take up multiple input slots.
Definition: op.cc:93
PcodeOp::booloutput
@ booloutput
Boolean operation.
Definition: op.hh:76
Address::getOffset
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
IopSpace::saveXml
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: op.cc:55
PcodeOp::has_callspec
@ has_callspec
Op has a call specification associated with it.
Definition: op.hh:98
PcodeOp::binary
@ binary
Evaluate as binary expression.
Definition: op.hh:85
PcodeOp::getCseHash
uintm getCseHash(void) const
Return hash indicating possibility of common subexpression elimination.
Definition: op.cc:131
PcodeOp::nonprinting
@ nonprinting
Op should not be directly printed as source.
Definition: op.hh:89
functionalEquality
bool functionalEquality(Varnode *vn1, Varnode *vn2)
Determine if two Varnodes hold the same value.
Definition: op.cc:1185
Element
An XML element. A node in the DOM tree.
Definition: xml.hh:150
BlockBasic
A basic block for p-code operations.
Definition: block.hh:365
PcodeOp::modified
@ modified
This op has been modified by the current action.
Definition: op.hh:105
PcodeOp::isCallOrBranch
bool isCallOrBranch(void) const
Return true if this op is a call or branch.
Definition: op.hh:176
PcodeOp::noreturn
@ noreturn
placeholder for previous call that doesn't exit
Definition: op.hh:93
PcodeOp
Lowest level operation of the p-code language.
Definition: op.hh:58
PcodeOpBank::endAlive
list< PcodeOp * >::const_iterator endAlive(void) const
End of all PcodeOps marked as alive.
Definition: op.hh:303
PcodeOp::badinstruction
@ badinstruction
placeholder for bad instruction data
Definition: op.hh:91
PcodeOp::isCalculatedBool
bool isCalculatedBool(void) const
Return true if output is 1-bit boolean.
Definition: op.hh:201
PcodeOpBank::destroy
void destroy(PcodeOp *op)
Destroy/retire the given PcodeOp.
Definition: op.cc:846
PcodeOp::isFallthruTrue
bool isFallthruTrue(void) const
Return true if the fall-thru branch is taken when the boolean input is true.
Definition: op.hh:182
PcodeOp::call
@ call
This instruction calls a subroutine.
Definition: op.hh:69
PcodeOp::previousOp
PcodeOp * previousOp(void) const
Return the previous op within this op's basic block or null.
Definition: op.cc:344
PcodeOp::collapse
uintb collapse(bool &markedInput) const
Calculate the constant output produced by this op.
Definition: op.cc:437
PcodeOp::getEvalType
uint4 getEvalType(void) const
Get the evaluation type of this op.
Definition: op.hh:158
TypeOp::getInputLocal
virtual Datatype * getInputLocal(const PcodeOp *op, int4 slot) const
Find the minimal (or suggested) data-type of an input to this op-code.
Definition: typeop.cc:188
Varnode
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
PcodeOpNode::op
PcodeOp * op
The p-code end-point of the edge.
Definition: op.hh:237
PcodeOp::mark
@ mark
Used by many algorithms that need to detect loops or avoid repeats.
Definition: op.hh:82
PcodeOp::isCollapsible
bool isCollapsible(void) const
Definition: op.cc:115
PcodeOp::ptrflow
@ ptrflow
Op consumes or produces a ptr.
Definition: op.hh:99
PcodeOp::unary
@ unary
Evaluate as unary expression.
Definition: op.hh:84
SeqNum::getAddr
const Address & getAddr(void) const
Get the address portion of a sequence number.
Definition: address.hh:126
PcodeOpBank::destroyDead
void destroyDead(void)
Destroy/retire all PcodeOps in the dead list.
Definition: op.cc:828
PcodeOpBank::end
PcodeOpTree::const_iterator end(const Address &addr) const
End of all PcodeOps at one Address.
Definition: op.cc:1009
IopSpace::restoreXml
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: op.cc:61
PcodeOp::indirect_creation
@ indirect_creation
Output varnode is created by indirect effect.
Definition: op.hh:96
IopSpace::printRaw
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: op.cc:35
IopSpace::saveXmlAttributes
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Save an address as XML.
Definition: op.hh:35
PcodeOp::fallthru_true
@ fallthru_true
Set if fallthru happens on true condition.
Definition: op.hh:78
PcodeOp::getSlot
int4 getSlot(const Varnode *vn) const
Get the slot number of the indicated input varnode.
Definition: op.hh:155
PcodeOpBank::insertAfterDead
void insertAfterDead(PcodeOp *op, PcodeOp *prev)
Insert the given PcodeOp after a point in the dead list.
Definition: op.cc:896
Address
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
PcodeOpBank::changeOpcode
void changeOpcode(PcodeOp *op, TypeOp *newopc)
Change the op-code for the given PcodeOp.
Definition: op.cc:862
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
PcodeOpBank::findOp
PcodeOp * findOp(const SeqNum &num) const
Find a PcodeOp by sequence number.
Definition: op.cc:956
PcodeOp::nextOp
PcodeOp * nextOp(void) const
Return the next op in the control-flow from this or null.
Definition: op.cc:323
PcodeOp::missing
@ missing
ops at this address were not generated
Definition: op.hh:94
PcodeOp::incidental_copy
@ incidental_copy
Treat this as incidental for parameter recovery algorithms.
Definition: op.hh:107
PcodeOp::calculated_bool
@ calculated_bool
Output has been determined to be a 1-bit boolean value.
Definition: op.hh:97
Translate
The interface to a translation engine for a processor.
Definition: translate.hh:294
PcodeOp::getOpFromConst
static PcodeOp * getOpFromConst(const Address &addr)
Retrieve the PcodeOp encoded as the address addr.
Definition: op.hh:225
PcodeOpTree
map< SeqNum, PcodeOp * > PcodeOpTree
A map from sequence number (SeqNum) to PcodeOp.
Definition: op.hh:244
OpCode
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
PcodeOp::isCseMatch
bool isCseMatch(const PcodeOp *op) const
Return true if this and op represent common subexpressions.
Definition: op.cc:154
TypeOp::getOutputLocal
virtual Datatype * getOutputLocal(const PcodeOp *op) const
Find the minimal (or suggested) data-type of an output to this op-code.
Definition: typeop.cc:178
PcodeOpBank::markAlive
void markAlive(PcodeOp *op)
Mark the given PcodeOp as alive.
Definition: op.cc:874
PcodeOp::startmark
@ startmark
This op is the first in its instruction.
Definition: op.hh:81
PcodeOp::notPrinted
bool notPrinted(void) const
Return true if this op is not directly represented in C output.
Definition: op.hh:171
PcodeOpBank::beginAlive
list< PcodeOp * >::const_iterator beginAlive(void) const
Start of all PcodeOps marked as alive.
Definition: op.hh:300
PcodeOp::spacebase_ptr
@ spacebase_ptr
Loads or stores from a dynamic pointer into a spacebase.
Definition: op.hh:95
PcodeOp::isFlowBreak
bool isFlowBreak(void) const
Return true if this op breaks fall-thru flow.
Definition: op.hh:178
PcodeOp::marker
@ marker
Definition: op.hh:73
PcodeOp::halt
@ halt
instruction causes processor or process to halt
Definition: op.hh:90
PcodeOp::unimplemented
@ unimplemented
placeholder for unimplemented instruction
Definition: op.hh:92
PcodeOp::saveXml
void saveXml(ostream &s) const
Definition: op.cc:389
PcodeOp::is_cpool_transformed
@ is_cpool_transformed
Have we checked for cpool transforms.
Definition: op.hh:108
TypeOp
Associate data-type and behavior information with a specific p-code op-code.
Definition: typeop.hh:37
PcodeOp::boolean_flip
@ boolean_flip
Set if condition must be false to take branch.
Definition: op.hh:77
PcodeOp::getNZMaskLocal
uintb getNZMaskLocal(bool cliploop) const
Calculate known zero bits for output to this op.
Definition: op.cc:508
PcodeOp::isBooleanFlip
bool isBooleanFlip(void) const
Return true if this op flips the true/false meaning of its control-flow branching.
Definition: op.hh:180
PcodeOp::collapseConstantSymbol
void collapseConstantSymbol(Varnode *newConst) const
Propagate constant symbol from inputs to given output.
Definition: op.cc:464
PcodeOpBank::create
PcodeOp * create(int4 inputs, const Address &pc)
Create a PcodeOp with at a given Address.
Definition: op.cc:798
PcodeOpNode::slot
int4 slot
Slot indicating the input Varnode end-point of the edge.
Definition: op.hh:238
PcodeOp::warning
@ warning
Warning has been generated for this op.
Definition: op.hh:106
TypeOp::printRaw
virtual void printRaw(ostream &s, const PcodeOp *op)=0
Print (for debugging purposes) this specific PcodeOp to the stream.
PcodeOp::branch
@ branch
This instruction is a branch.
Definition: op.hh:68
PcodeOp::isMoveable
bool isMoveable(const PcodeOp *point) const
Can this be moved to after point, without disturbing data-flow.
Definition: op.cc:179
PcodeOp::coderef
@ coderef
The first parameter to this op is a coderef.
Definition: op.hh:80
PcodeOp::indirect_source
@ indirect_source
Op is source of (one or more) CPUI_INDIRECTs.
Definition: op.hh:79
PcodeOpNode
An edge in a data-flow path or graph.
Definition: op.hh:236
SeqNum::setOrder
void setOrder(uintm ord)
Set the order field of a sequence number.
Definition: address.hh:135
IopSpace::IopSpace
IopSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Definition: op.cc:27
IopSpace::saveXmlAttributes
virtual void saveXmlAttributes(ostream &s, uintb offset, int4 size) const
Save an address and size as XML.
Definition: op.hh:36
AddrSpaceManager
A manager for different address spaces.
Definition: translate.hh:218
PcodeOp::target
PcodeOp * target(void) const
Return starting op for instruction associated with this op.
Definition: op.cc:360
PcodeOpBank::beginAll
PcodeOpTree::const_iterator beginAll(void) const
Start of all PcodeOps in sequence number order.
Definition: op.hh:288
PcodeOpBank::clear
void clear(void)
Clear all PcodeOps from this container.
Definition: op.cc:1051
PcodeOp::startbasic
@ startbasic
This instruction starts a basic block.
Definition: op.hh:67
PcodeOp::splittingbranch
@ splittingbranch
Dead edge cannot be removed as it splits.
Definition: op.hh:88
PcodeOp::special_print
@ special_print
Op is marked for special printing.
Definition: op.hh:104
TypeOp::markExplicitUnsigned
bool markExplicitUnsigned(PcodeOp *op, int4 slot) const
Check if a constant input should be explicitly labeled as unsigned.
Definition: typeop.cc:230
PcodeOp::nocollapse
@ nocollapse
This op cannot be collapsed further.
Definition: op.hh:71
VarnodeBank
A container for Varnode objects from a specific function.
Definition: varnode.hh:327
PcodeOp::printDebug
void printDebug(ostream &s) const
Print debug description of this op to stream.
Definition: op.cc:376