[PM/AA] Hoist the SCEV-AA interface to its own header and pull the

creation function into that header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245013 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth
2015-08-14 03:11:16 +00:00
parent 01910b8f31
commit 217849dc42
4 changed files with 69 additions and 46 deletions
+1 -39
View File
@@ -19,47 +19,9 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
using namespace llvm;
namespace {
/// ScalarEvolutionAliasAnalysis - This is a simple alias analysis
/// implementation that uses ScalarEvolution to answer queries.
class ScalarEvolutionAliasAnalysis : public FunctionPass,
public AliasAnalysis {
ScalarEvolution *SE;
public:
static char ID; // Class identification, replacement for typeinfo
ScalarEvolutionAliasAnalysis() : FunctionPass(ID), SE(nullptr) {
initializeScalarEvolutionAliasAnalysisPass(
*PassRegistry::getPassRegistry());
}
/// getAdjustedAnalysisPointer - This method is used when a pass implements
/// an analysis interface through multiple inheritance. If needed, it
/// should override this to adjust the this pointer as needed for the
/// specified pass info.
void *getAdjustedAnalysisPointer(AnalysisID PI) override {
if (PI == &AliasAnalysis::ID)
return (AliasAnalysis*)this;
return this;
}
private:
void getAnalysisUsage(AnalysisUsage &AU) const override;
bool runOnFunction(Function &F) override;
AliasResult alias(const MemoryLocation &LocA,
const MemoryLocation &LocB) override;
Value *GetBaseValue(const SCEV *S);
};
} // End of anonymous namespace
// Register this pass...
char ScalarEvolutionAliasAnalysis::ID = 0;
INITIALIZE_AG_PASS_BEGIN(ScalarEvolutionAliasAnalysis, AliasAnalysis, "scev-aa",