diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/condexe.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/condexe.cc index 1b8b6e4f2d..0c7647c6e4 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/condexe.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/condexe.cc @@ -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; diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/condexe.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/condexe.hh index 1bc15b1ffb..7e85e7dbdd 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/condexe.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/condexe.hh @@ -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 }; diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc index 622ab1e444..3e52bb1d6b 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.cc @@ -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 diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.hh index 08a5e740b7..9a27e51a6c 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/heritage.hh @@ -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 &lastcombo,vector &nextlev,JoinRecord *joinrec);