forked from OSchip/llvm-project
[PM/AA] Hoist the SCEV-AA interface to its own header and pull the
creation function into that header. llvm-svn: 245013
This commit is contained in:
parent
42ff448fe4
commit
ed23528fb2
|
@ -44,13 +44,6 @@ namespace llvm {
|
|||
//
|
||||
ImmutablePass *createNoAAPass();
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createScalarEvolutionAliasAnalysisPass - This pass implements a simple
|
||||
// alias analysis using ScalarEvolution queries.
|
||||
//
|
||||
FunctionPass *createScalarEvolutionAliasAnalysisPass();
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createTypeBasedAliasAnalysisPass - This pass implements metadata-based
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
//===- ScalarEvolutionAliasAnalysis.h - SCEV-based AA -----------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// \file
|
||||
/// This is the interface for a SCEV-based alias analysis.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_SCALAREVOLUTIONALIASANALYSIS_H
|
||||
#define LLVM_ANALYSIS_SCALAREVOLUTIONALIASANALYSIS_H
|
||||
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
/// 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);
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createScalarEvolutionAliasAnalysisPass - This pass implements a simple
|
||||
// alias analysis using ScalarEvolution queries.
|
||||
//
|
||||
FunctionPass *createScalarEvolutionAliasAnalysisPass();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -30,6 +30,7 @@
|
|||
#include "llvm/Analysis/RegionPass.h"
|
||||
#include "llvm/Analysis/RegionPrinter.h"
|
||||
#include "llvm/Analysis/ScalarEvolution.h"
|
||||
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
|
||||
#include "llvm/Analysis/ScopedNoAliasAA.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue