mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 22:04:55 +00:00
3c95d9ccc0
and expose the necessary hooks in the API directly. This makes it much cleaner for example to log the usage of a pass manager from a library. It also makes it more obvious that this functionality isn't "optional" or "asserts-only" for the pass manager. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225841 91177308-0d34-0410-b5e6-96231b3b80d8
44 lines
1.5 KiB
C++
44 lines
1.5 KiB
C++
//===- PassManager.cpp - Infrastructure for managing & running IR passes --===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/ADT/STLExtras.h"
|
|
#include "llvm/IR/LLVMContext.h"
|
|
#include "llvm/IR/PassManager.h"
|
|
|
|
using namespace llvm;
|
|
|
|
char FunctionAnalysisManagerModuleProxy::PassID;
|
|
|
|
FunctionAnalysisManagerModuleProxy::Result
|
|
FunctionAnalysisManagerModuleProxy::run(Module &M) {
|
|
assert(FAM->empty() && "Function analyses ran prior to the module proxy!");
|
|
return Result(*FAM);
|
|
}
|
|
|
|
FunctionAnalysisManagerModuleProxy::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.
|
|
FAM->clear();
|
|
}
|
|
|
|
bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
|
|
Module &M, const PreservedAnalyses &PA) {
|
|
// If this proxy isn't marked as preserved, then we can't even invalidate
|
|
// individual function analyses, there may be an invalid set of Function
|
|
// objects in the cache making it impossible to incrementally preserve them.
|
|
// Just clear the entire manager.
|
|
if (!PA.preserved(ID()))
|
|
FAM->clear();
|
|
|
|
// Return false to indicate that this result is still a valid proxy.
|
|
return false;
|
|
}
|
|
|
|
char ModuleAnalysisManagerFunctionProxy::PassID;
|