mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-09-20 09:31:47 +00:00
refactor isSplittable to BlockBasic
This commit is contained in:
parent
2f6112941f
commit
78b34d9b12
|
@ -2546,6 +2546,34 @@ bool BlockBasic::isDoNothing(void) const
|
|||
return hasOnlyMarkers();
|
||||
}
|
||||
|
||||
/// Determine if there is any other substantive operation
|
||||
/// going on in the block. If there is, the block is deemed
|
||||
/// too complicated to split.
|
||||
/// \param b is the given BasicBlock
|
||||
/// \return \b true if the block can be split
|
||||
bool BlockBasic::isSplittable(void) const
|
||||
|
||||
{
|
||||
list<PcodeOp *>::const_iterator iter;
|
||||
PcodeOp *op;
|
||||
|
||||
for(iter=beginOp();iter!=endOp();++iter) {
|
||||
op = *iter;
|
||||
OpCode opc = op->code();
|
||||
if (opc == CPUI_MULTIEQUAL) continue;
|
||||
if ((opc == CPUI_COPY)||(opc == CPUI_RETURN)) {
|
||||
for(int4 i=0;i<op->numInput();++i) {
|
||||
if (op->getIn(i)->isConstant()) continue;
|
||||
if (op->getIn(i)->isAnnotation()) continue;
|
||||
if (op->getIn(i)->isFree()) return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// In terms of machine instructions, a basic block always covers a range of addresses,
|
||||
/// from its first instruction to its last. This method establishes that range.
|
||||
/// \param beg is the address of the first instruction in the block
|
||||
|
|
|
@ -484,6 +484,7 @@ public:
|
|||
bool unblockedMulti(int4 outslot) const; ///< Check if \b this block can be removed without introducing inconsistencies
|
||||
bool hasOnlyMarkers(void) const; ///< Does \b this block contain only MULTIEQUAL and INDIRECT ops
|
||||
bool isDoNothing(void) const; ///< Should \b this block should be removed
|
||||
bool isSplittable(void) const; ///< Does \b this block contain complex ops so it cannot be split
|
||||
list<PcodeOp *>::iterator beginOp(void) { return op.begin(); } ///< Return an iterator to the beginning of the PcodeOps
|
||||
list<PcodeOp *>::iterator endOp(void) { return op.end(); } ///< Return an iterator to the end of the PcodeOps
|
||||
list<PcodeOp *>::const_iterator beginOp(void) const { return op.begin(); } ///< Return an iterator to the beginning of the PcodeOps
|
||||
|
|
Loading…
Reference in New Issue
Block a user