|
Jlm
|
#include <ScalarEvolution.hpp>


Classes | |
| class | Context |
| struct | DependencyInfo |
| class | Statistics |
Public Types | |
| enum class | DependencyOp { Add , Mul , None } |
| typedef std::unordered_map< rvsdg::Output *, DependencyInfo > | DependencyMap |
| typedef std::unordered_map< rvsdg::Output *, DependencyMap > | DependencyGraph |
Public Member Functions | |
| ~ScalarEvolution () noexcept override | |
| ScalarEvolution () | |
| ScalarEvolution (const ScalarEvolution &)=delete | |
| ScalarEvolution (ScalarEvolution &&)=delete | |
| ScalarEvolution & | operator= (const ScalarEvolution &)=delete |
| ScalarEvolution & | operator= (ScalarEvolution &&)=delete |
| std::unordered_map< const rvsdg::Output *, std::unique_ptr< SCEVChainRecurrence > > | GetChrecMap () const |
| std::unordered_map< const rvsdg::Output *, std::unique_ptr< SCEV > > | GetSCEVMap () const |
| std::unordered_map< const rvsdg::ThetaNode *, size_t > | GetTripCountMap () const noexcept |
| void | Run (rvsdg::RvsdgModule &rvsdgModule, util::StatisticsCollector &statisticsCollector) override |
| Perform RVSDG transformation. More... | |
| std::optional< size_t > | GetPredictedTripCount (rvsdg::ThetaNode &thetaNode) |
| void | AnalyzeRegion (rvsdg::Region ®ion) |
| void | CombineChrecsAcrossLoops () |
Public Member Functions inherited from jlm::rvsdg::Transformation | |
| virtual | ~Transformation () noexcept |
| Transformation (std::string_view Name) | |
| const std::string_view & | GetName () const noexcept |
| void | Run (RvsdgModule &module) |
| Perform RVSDG transformation. More... | |
Static Public Member Functions | |
| static bool | StructurallyEqual (const SCEV &a, const SCEV &b) |
| static bool | IsUnknown (const SCEV &scev) |
Private Member Functions | |
| std::unique_ptr< SCEV > | GetOrCreateSCEVForOutput (rvsdg::Output &output) |
| DependencyGraph | CreateDependencyGraph (const rvsdg::ThetaNode &thetaNode) const |
| void | PerformSCEVAnalysis (rvsdg::ThetaNode &thetaNode) |
| std::unique_ptr< SCEV > | ComputeSCEVForGepInnerOffset (const rvsdg::SimpleNode &gepNode, size_t inputIndex, const rvsdg::Type &type) |
| std::optional< std::unique_ptr< SCEV > > | TryReplaceInitForSCEV (const SCEV &scev, rvsdg::Output &output) |
| std::unique_ptr< SCEVChainRecurrence > | GetOrCreateChainRecurrence (rvsdg::Output &output, const SCEV &scev, rvsdg::ThetaNode &thetaNode) |
| std::unique_ptr< SCEVChainRecurrence > | GetOrCreateStepForSCEV (rvsdg::Output &output, const SCEV &scevTree, rvsdg::ThetaNode &thetaNode) |
Static Private Member Functions | |
| static std::optional< size_t > | ComputeBackedgeTakenCountForChrec (const SCEVChainRecurrence &chrec, int64_t bound, const rvsdg::SimpleOperation *comparisonOperation) |
| static std::optional< size_t > | SolveQuadraticEquation (int64_t a, int64_t b, int64_t c) |
| Tries to find a solution to the quadratic equation a^2 x + b x + c = 0 using integer arithmetic. More... | |
| static bool | IsStepNegative (const SCEV &stepSCEV) |
| static bool | IsStepPositive (const SCEV &stepSCEV) |
| static bool | IsStepZero (const SCEV &stepSCEV) |
| static std::unique_ptr< SCEV > | GetNegativeSCEV (const SCEV &scev) |
| static void | FindDependenciesForSCEV (const SCEV &scev, DependencyMap &dependencies, DependencyOp op) |
| static std::vector< rvsdg::Output * > | TopologicalSort (DependencyGraph &dependencyGraph) |
| static std::unique_ptr< SCEV > | ApplyAddFolding (SCEV *lhsOperand, SCEV *rhsOperand, rvsdg::Output &output) |
| Apply folding rules for addition to combine two SCEV operands into one. More... | |
| static std::unique_ptr< SCEVChainRecurrence > | ComputeProductOfChrecs (SCEVChainRecurrence *lhsChrec, SCEVChainRecurrence *rhsChrec, rvsdg::Output &output) |
| static std::unique_ptr< SCEV > | ApplyMulFolding (SCEV *lhsOperand, SCEV *rhsOperand, rvsdg::Output &output) |
| Apply folding rules for multiplication to combine two SCEV operands into one. More... | |
| static std::unique_ptr< SCEV > | FoldNAryExpression (SCEVNAryExpr &expression, rvsdg::Output &output) |
| Try to combine the constants in an n-ary expression (Add or Mul) into themselves. More... | |
| static bool | CanCreateChainRecurrence (rvsdg::Output &output, DependencyGraph &dependencyGraph) |
| static bool | HasCycleThroughOthers (rvsdg::Output ¤tOutput, const rvsdg::Output &originalOutput, DependencyGraph &dependencyGraph, std::unordered_set< const rvsdg::Output * > &visited, std::unordered_set< const rvsdg::Output * > &recursionStack) |
Private Attributes | |
| std::unique_ptr< Context > | Context_ |
Definition at line 575 of file ScalarEvolution.hpp.
| typedef std::unordered_map<rvsdg::Output *, DependencyMap> jlm::llvm::ScalarEvolution::DependencyGraph |
Definition at line 604 of file ScalarEvolution.hpp.
| typedef std::unordered_map<rvsdg::Output *, DependencyInfo> jlm::llvm::ScalarEvolution::DependencyMap |
Definition at line 602 of file ScalarEvolution.hpp.
|
strong |
| Enumerator | |
|---|---|
| Add | |
| Mul | |
| None | |
Definition at line 581 of file ScalarEvolution.hpp.
|
overridedefaultnoexcept |
| jlm::llvm::ScalarEvolution::ScalarEvolution | ( | ) |
Definition at line 236 of file ScalarEvolution.cpp.
|
delete |
|
delete |
| void jlm::llvm::ScalarEvolution::AnalyzeRegion | ( | rvsdg::Region & | region | ) |
Definition at line 288 of file ScalarEvolution.cpp.
|
staticprivate |
Apply folding rules for addition to combine two SCEV operands into one.
| lhsOperand | The left-hand side operand of the add operation |
| rhsOperand | The right-hand side operand of the add operation |
| output | The output of the addition operation we are folding. |
Definition at line 1342 of file ScalarEvolution.cpp.
|
staticprivate |
Apply folding rules for multiplication to combine two SCEV operands into one.
| lhsOperand | The left-hand side operand of the mul operation |
| rhsOperand | The right-hand side operand of the mul operation |
| output | The output of the multiplication operation we are folding |
Definition at line 1699 of file ScalarEvolution.cpp.
|
staticprivate |
Checks the dependencies of the input variable to determine if we can create a chain recurrence using it's SCEV.
The requirements are:
| output | The output to check. |
| dependencyGraph | The dependency graph which stores the dependencies of all outputs in the loop. |
Definition at line 1917 of file ScalarEvolution.cpp.
| void jlm::llvm::ScalarEvolution::CombineChrecsAcrossLoops | ( | ) |
Goes through all chain recurrences stored in the context (across different loops), and stitches them together wherever possible.
Definition at line 768 of file ScalarEvolution.cpp.
|
staticprivate |
Tries to compute the number of times the backedge is taken in a loop where the condition for the predicate checks whether the variable described by chrec satisfies the comparison operation when compared to the bound.
Figuring out the number of times the backedge is taken can be equivalently expressed as: "At which iteration does the loop condition become false?" That’s naturally expressed as: f(i) - k changes sign, where f(i) is the value of the recurrence at iteration i and k is the bound value
| chrec | The chain recurrence to compare with the bound. |
| bound | The compare value for the operation. |
| comparisonOperation | The comparison operation that is used in the predicate of the loop. |
Definition at line 607 of file ScalarEvolution.cpp.
|
staticprivate |
Definition at line 1585 of file ScalarEvolution.cpp.
|
private |
Definition at line 1051 of file ScalarEvolution.cpp.
|
private |
Definition at line 1130 of file ScalarEvolution.cpp.
|
staticprivate |
Definition at line 1100 of file ScalarEvolution.cpp.
|
staticprivate |
Try to combine the constants in an n-ary expression (Add or Mul) into themselves.
| expression | The expression to be folded |
| output | The output of the operation the n-ary expression represents |
Definition at line 1290 of file ScalarEvolution.cpp.
| std::unordered_map< const rvsdg::Output *, std::unique_ptr< SCEVChainRecurrence > > jlm::llvm::ScalarEvolution::GetChrecMap | ( | ) | const |
Returns a copy of the chrec map containing the computed chain recurrences after running the analysis.
Definition at line 243 of file ScalarEvolution.cpp.
|
staticprivate |
Definition at line 1884 of file ScalarEvolution.cpp.
|
private |
Definition at line 1210 of file ScalarEvolution.cpp.
|
private |
Definition at line 944 of file ScalarEvolution.cpp.
|
private |
Definition at line 1243 of file ScalarEvolution.cpp.
| std::optional< size_t > jlm::llvm::ScalarEvolution::GetPredictedTripCount | ( | rvsdg::ThetaNode & | thetaNode | ) |
Definition at line 401 of file ScalarEvolution.cpp.
| std::unordered_map< const rvsdg::Output *, std::unique_ptr< SCEV > > jlm::llvm::ScalarEvolution::GetSCEVMap | ( | ) | const |
Returns a copy of the scev map containing the computed scev trees after running the analysis.
Definition at line 254 of file ScalarEvolution.cpp.
|
noexcept |
Definition at line 265 of file ScalarEvolution.cpp.
|
staticprivate |
Definition at line 1942 of file ScalarEvolution.cpp.
|
staticprivate |
Definition at line 323 of file ScalarEvolution.cpp.
|
staticprivate |
Definition at line 349 of file ScalarEvolution.cpp.
|
staticprivate |
Definition at line 375 of file ScalarEvolution.cpp.
|
static |
Checks if the given scev is or contains a SCEVUnknown.
| scev | the SCEV expression to be checked |
Definition at line 1977 of file ScalarEvolution.cpp.
|
delete |
|
delete |
|
private |
Definition at line 867 of file ScalarEvolution.cpp.
|
overridevirtual |
Perform RVSDG transformation.
| module | RVSDG module the transformation is performed on. |
| statisticsCollector | Statistics collector for collecting transformation statistics. |
Implements jlm::rvsdg::Transformation.
Definition at line 271 of file ScalarEvolution.cpp.
|
staticprivate |
Tries to find a solution to the quadratic equation a^2 x + b x + c = 0 using integer arithmetic.
Credit to the SolveQuadraticEquationWrap() method in the LLVM APInt.cpp file (https://llvm.org/doxygen/APInt_8cpp_source.html#l02823) for the general approach.
Definition at line 696 of file ScalarEvolution.cpp.
Definition at line 2007 of file ScalarEvolution.cpp.
|
staticprivate |
Definition at line 1157 of file ScalarEvolution.cpp.
|
private |
Recursively traverses chain recurrences to find Init nodes that can be replaced with their (now computed) corresponding chain recurrences and replaces them
| scev | The SCEV expression to be traversed |
| output | The output of the operation the SCEV represents |
Definition at line 803 of file ScalarEvolution.cpp.
|
private |
Definition at line 819 of file ScalarEvolution.hpp.