decompiler  1.0.0
Public Member Functions | Public Attributes | List of all members
RuleOrPredicate::MultiPredicate Struct Reference

A helper class to mark up predicated INT_OR expressions. More...

Public Member Functions

bool discoverZeroSlot (Varnode *vn)
 Check if vn is produced by a 2-branch MULTIEQUAL, one side of which is a zero constant. More...
 
bool discoverCbranch (void)
 Find CBRANCH operation that determines whether zero is set or not. More...
 
void discoverPathIsTrue (void)
 Does the condBlock true outgoing edge flow to the block that sets zero. More...
 
bool discoverConditionalZero (Varnode *vn)
 Verify that CBRANCH boolean expression is either (vn == 0) or (vn != 0) More...
 

Public Attributes

PcodeOpop
 Base MULTIEQUAL op.
 
int4 zeroSlot
 Input slot containing path that sets zero.
 
const FlowBlockzeroBlock
 Final block in path that sets zero.
 
const FlowBlockcondBlock
 Conditional block determining if zero is set or not.
 
PcodeOpcbranch
 CBRANCH determining if zero is set.
 
VarnodeotherVn
 Other (non-zero) Varnode getting set on other path.
 
bool zeroPathIsTrue
 True if path to zero set is the true path out of condBlock.
 

Detailed Description

A helper class to mark up predicated INT_OR expressions.

Member Function Documentation

bool RuleOrPredicate::MultiPredicate::discoverCbranch ( void  )

Find CBRANCH operation that determines whether zero is set or not.

Assuming that op is a 2-branch MULTIEQUAL as per discoverZeroSlot(), try to find a single CBRANCH whose two out edges correspond to the in edges of the MULTIEQUAL. In this case, the boolean expression controlling the CBRANCH is also controlling whether zero flows into the MULTIEQUAL output Varnode.

Returns
true if a single controlling CBRANCH is found

References CPUI_CBRANCH, FlowBlock::getIn(), FlowBlock::getParent(), FlowBlock::lastOp(), FlowBlock::sizeIn(), and FlowBlock::sizeOut().

Referenced by RuleOrPredicate::applyOp(), and RuleOrPredicate::checkSingle().

bool RuleOrPredicate::MultiPredicate::discoverConditionalZero ( Varnode vn)

Verify that CBRANCH boolean expression is either (vn == 0) or (vn != 0)

Modify zeroPathIsTrue so that if it is true, then: A vn value equal to zero, causes execution to flow to where the output of MULTIEQUAL is set to zero.

Parameters
vnis the given Varnode
Returns
true if the boolean expression has a matching form

References ConditionMarker::boolvn, PcodeOp::code(), CPUI_INT_EQUAL, CPUI_INT_NOTEQUAL, Varnode::getDef(), PcodeOp::getIn(), Varnode::getOffset(), Varnode::isConstant(), and Varnode::isWritten().

Referenced by RuleOrPredicate::checkSingle().

void RuleOrPredicate::MultiPredicate::discoverPathIsTrue ( void  )

Does the condBlock true outgoing edge flow to the block that sets zero.

The zeroPathIsTrue variable is set based on the current configuration

Referenced by RuleOrPredicate::applyOp(), and RuleOrPredicate::checkSingle().

bool RuleOrPredicate::MultiPredicate::discoverZeroSlot ( Varnode vn)

Check if vn is produced by a 2-branch MULTIEQUAL, one side of which is a zero constant.

Parameters
vnis the given Varnode
Returns
true if the expression producing vn matches the form

References PcodeOp::code(), CPUI_COPY, CPUI_MULTIEQUAL, Varnode::getDef(), PcodeOp::getIn(), Varnode::getOffset(), Varnode::isConstant(), and Varnode::isWritten().

Referenced by RuleOrPredicate::applyOp().


The documentation for this struct was generated from the following files: