decompiler
1.0.0
|
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 | |
PcodeOp * | op |
Base MULTIEQUAL op. | |
int4 | zeroSlot |
Input slot containing path that sets zero. | |
const FlowBlock * | zeroBlock |
Final block in path that sets zero. | |
const FlowBlock * | condBlock |
Conditional block determining if zero is set or not. | |
PcodeOp * | cbranch |
CBRANCH determining if zero is set. | |
Varnode * | otherVn |
Other (non-zero) Varnode getting set on other path. | |
bool | zeroPathIsTrue |
True if path to zero set is the true path out of condBlock. | |
A helper class to mark up predicated INT_OR expressions.
bool ghidra::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.
References ghidra::CPUI_CBRANCH, ghidra::FlowBlock::getIn(), ghidra::FlowBlock::getParent(), ghidra::FlowBlock::lastOp(), ghidra::FlowBlock::sizeIn(), and ghidra::FlowBlock::sizeOut().
Referenced by ghidra::RuleOrPredicate::applyOp(), and ghidra::RuleOrPredicate::checkSingle().
bool ghidra::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.
vn | is the given Varnode |
References ghidra::ConditionMarker::boolvn, ghidra::PcodeOp::code(), ghidra::CPUI_INT_EQUAL, ghidra::CPUI_INT_NOTEQUAL, ghidra::Varnode::getDef(), ghidra::PcodeOp::getIn(), ghidra::Varnode::getOffset(), ghidra::Varnode::isConstant(), and ghidra::Varnode::isWritten().
Referenced by ghidra::RuleOrPredicate::checkSingle().
void ghidra::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 ghidra::RuleOrPredicate::applyOp(), and ghidra::RuleOrPredicate::checkSingle().
bool ghidra::RuleOrPredicate::MultiPredicate::discoverZeroSlot | ( | Varnode * | vn | ) |
Check if vn is produced by a 2-branch MULTIEQUAL, one side of which is a zero constant.
vn | is the given Varnode |
References ghidra::PcodeOp::code(), ghidra::CPUI_COPY, ghidra::CPUI_MULTIEQUAL, ghidra::Varnode::getDef(), ghidra::PcodeOp::getIn(), ghidra::Varnode::getOffset(), ghidra::Varnode::isConstant(), and ghidra::Varnode::isWritten().
Referenced by ghidra::RuleOrPredicate::applyOp().