mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Correct format: //===--- Name of file - Description ----------------------------*- Lang -*-===//
55 lines
1.6 KiB
C++
55 lines
1.6 KiB
C++
//===--- LoopAnalysis.h - SIL Loop Analysis ---------------------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SWIFT_SILOPTIMIZER_ANALYSIS_LOOPINFOANALYSIS_H
|
|
#define SWIFT_SILOPTIMIZER_ANALYSIS_LOOPINFOANALYSIS_H
|
|
|
|
#include "swift/SIL/CFG.h"
|
|
#include "swift/SIL/LoopInfo.h"
|
|
#include "swift/SIL/SILBasicBlock.h"
|
|
#include "swift/SILOptimizer/Analysis/Analysis.h"
|
|
#include "llvm/ADT/DenseMap.h"
|
|
|
|
namespace swift {
|
|
class DominanceInfo;
|
|
class SILLoop;
|
|
class DominanceAnalysis;
|
|
}
|
|
|
|
namespace swift {
|
|
|
|
/// Computes natural loop information for SIL basic blocks.
|
|
class SILLoopAnalysis : public FunctionAnalysisBase<SILLoopInfo> {
|
|
DominanceAnalysis *DA;
|
|
public:
|
|
SILLoopAnalysis(SILModule *)
|
|
: FunctionAnalysisBase(AnalysisKind::Loop), DA(nullptr) {}
|
|
|
|
static bool classof(const SILAnalysis *S) {
|
|
return S->getKind() == AnalysisKind::Loop;
|
|
}
|
|
|
|
virtual bool shouldInvalidate(SILAnalysis::InvalidationKind K) override {
|
|
return K & InvalidationKind::Branches;
|
|
}
|
|
|
|
// Computes loop information for the given function using dominance
|
|
// information.
|
|
virtual SILLoopInfo *newFunctionAnalysis(SILFunction *F) override;
|
|
|
|
virtual void initialize(SILPassManager *PM) override;
|
|
};
|
|
|
|
} // end namespace swift
|
|
|
|
#endif
|