1 //===- LibCallAliasAnalysis.h - Implement AliasAnalysis for libcalls ------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the LibCallAliasAnalysis class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_ANALYSIS_LIBCALLALIASANALYSIS_H
15 #define LLVM_ANALYSIS_LIBCALLALIASANALYSIS_H
17 #include "llvm/Analysis/AliasAnalysis.h"
18 #include "llvm/Pass.h"
22 struct LibCallFunctionInfo;
24 /// LibCallAliasAnalysis - Alias analysis driven from LibCallInfo.
25 struct LibCallAliasAnalysis : public FunctionPass, public AliasAnalysis {
26 static char ID; // Class identification
30 explicit LibCallAliasAnalysis(LibCallInfo *LC = 0)
31 : FunctionPass(ID), LCI(LC) {
32 initializeLibCallAliasAnalysisPass(*PassRegistry::getPassRegistry());
34 explicit LibCallAliasAnalysis(char &ID, LibCallInfo *LC)
35 : FunctionPass(ID), LCI(LC) {
36 initializeLibCallAliasAnalysisPass(*PassRegistry::getPassRegistry());
38 ~LibCallAliasAnalysis();
40 ModRefResult getModRefInfo(ImmutableCallSite CS,
43 ModRefResult getModRefInfo(ImmutableCallSite CS1,
44 ImmutableCallSite CS2) {
45 // TODO: Could compare two direct calls against each other if we cared to.
46 return AliasAnalysis::getModRefInfo(CS1, CS2);
49 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
51 virtual bool runOnFunction(Function &F) {
52 InitializeAliasAnalysis(this); // set up super class
56 /// getAdjustedAnalysisPointer - This method is used when a pass implements
57 /// an analysis interface through multiple inheritance. If needed, it
58 /// should override this to adjust the this pointer as needed for the
59 /// specified pass info.
60 virtual void *getAdjustedAnalysisPointer(const void *PI) {
61 if (PI == &AliasAnalysis::ID)
62 return (AliasAnalysis*)this;
67 ModRefResult AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
71 } // End of llvm namespace