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; 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 /// The given block is tested as a possible \b iblock. If this configuration
/// works and is not a \b directsplit, \b true is returned. /// works and is not a \b directsplit, \b true is returned.
/// If the configuration works as a \b directsplit, then recursively check that /// If the configuration works as a \b directsplit, then recursively check that
@ -772,7 +781,6 @@ bool ConditionalExecution::trial(BlockBasic *ib)
{ {
iblock = ib; iblock = ib;
buildHeritageArray();
if (!verify()) return false; if (!verify()) return false;
PcodeOp *cbranch_copy; PcodeOp *cbranch_copy;

View file

@ -160,7 +160,7 @@ class ConditionalExecution {
void fixReturnOp(void); void fixReturnOp(void);
bool verify(void); ///< Verify that we have a removable \b iblock bool verify(void); ///< Verify that we have a removable \b iblock
public: public:
ConditionalExecution(Funcdata *f) { fd = f; } ///< Constructor ConditionalExecution(Funcdata *f); ///< Constructor
bool trial(BlockBasic *ib); ///< Test for a modifiable configuration around the given block bool trial(BlockBasic *ib); ///< Test for a modifiable configuration around the given block
void execute(void); ///< Eliminate the unnecessary path join at \b iblock 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 /// \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. /// heritage will occur.
/// \param spc is the given address space /// \param spc is the given address space
/// \return the number of heritage passes performed /// \return the number of heritage passes performed
@ -2350,7 +2350,7 @@ int4 Heritage::numHeritagePasses(AddrSpace *spc) const
const HeritageInfo *info = getInfo(spc); const HeritageInfo *info = getInfo(spc);
if (!info->isHeritaged()) if (!info->isHeritaged())
throw LowlevelError("Trying to calculate passes for non-heritaged space"); 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 /// 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 /// \brief Get the heritage status for the given address space
HeritageInfo *getInfo(AddrSpace *spc) { return &(infolist[spc->getIndex()]); } 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()]); } const HeritageInfo *getInfo(AddrSpace *spc) const { return &(infolist[spc->getIndex()]); }
void splitJoinLevel(vector<Varnode *> &lastcombo,vector<Varnode *> &nextlev,JoinRecord *joinrec); void splitJoinLevel(vector<Varnode *> &lastcombo,vector<Varnode *> &nextlev,JoinRecord *joinrec);