refactor isSplittable to BlockBasic

This commit is contained in:
kudu-dynamics 2024-01-19 09:43:22 -05:00
parent 2f6112941f
commit 78b34d9b12
2 changed files with 29 additions and 0 deletions

View File

@ -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

View File

@ -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