Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.5 KiB

  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. #ifndef LLVM_ANALYSIS_LIBCALLALIASANALYSIS_H
  14. #define LLVM_ANALYSIS_LIBCALLALIASANALYSIS_H
  15. #include "llvm/Analysis/AliasAnalysis.h"
  16. #include "llvm/Pass.h"
  17. namespace llvm {
  18. class LibCallInfo;
  19. struct LibCallFunctionInfo;
  20. /// LibCallAliasAnalysis - Alias analysis driven from LibCallInfo.
  21. struct LibCallAliasAnalysis : public FunctionPass, public AliasAnalysis {
  22. static char ID; // Class identification
  23. LibCallInfo *LCI;
  24. explicit LibCallAliasAnalysis(LibCallInfo *LC = 0)
  25. : FunctionPass(ID), LCI(LC) {
  26. initializeLibCallAliasAnalysisPass(*PassRegistry::getPassRegistry());
  27. }
  28. explicit LibCallAliasAnalysis(char &ID, LibCallInfo *LC)
  29. : FunctionPass(ID), LCI(LC) {
  30. initializeLibCallAliasAnalysisPass(*PassRegistry::getPassRegistry());
  31. }
  32. ~LibCallAliasAnalysis();
  33. ModRefResult getModRefInfo(ImmutableCallSite CS,
  34. const Location &Loc);
  35. ModRefResult getModRefInfo(ImmutableCallSite CS1,
  36. ImmutableCallSite CS2) {
  37. // TODO: Could compare two direct calls against each other if we cared to.
  38. return AliasAnalysis::getModRefInfo(CS1, CS2);
  39. }
  40. virtual void getAnalysisUsage(AnalysisUsage &AU) const;
  41. virtual bool runOnFunction(Function &F) {
  42. InitializeAliasAnalysis(this); // set up super class
  43. return false;
  44. }
  45. /// getAdjustedAnalysisPointer - This method is used when a pass implements
  46. /// an analysis interface through multiple inheritance. If needed, it
  47. /// should override this to adjust the this pointer as needed for the
  48. /// specified pass info.
  49. virtual void *getAdjustedAnalysisPointer(const void *PI) {
  50. if (PI == &AliasAnalysis::ID)
  51. return (AliasAnalysis*)this;
  52. return this;
  53. }
  54. private:
  55. ModRefResult AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
  56. ImmutableCallSite CS,
  57. const Location &Loc);
  58. };
  59. } // End of llvm namespace
  60. #endif