Fixed bug in numHeritagePasses

This commit is contained in:
caheckman 2020-03-31 09:25:49 -04:00
parent 1560158d2a
commit 7dea6d1f41
4 changed files with 13 additions and 5 deletions

View file

@ -759,6 +759,15 @@ bool ConditionalExecution::verify(void)
return true;
}
/// Set up for testing ConditionalExecution on multiple iblocks
/// \param f is the function to do testing on
ConditionalExecution::ConditionalExecution(Funcdata *f)
{
fd = f;
buildHeritageArray(); // Cache an array depending on the particular heritage pass
}
/// The given block is tested as a possible \b iblock. If this configuration
/// works and is not a \b directsplit, \b true is returned.
/// If the configuration works as a \b directsplit, then recursively check that
@ -772,7 +781,6 @@ bool ConditionalExecution::trial(BlockBasic *ib)
{
iblock = ib;
buildHeritageArray();
if (!verify()) return false;
PcodeOp *cbranch_copy;

View file

@ -160,7 +160,7 @@ class ConditionalExecution {
void fixReturnOp(void);
bool verify(void); ///< Verify that we have a removable \b iblock
public:
ConditionalExecution(Funcdata *f) { fd = f; } ///< Constructor
ConditionalExecution(Funcdata *f); ///< Constructor
bool trial(BlockBasic *ib); ///< Test for a modifiable configuration around the given block
void execute(void); ///< Eliminate the unnecessary path join at \b iblock
};

View file

@ -2340,7 +2340,7 @@ const LoadGuard *Heritage::getStoreGuard(PcodeOp *op) const
/// \brief Get the number times heritage was performed for the given address space
///
/// A negative number indicates the number of passes to be wait before the first
/// A negative number indicates the number of passes to wait before the first
/// heritage will occur.
/// \param spc is the given address space
/// \return the number of heritage passes performed
@ -2350,7 +2350,7 @@ int4 Heritage::numHeritagePasses(AddrSpace *spc) const
const HeritageInfo *info = getInfo(spc);
if (!info->isHeritaged())
throw LowlevelError("Trying to calculate passes for non-heritaged space");
return (info->delay - pass);
return (pass - info->delay);
}
/// Record that Varnodes have been removed from the given space so that we can

View file

@ -219,7 +219,7 @@ class Heritage {
/// \brief Get the heritage status for the given address space
HeritageInfo *getInfo(AddrSpace *spc) { return &(infolist[spc->getIndex()]); }
/// \brief Get the heriage status for the given address space
/// \brief Get the heritage status for the given address space
const HeritageInfo *getInfo(AddrSpace *spc) const { return &(infolist[spc->getIndex()]); }
void splitJoinLevel(vector<Varnode *> &lastcombo,vector<Varnode *> &nextlev,JoinRecord *joinrec);