decompiler  1.0.0
Classes | Typedefs | Functions
op.hh File Reference

The PcodeOp and PcodeOpBank classes. More...

#include "typeop.hh"

Classes

class  IopSpace
 Space for storing internal PcodeOp pointers as addresses. More...
 
class  PcodeOp
 Lowest level operation of the p-code language. More...
 
class  PcodeOpBank
 Container class for PcodeOps associated with a single function. More...
 

Typedefs

typedef map< SeqNum, PcodeOp * > PcodeOpTree
 A map from sequence number (SeqNum) to PcodeOp.
 

Functions

int4 functionalEqualityLevel (Varnode *vn1, Varnode *vn2, Varnode **res1, Varnode **res2)
 Try to determine if vn1 and vn2 contain the same value. More...
 
bool functionalEquality (Varnode *vn1, Varnode *vn2)
 Determine if two Varnodes hold the same value. More...
 
bool functionalDifference (Varnode *vn1, Varnode *vn2, int4 depth)
 Return true if vn1 and vn2 are verifiably different values. More...
 

Detailed Description

The PcodeOp and PcodeOpBank classes.

Function Documentation

bool functionalDifference ( Varnode vn1,
Varnode vn2,
int4  depth 
)

Return true if vn1 and vn2 are verifiably different values.

This is actually a rather speculative test

Parameters
vn1is the first Varnode to compare
vn2is the second Varnode
depthis the maximum level to recurse while testing
Returns
true if they are different

References PcodeOp::code(), Varnode::getAddr(), Varnode::getDef(), PcodeOp::getIn(), Varnode::isConstant(), Varnode::isFree(), Varnode::isInput(), Varnode::isWritten(), and PcodeOp::numInput().

Referenced by PcodeOpBank::endDead().

bool functionalEquality ( Varnode vn1,
Varnode vn2 
)

Determine if two Varnodes hold the same value.

Only return true if it can be immediately determined they are equivalent

Parameters
vn1is the first Varnode
vn2is the second Varnode
Returns
true if they are provably equal

References functionalEqualityLevel().

Referenced by RuleEquality::applyOp(), RuleRangeMeld::applyOp(), RuleMultiCollapse::applyOp(), RuleSborrow::applyOp(), PcodeOpBank::endDead(), and ActionMarkImplied::isPossibleAlias().

int4 functionalEqualityLevel ( Varnode vn1,
Varnode vn2,
Varnode **  res1,
Varnode **  res2 
)

Try to determine if vn1 and vn2 contain the same value.

Return:

  • -1, if they do not, or if it can't be immediately verified
  • 0, if they do hold the same value
  • >0, if the result is contingent on additional varnode pairs having the same value In the last case, the varnode pairs are returned as (res1[i],res2[i]), where the return value is the number of pairs.
    Parameters
    vn1is the first Varnode to compare
    vn2is the second Varnode
    res1is a reference to the first returned Varnode
    res2is a reference to the second returned Varnode
    Returns
    the result of the comparison

References PcodeOp::code(), CPUI_LOAD, CPUI_PTRADD, PcodeOp::getAddr(), Varnode::getDef(), PcodeOp::getIn(), Varnode::getOffset(), PcodeOp::isCall(), PcodeOp::isCommutative(), PcodeOp::isMarker(), and PcodeOp::numInput().

Referenced by RulePushMulti::applyOp(), cseFindInBlock(), PcodeOpBank::endDead(), ConditionalJoin::findDups(), ActionMultiCse::findMatch(), RulePushMulti::findSubstitute(), and functionalEquality().