summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-02-25 07:23:08 +0000
committerJustin Bogner <mail@justinbogner.com>2016-02-25 07:23:08 +0000
commiteecc3c826a58cb96697e56e159b14c7e9ae605dc (patch)
tree18e4ebfe7faa7f2a97a07de81ae96dab75b7075c /llvm/lib/Analysis
parentbe8f522ef3df6aec5d4c9c2e897865e55bbdb6ff (diff)
downloadbcm5719-llvm-eecc3c826a58cb96697e56e159b14c7e9ae605dc.tar.gz
bcm5719-llvm-eecc3c826a58cb96697e56e159b14c7e9ae605dc.zip
PM: Implement a basic loop pass manager
This creates the new-style LoopPassManager and wires it up with dummy and print passes. This version doesn't support modifying the loop nest at all. It will be far easier to discuss and evaluate the approaches to that with this in place so that the boilerplate is out of the way. llvm-svn: 261831
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/CMakeLists.txt1
-rw-r--r--llvm/lib/Analysis/LoopPassManager.cpp45
2 files changed, 46 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/CMakeLists.txt b/llvm/lib/Analysis/CMakeLists.txt
index 38234207d9a..72669289b08 100644
--- a/llvm/lib/Analysis/CMakeLists.txt
+++ b/llvm/lib/Analysis/CMakeLists.txt
@@ -42,6 +42,7 @@ add_llvm_library(LLVMAnalysis
LoopUnrollAnalyzer.cpp
LoopInfo.cpp
LoopPass.cpp
+ LoopPassManager.cpp
MemDepPrinter.cpp
MemDerefPrinter.cpp
MemoryBuiltins.cpp
diff --git a/llvm/lib/Analysis/LoopPassManager.cpp b/llvm/lib/Analysis/LoopPassManager.cpp
new file mode 100644
index 00000000000..b1d1140d11b
--- /dev/null
+++ b/llvm/lib/Analysis/LoopPassManager.cpp
@@ -0,0 +1,45 @@
+//===- LoopPassManager.cpp - Loop pass management -------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Analysis/LoopPassManager.h"
+
+using namespace llvm;
+
+char LoopAnalysisManagerFunctionProxy::PassID;
+
+LoopAnalysisManagerFunctionProxy::Result
+LoopAnalysisManagerFunctionProxy::run(Function &F) {
+ // TODO: In FunctionAnalysisManagerModuleProxy we assert that the
+ // AnalysisManager is empty, but if we do that here we run afoul of the fact
+ // that we still have results for previous functions alive. Should we be
+ // clearing those when we finish a function?
+ //assert(LAM->empty() && "Loop analyses ran prior to the function proxy!");
+ return Result(*LAM);
+}
+
+LoopAnalysisManagerFunctionProxy::Result::~Result() {
+ // Clear out the analysis manager if we're being destroyed -- it means we
+ // didn't even see an invalidate call when we got invalidated.
+ LAM->clear();
+}
+
+bool LoopAnalysisManagerFunctionProxy::Result::invalidate(
+ Function &F, const PreservedAnalyses &PA) {
+ // If this proxy isn't marked as preserved, then we can't even invalidate
+ // individual loop analyses, there may be an invalid set of Loops in the cache
+ // making it impossible to incrementally preserve them. Just clear the entire
+ // manager.
+ if (!PA.preserved(ID()))
+ LAM->clear();
+
+ // Return false to indicate that this result is still a valid proxy.
+ return false;
+}
+
+char FunctionAnalysisManagerLoopProxy::PassID;
OpenPOWER on IntegriCloud