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;
78 fallthru_true = 0x200,
79 indirect_source = 0x400,
87 floatingpoint = 0x40000,
88 splittingbranch = 0x80000,
89 nonprinting = 0x100000,
91 badinstruction = 0x400000,
92 unimplemented = 0x800000,
95 spacebase_ptr = 0x4000000,
96 indirect_creation = 0x8000000,
97 calculated_bool = 0x10000000,
98 is_cpool_transformed = 0x20000000,
100 indirect_store = 0x80000000
104 is_constructor = 0x2,
107 special_print = 0x10,
110 incidental_copy = 0x80
115 mutable uint4 addlflags;
118 list<PcodeOp *>::iterator basiciter;
119 list<PcodeOp *>::iterator insertiter;
120 list<PcodeOp *>::iterator codeiter;
122 vector<Varnode *> inrefs;
125 void setOpcode(
TypeOp *t_op);
126 void setOutput(
Varnode *vn) { output = vn; }
127 void clearInput(int4 slot) { inrefs[slot] = (
Varnode *)0; }
129 void setFlag(uint4 fl) { flags |= fl; }
130 void clearFlag(uint4 fl) { flags &= ~fl; }
131 void setAdditionalFlag(uint4 fl) { addlflags |= fl; }
132 void clearAdditionalFlag(uint4 fl) { addlflags &= ~fl; }
133 void flipFlag(uint4 fl) { flags ^= fl; }
134 void setNumInputs(int4 num);
135 void removeInput(int4 slot);
136 void insertInput(int4 slot);
137 void setOrder(uintm ord) { start.
setOrder(ord); }
139 void setBasicIter(list<PcodeOp *>::iterator iter) { basiciter = iter; }
144 int4
numInput(
void)
const {
return inrefs.size(); }
155 list<PcodeOp *>::iterator
getBasicIter(
void)
const {
return basiciter; }
156 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; }
158 int4 getRepeatSlot(
const Varnode *vn,int4 firstSlot,list<PcodeOp *>::const_iterator iter)
const;
207 bool isCollapsible(
void)
const;
210 uintm getCseHash(
void)
const;
211 bool isCseMatch(
const PcodeOp *op)
const;
215 uintb collapse(
bool &markedInput)
const;
216 void collapseConstantSymbol(
Varnode *newConst)
const;
218 PcodeOp *previousOp(
void)
const;
220 uintb getNZMaskLocal(
bool cliploop)
const;
221 int4 compareOrder(
const PcodeOp *bop)
const;
224 void printDebug(ostream &s)
const;
225 void saveXml(ostream &s)
const;
247 list<PcodeOp *> deadlist;
248 list<PcodeOp *> alivelist;
249 list<PcodeOp *> storelist;
250 list<PcodeOp *> returnlist;
251 list<PcodeOp *> useroplist;
252 list<PcodeOp *> deadandgone;
254 void addToCodeList(
PcodeOp *op);
255 void removeFromCodeList(
PcodeOp *op);
256 void clearCodeLists(
void);
266 void destroyDead(
void);
273 bool empty(
void)
const {
return optree.empty(); }
279 PcodeOpTree::const_iterator
beginAll(
void)
const {
return optree.begin(); }
282 PcodeOpTree::const_iterator
endAll(
void)
const {
return optree.end(); }
285 PcodeOpTree::const_iterator begin(
const Address &addr)
const;
288 PcodeOpTree::const_iterator end(
const Address &addr)
const;
291 list<PcodeOp *>::const_iterator
beginAlive(
void)
const {
return alivelist.begin(); }
294 list<PcodeOp *>::const_iterator
endAlive(
void)
const {
return alivelist.end(); }
297 list<PcodeOp *>::const_iterator
beginDead(
void)
const {
return deadlist.begin(); }
300 list<PcodeOp *>::const_iterator
endDead(
void)
const {
return deadlist.end(); }
303 list<PcodeOp *>::const_iterator begin(
OpCode opc)
const;
306 list<PcodeOp *>::const_iterator end(
OpCode opc)
const;
bool markExplicitUnsigned(int4 slot)
Decide on unsignedness printing.
Definition: op.hh:231
A region where processor data is stored.
Definition: space.hh:73
Set if fallthru happens on true condition.
Definition: op.hh:78
BlockBasic * getParent(void)
Get the parent basic block.
Definition: op.hh:150
Associate data-type and behavior information with a specific p-code op-code.
Definition: typeop.hh:37
bool empty(void) const
Return true if there are no PcodeOps in this container.
Definition: op.hh:273
This operation is dead.
Definition: op.hh:72
const Address & getAddr(void) const
Get the address portion of a sequence number.
Definition: address.hh:126
Dead edge cannot be removed as it splits.
Definition: op.hh:88
placeholder for unimplemented instruction
Definition: op.hh:92
uintm getUniqId(void) const
Get the next unique id.
Definition: op.hh:262
bool isDead(void) const
Return true if this op is dead.
Definition: op.hh:164
The base datatype class for the decompiler.
Definition: type.hh:62
Op is marked for special printing.
Definition: op.hh:107
OpCode code(void) const
Get the opcode id (enum) for this op.
Definition: op.hh:213
OpCode
The op-code defining a specific p-code operation (PcodeOp)
Definition: opcodes.hh:35
A manager for different address spaces.
Definition: translate.hh:218
list< PcodeOp * >::iterator getBasicIter(void) const
Definition: op.hh:155
const Address & getAddr(void) const
Get the instruction address associated with this op.
Definition: op.hh:151
This instruction calls a subroutine.
Definition: op.hh:69
uint4 getHaltType(void) const
Get type which indicates unusual halt in control-flow.
Definition: op.hh:162
Container for data structures associated with a single function.
Definition: funcdata.hh:45
This op is the first in its instruction.
Definition: op.hh:81
PcodeOpTree::const_iterator endAll(void) const
End of all PcodeOps in sequence number order.
Definition: op.hh:282
Cannot be evaluated (without special processing)
Definition: op.hh:86
Boolean operation.
Definition: op.hh:76
list< PcodeOp * >::iterator getInsertIter(void) const
Get position within alive/dead list.
Definition: op.hh:154
bool isIndirectSource(void) const
Return true if this causes an INDIRECT.
Definition: op.hh:191
Output varnode is created by indirect effect.
Definition: op.hh:96
Varnode * getIn(int4 slot)
Get a specific input Varnode to this op.
Definition: op.hh:147
Varnode * setInput(Varnode *vn)
Mark a Varnode as an input to the function.
Definition: varnode.cc:982
The first parameter to this op is a coderef.
Definition: op.hh:80
list< PcodeOp * >::const_iterator endDead(void) const
End of all PcodeOps marked as dead.
Definition: op.hh:300
list< PcodeOp * >::const_iterator beginDead(void) const
Start of all PcodeOps marked as dead.
Definition: op.hh:297
bool isBoolOutput(void) const
Return true if this op produces a boolean output.
Definition: op.hh:173
void setPtrFlow(void)
Mark this op as consuming/producing ptrs.
Definition: op.hh:195
bool isSplitting(void) const
Return true if this branch splits.
Definition: op.hh:196
Warning has been generated for this op.
Definition: op.hh:109
uint4 getEvalType(void) const
Get the evaluation type of this op.
Definition: op.hh:160
bool isFallthruTrue(void) const
Return true if the fall-thru branch is taken when the boolean input is true.
Definition: op.hh:182
bool doesSpecialPrinting(void) const
Return true if this needs to special printing.
Definition: op.hh:198
Used by many algorithms that need to detect loops or avoid repeats.
Definition: op.hh:82
Op is call to a destructor.
Definition: op.hh:105
bool isMark(void) const
Return true if this op has been marked.
Definition: op.hh:187
Datatype * outputTypeLocal(void) const
Calculate the local output type.
Definition: op.hh:229
bool isIndirectStore(void) const
Definition: op.hh:169
uintm getTime(void) const
Get the time index indicating when this op was created.
Definition: op.hh:152
Output has been determined to be a 1-bit boolean value.
Definition: op.hh:97
bool isCommutative(void) const
Return true if inputs commute.
Definition: op.hh:214
Treat this as incidental for parameter recovery algorithms.
Definition: op.hh:110
int4 numInput(void) const
Get the number of inputs to this op.
Definition: op.hh:144
const SeqNum & getSeqNum(void) const
Get the sequence number associated with this op.
Definition: op.hh:153
virtual void restoreXml(const Element *el)
Recover the details of this space from XML.
Definition: op.cc:61
bool isModified(void) const
Return true if this is modified by the current action.
Definition: op.hh:186
virtual void printRaw(ostream &s, uintb offset) const
Write an address in this space to a stream.
Definition: op.cc:35
virtual void saveXmlAttributes(ostream &s, uintb offset) const
Save an address as XML.
Definition: op.hh:35
Varnode * getOut(void)
Get the output Varnode of this op or null.
Definition: op.hh:145
list< PcodeOp * >::const_iterator endAlive(void) const
End of all PcodeOps marked as alive.
Definition: op.hh:294
virtual void saveXml(ostream &s) const
Write the details of this space as XML.
Definition: op.cc:55
Lowest level operation of the p-code language.
Definition: op.hh:58
bool isIndirectCreation(void) const
Return true if op creates a varnode indirectly.
Definition: op.hh:168
bool isWarning(void) const
Return true if a warning has been generated for this op.
Definition: op.hh:189
Order of input parameters does not matter.
Definition: op.hh:83
A low-level machine address for labelling bytes and data.
Definition: address.hh:46
const string & getName(void) const
Get the display name of the op-code.
Definition: typeop.hh:56
bool isCodeRef(void) const
Return true if the first input is a code reference.
Definition: op.hh:183
Set if condition must be false to take branch.
Definition: op.hh:77
Container class for PcodeOps associated with a single function.
Definition: op.hh:245
The interface to a translation engine for a processor.
Definition: translate.hh:293
bool inheritsSign(void) const
Does this token inherit its sign from operands.
Definition: op.hh:232
First parameter ( getIn(1) ) is a this pointer.
Definition: op.hh:103
Op consumes or produces a ptr.
Definition: op.hh:99
Op should not be directly printed as source.
Definition: op.hh:89
ops at this address were not generated
Definition: op.hh:94
placeholder for bad instruction data
Definition: op.hh:91
bool isMarker(void) const
Return true is a special SSA form op.
Definition: op.hh:167
bool isDestructor(void) const
Return true if this is call to a destructor.
Definition: op.hh:201
const BlockBasic * getParent(void) const
Get the parent basic block.
Definition: op.hh:149
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
map< SeqNum, PcodeOp * > PcodeOpTree
A map from sequence number (SeqNum) to PcodeOp.
Definition: op.hh:236
A low-level variable or contiguous set of bytes described by an Address and a size.
Definition: varnode.hh:65
A basic block for p-code operations.
Definition: block.hh:363
~PcodeOpBank(void)
Destructor.
Definition: op.hh:260
Evaluate as binary expression.
Definition: op.hh:85
An XML element. A node in the DOM tree.
Definition: xml.hh:150
PcodeOpBank(void)
Constructor.
Definition: op.hh:259
bool isIncidentalCopy(void) const
Definition: op.hh:202
uintb getOffset(void) const
Get the address offset.
Definition: address.hh:300
bool isCpoolTransformed(void) const
Return true if we have already examined this cpool.
Definition: op.hh:206
virtual void printRaw(ostream &s, const PcodeOp *op)=0
Print (for debugging purposes) this specific PcodeOp to the stream.
void clearIndirectSource(void)
Clear INDIRECT source flag.
Definition: op.hh:193
instruction causes processor or process to halt
Definition: op.hh:90
Data-type and behavior information associated with specific p-code op-codes.
bool isFlowBreak(void) const
Return true if this op breaks fall-thru flow.
Definition: op.hh:178
~PcodeOp(void)
Destructor.
Definition: op.hh:143
bool isBranch(void) const
Definition: op.hh:174
bool hasThisPointer(void) const
Return true if this is a call taking 'this' parameter.
Definition: op.hh:199
const Varnode * getOut(void) const
Get the output Varnode of this op or null.
Definition: op.hh:146
void setOrder(uintm ord)
Set the order field of a sequence number.
Definition: address.hh:135
Evaluate as unary expression.
Definition: op.hh:84
CPUI_INDIRECT is caused by CPUI_STORE.
Definition: op.hh:100
void setUniqId(uintm val)
Set the unique id counter.
Definition: op.hh:261
void clearMark(void) const
Clear any mark on this op.
Definition: op.hh:190
bool isBlockStart(void) const
Return true if this starts a basic block.
Definition: op.hh:185
Space for storing internal PcodeOp pointers as addresses.
Definition: op.hh:32
bool markExplicitUnsigned(PcodeOp *op, int4 slot) const
Check if a constant input should be explicitly labeled as unsigned.
Definition: typeop.cc:230
bool inheritsSign(void) const
Return true if the op-code inherits it signedness from its inputs.
Definition: typeop.hh:107
Have we checked for cpool transforms.
Definition: op.hh:98
This instruction starts a basic block.
Definition: op.hh:67
Datatype * inputTypeLocal(int4 slot) const
Calculate the local input type.
Definition: op.hh:230
virtual void saveXmlAttributes(ostream &s, uintb offset, int4 size) const
Save an address and size as XML.
Definition: op.hh:36
TypeOp * getOpcode(void) const
Get the opcode for this op.
Definition: op.hh:212
This op has been modified by the current action.
Definition: op.hh:108
This instruction returns to caller.
Definition: op.hh:70
bool isInstructionStart(void) const
Return true if this starts an instruction.
Definition: op.hh:184
OpCode getOpcode(void) const
Get the op-code value.
Definition: typeop.hh:57
bool isBooleanFlip(void) const
Return true if this op flips the true/false meaning of its control-flow branching.
Definition: op.hh:180
bool isAssignment(void) const
Return true is this op has an output.
Definition: op.hh:165
bool isConstructor(void) const
Return true if this is call to a constructor.
Definition: op.hh:200
bool functionalDifference(Varnode *vn1, Varnode *vn2, int4 depth)
Return true if vn1 and vn2 are verifiably different values.
Definition: op.cc:1074
Op is source of (one or more) CPUI_INDIRECTs.
Definition: op.hh:79
int4 functionalEqualityLevel(Varnode *vn1, Varnode *vn2, Varnode **res1, Varnode **res2)
Try to determine if vn1 and vn2 contain the same value.
Definition: op.cc:975
bool isPtrFlow(void) const
Return true if this produces/consumes ptrs.
Definition: op.hh:194
uintm getTime(void) const
Get the time field of a sequence number.
Definition: address.hh:129
This instruction is a branch.
Definition: op.hh:68
A container for Varnode objects from a specific function.
Definition: varnode.hh:325
bool doesSpecialPropagation(void) const
Return true if this does datatype propagation.
Definition: op.hh:197
placeholder for previous call that doesn't exit
Definition: op.hh:93
bool isCall(void) const
Return true if this op indicates call semantics.
Definition: op.hh:166
Op is call to a constructor.
Definition: op.hh:104
void setMark(void) const
Set the mark on this op.
Definition: op.hh:188
list< PcodeOp * >::const_iterator beginAlive(void) const
Start of all PcodeOps marked as alive.
Definition: op.hh:291
const string & getOpName(void) const
Return the name of this op.
Definition: op.hh:223
const Varnode * getIn(int4 slot) const
Get a specific input Varnode to this op.
Definition: op.hh:148
bool functionalEquality(Varnode *vn1, Varnode *vn2)
Determine if two Varnodes hold the same value.
Definition: op.cc:1059
PcodeOpTree::const_iterator beginAll(void) const
Start of all PcodeOps in sequence number order.
Definition: op.hh:279
Does some special form of datatype propagation.
Definition: op.hh:106
Loads or stores from a dynamic pointer into a spacebase.
Definition: op.hh:95
void setIndirectSource(void)
Mark this op as source of INDIRECT.
Definition: op.hh:192
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
IopSpace(AddrSpaceManager *m, const Translate *t, const string &nm, int4 ind)
Definition: op.cc:27
A class for uniquely labelling and comparing PcodeOps.
Definition: address.hh:111
void printRaw(ostream &s) const
Print raw info about this op to stream.
Definition: op.hh:222