LLVM  3.7.0
LibCallAliasAnalysis.h
Go to the documentation of this file.
1 //===- LibCallAliasAnalysis.h - Implement AliasAnalysis for libcalls ------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the LibCallAliasAnalysis class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_ANALYSIS_LIBCALLALIASANALYSIS_H
15 #define LLVM_ANALYSIS_LIBCALLALIASANALYSIS_H
16 
18 #include "llvm/IR/Module.h"
19 #include "llvm/Pass.h"
20 
21 namespace llvm {
22  class LibCallInfo;
23  struct LibCallFunctionInfo;
24 
25  /// LibCallAliasAnalysis - Alias analysis driven from LibCallInfo.
27  static char ID; // Class identification
28 
30 
31  explicit LibCallAliasAnalysis(LibCallInfo *LC = nullptr)
32  : FunctionPass(ID), LCI(LC) {
34  }
35  explicit LibCallAliasAnalysis(char &ID, LibCallInfo *LC)
36  : FunctionPass(ID), LCI(LC) {
38  }
39  ~LibCallAliasAnalysis() override;
40 
42  const MemoryLocation &Loc) override;
43 
45  ImmutableCallSite CS2) override {
46  // TODO: Could compare two direct calls against each other if we cared to.
47  return AliasAnalysis::getModRefInfo(CS1, CS2);
48  }
49 
50  void getAnalysisUsage(AnalysisUsage &AU) const override;
51 
52  bool runOnFunction(Function &F) override;
53 
54  /// getAdjustedAnalysisPointer - This method is used when a pass implements
55  /// an analysis interface through multiple inheritance. If needed, it
56  /// should override this to adjust the this pointer as needed for the
57  /// specified pass info.
58  void *getAdjustedAnalysisPointer(const void *PI) override {
59  if (PI == &AliasAnalysis::ID)
60  return (AliasAnalysis*)this;
61  return this;
62  }
63 
64  private:
65  ModRefResult AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
67  const MemoryLocation &Loc);
68  };
69 } // End of llvm namespace
70 
71 #endif
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
F(f)
LibCallInfo - Abstract interface to query about library call information.
LibCallAliasAnalysis(LibCallInfo *LC=nullptr)
void * getAdjustedAnalysisPointer(const void *PI) override
getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through...
LibCallFunctionInfo - Each record in the array of FunctionInfo structs records the behavior of one li...
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:294
Representation for a specific memory location.
Module.h This file contains the declarations for the Module class.
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
ModRefResult getModRefInfo(const Instruction *I)
getModRefInfo - Return information about whether or not an instruction may read or write memory (with...
ModRefResult getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) override
getModRefInfo (for call sites) - Return information about whether a particular call site modifies or ...
void initializeLibCallAliasAnalysisPass(PassRegistry &)
LibCallAliasAnalysis(char &ID, LibCallInfo *LC)
ImmutableCallSite - establish a view to a call site for examination.
Definition: CallSite.h:418
ModRefResult getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) override
getModRefInfo - Return information about whether two call sites may refer to the same set of memory l...
ModRefResult
Simple mod/ref information...
LibCallAliasAnalysis - Alias analysis driven from LibCallInfo.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - All alias analysis implementations should invoke this directly (using AliasAnalysi...