mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Merge the implementations of isLoopInvariant and hasComputableLoopEvolution, and
memoize the results. This improves compile time in code which highly complex expressions which get queried many times. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119584 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -142,6 +142,16 @@ namespace llvm {
|
||||
/// they must ask this class for services.
|
||||
///
|
||||
class ScalarEvolution : public FunctionPass {
|
||||
public:
|
||||
/// LoopDisposition - An enum describing the relationship between a
|
||||
/// SCEV and a loop.
|
||||
enum LoopDisposition {
|
||||
LoopVariant, ///< The SCEV is loop-variant (unknown).
|
||||
LoopInvariant, ///< The SCEV is loop-invariant.
|
||||
LoopComputable ///< The SCEV varies predictably with the loop.
|
||||
};
|
||||
|
||||
private:
|
||||
/// SCEVCallbackVH - A CallbackVH to arrange for ScalarEvolution to be
|
||||
/// notified whenever a Value is deleted.
|
||||
class SCEVCallbackVH : public CallbackVH {
|
||||
@@ -229,6 +239,13 @@ namespace llvm {
|
||||
std::map<const SCEV *,
|
||||
std::map<const Loop *, const SCEV *> > ValuesAtScopes;
|
||||
|
||||
/// LoopDispositions - Memoized computeLoopDisposition results.
|
||||
std::map<const SCEV *,
|
||||
std::map<const Loop *, LoopDisposition> > LoopDispositions;
|
||||
|
||||
/// computeLoopDisposition - Compute a LoopDisposition value.
|
||||
LoopDisposition computeLoopDisposition(const SCEV *S, const Loop *L);
|
||||
|
||||
/// UnsignedRanges - Memoized results from getUnsignedRange
|
||||
DenseMap<const SCEV *, ConstantRange> UnsignedRanges;
|
||||
|
||||
@@ -663,6 +680,10 @@ namespace llvm {
|
||||
const SCEV *&LHS,
|
||||
const SCEV *&RHS);
|
||||
|
||||
/// getLoopDisposition - Return the "disposition" of the given SCEV with
|
||||
/// respect to the given loop.
|
||||
LoopDisposition getLoopDisposition(const SCEV *S, const Loop *L);
|
||||
|
||||
/// isLoopInvariant - Return true if the value of the given SCEV is
|
||||
/// unchanging in the specified loop.
|
||||
bool isLoopInvariant(const SCEV *S, const Loop *L);
|
||||
|
Reference in New Issue
Block a user