blob: 5b40a0beff7a794d0e2b657ccaf32106176ae3b7 [file] [log] [blame]
Justin Bognereecc3c82016-02-25 07:23:08 +00001//===- LoopPassManager.cpp - Loop pass management -------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/Analysis/LoopPassManager.h"
Justin Bognere839c3e2016-05-03 21:35:08 +000011#include "llvm/Analysis/BasicAliasAnalysis.h"
12#include "llvm/Analysis/GlobalsModRef.h"
13#include "llvm/Analysis/LoopInfo.h"
14#include "llvm/Analysis/ScalarEvolution.h"
15#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
16#include "llvm/IR/Dominators.h"
Justin Bognereecc3c82016-02-25 07:23:08 +000017
18using namespace llvm;
19
Chandler Carruth6b981642016-12-10 06:34:44 +000020// Explicit template instantiations and specialization defininitions for core
21// template typedefs.
Chandler Carruth2a540942016-02-27 10:38:10 +000022namespace llvm {
Chandler Carruthafcec4c2016-02-27 10:45:35 +000023template class PassManager<Loop>;
24template class AnalysisManager<Loop>;
Chandler Carruth2a540942016-02-27 10:38:10 +000025template class InnerAnalysisManagerProxy<LoopAnalysisManager, Function>;
26template class OuterAnalysisManagerProxy<FunctionAnalysisManager, Loop>;
Chandler Carruth6b981642016-12-10 06:34:44 +000027
28template <>
29bool LoopAnalysisManagerFunctionProxy::Result::invalidate(
30 Function &F, const PreservedAnalyses &PA,
31 FunctionAnalysisManager::Invalidator &Inv) {
32 // If this proxy isn't marked as preserved, the set of Function objects in
33 // the module may have changed. We therefore can't call
34 // InnerAM->invalidate(), because any pointers to Functions it has may be
35 // stale.
36 if (!PA.preserved(LoopAnalysisManagerFunctionProxy::ID()))
37 InnerAM->clear();
38
39 // FIXME: Proper suppor for invalidation isn't yet implemented for the LPM.
40
41 // Return false to indicate that this result is still a valid proxy.
42 return false;
43}
Justin Bognereecc3c82016-02-25 07:23:08 +000044}
Justin Bognere839c3e2016-05-03 21:35:08 +000045
46PreservedAnalyses llvm::getLoopPassPreservedAnalyses() {
47 PreservedAnalyses PA;
48 PA.preserve<DominatorTreeAnalysis>();
49 PA.preserve<LoopAnalysis>();
50 PA.preserve<ScalarEvolutionAnalysis>();
51 // TODO: What we really want to do here is preserve an AA category, but that
52 // concept doesn't exist yet.
53 PA.preserve<BasicAA>();
54 PA.preserve<GlobalsAA>();
55 PA.preserve<SCEVAA>();
56 return PA;
57}