mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-20 18:52:46 +00:00
[PM/AA] Hoist the interface to TBAA into a dedicated header along with
its creation function. Update the relevant includes accordingly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245019 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
51d9f587b7
commit
40e8a59ff9
@ -44,13 +44,6 @@ namespace llvm {
|
||||
//
|
||||
ImmutablePass *createNoAAPass();
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createTypeBasedAliasAnalysisPass - This pass implements metadata-based
|
||||
// type-based alias analysis.
|
||||
//
|
||||
ImmutablePass *createTypeBasedAliasAnalysisPass();
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createObjCARCAliasAnalysisPass - This pass implements ObjC-ARC-based
|
||||
|
71
include/llvm/Analysis/TypeBasedAliasAnalysis.h
Normal file
71
include/llvm/Analysis/TypeBasedAliasAnalysis.h
Normal file
@ -0,0 +1,71 @@
|
||||
//===- TypeBasedAliasAnalysis.h - Type-Based Alias Analysis -----*- 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 metadata-based TBAA. See the source file for
|
||||
/// details on the algorithm.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_ANALYSIS_TYPEBASEDALIASANALYSIS_H
|
||||
#define LLVM_ANALYSIS_TYPEBASEDALIASANALYSIS_H
|
||||
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/Pass.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
/// TypeBasedAliasAnalysis - This is a simple alias analysis
|
||||
/// implementation that uses TypeBased to answer queries.
|
||||
class TypeBasedAliasAnalysis : public ImmutablePass, public AliasAnalysis {
|
||||
public:
|
||||
static char ID; // Class identification, replacement for typeinfo
|
||||
TypeBasedAliasAnalysis() : ImmutablePass(ID) {
|
||||
initializeTypeBasedAliasAnalysisPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
bool doInitialization(Module &M) override;
|
||||
|
||||
/// 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(const void *PI) override {
|
||||
if (PI == &AliasAnalysis::ID)
|
||||
return (AliasAnalysis *)this;
|
||||
return this;
|
||||
}
|
||||
|
||||
bool Aliases(const MDNode *A, const MDNode *B) const;
|
||||
bool PathAliases(const MDNode *A, const MDNode *B) const;
|
||||
|
||||
private:
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
AliasResult alias(const MemoryLocation &LocA,
|
||||
const MemoryLocation &LocB) override;
|
||||
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) override;
|
||||
FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override;
|
||||
FunctionModRefBehavior getModRefBehavior(const Function *F) override;
|
||||
ModRefInfo getModRefInfo(ImmutableCallSite CS,
|
||||
const MemoryLocation &Loc) override;
|
||||
ModRefInfo getModRefInfo(ImmutableCallSite CS1,
|
||||
ImmutableCallSite CS2) override;
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
//
|
||||
// createTypeBasedAliasAnalysisPass - This pass implements metadata-based
|
||||
// type-based alias analysis.
|
||||
//
|
||||
ImmutablePass *createTypeBasedAliasAnalysisPass();
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -32,6 +32,7 @@
|
||||
#include "llvm/Analysis/ScalarEvolution.h"
|
||||
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
|
||||
#include "llvm/Analysis/ScopedNoAliasAA.h"
|
||||
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/IR/Function.h"
|
||||
#include "llvm/IR/IRPrintingPasses.h"
|
||||
|
@ -121,15 +121,12 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
||||
using namespace llvm;
|
||||
|
||||
// A handy option for disabling TBAA functionality. The same effect can also be
|
||||
@ -272,45 +269,6 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
namespace {
|
||||
/// TypeBasedAliasAnalysis - This is a simple alias analysis
|
||||
/// implementation that uses TypeBased to answer queries.
|
||||
class TypeBasedAliasAnalysis : public ImmutablePass, public AliasAnalysis {
|
||||
public:
|
||||
static char ID; // Class identification, replacement for typeinfo
|
||||
TypeBasedAliasAnalysis() : ImmutablePass(ID) {
|
||||
initializeTypeBasedAliasAnalysisPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
bool doInitialization(Module &M) override;
|
||||
|
||||
/// 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(const void *PI) override {
|
||||
if (PI == &AliasAnalysis::ID)
|
||||
return (AliasAnalysis *)this;
|
||||
return this;
|
||||
}
|
||||
|
||||
bool Aliases(const MDNode *A, const MDNode *B) const;
|
||||
bool PathAliases(const MDNode *A, const MDNode *B) const;
|
||||
|
||||
private:
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
AliasResult alias(const MemoryLocation &LocA,
|
||||
const MemoryLocation &LocB) override;
|
||||
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal) override;
|
||||
FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override;
|
||||
FunctionModRefBehavior getModRefBehavior(const Function *F) override;
|
||||
ModRefInfo getModRefInfo(ImmutableCallSite CS,
|
||||
const MemoryLocation &Loc) override;
|
||||
ModRefInfo getModRefInfo(ImmutableCallSite CS1,
|
||||
ImmutableCallSite CS2) override;
|
||||
};
|
||||
} // End of anonymous namespace
|
||||
|
||||
// Register this pass...
|
||||
char TypeBasedAliasAnalysis::ID = 0;
|
||||
INITIALIZE_AG_PASS(TypeBasedAliasAnalysis, AliasAnalysis, "tbaa",
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "llvm/Analysis/CFLAliasAnalysis.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Analysis/ScopedNoAliasAA.h"
|
||||
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/RegAllocRegistry.h"
|
||||
#include "llvm/IR/IRPrintingPasses.h"
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "llvm/Analysis/CFLAliasAnalysis.h"
|
||||
#include "llvm/Analysis/ScopedNoAliasAA.h"
|
||||
#include "llvm/Analysis/TargetLibraryInfo.h"
|
||||
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
|
||||
#include "llvm/Target/TargetMachine.h"
|
||||
#include "llvm/Transforms/IPO.h"
|
||||
#include "llvm/Transforms/Scalar.h"
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "llvm/Analysis/BasicAliasAnalysis.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Analysis/ScopedNoAliasAA.h"
|
||||
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
|
||||
#include "llvm/IR/DataLayout.h"
|
||||
#include "llvm/IR/Verifier.h"
|
||||
#include "llvm/InitializePasses.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Analysis/TypeBasedAliasAnalysis.h"
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user