2
0

CGSCCPassManager.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //===- CGSCCPassManager.cpp - Managing & running CGSCC passes -------------===//
  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. #include "llvm/Analysis/CGSCCPassManager.h"
  10. #include "llvm/Support/CommandLine.h"
  11. #include "llvm/Support/Debug.h"
  12. using namespace llvm;
  13. char CGSCCAnalysisManagerModuleProxy::PassID;
  14. CGSCCAnalysisManagerModuleProxy::Result
  15. CGSCCAnalysisManagerModuleProxy::run(Module &M) {
  16. assert(CGAM->empty() && "CGSCC analyses ran prior to the module proxy!");
  17. return Result(*CGAM);
  18. }
  19. CGSCCAnalysisManagerModuleProxy::Result::~Result() {
  20. // Clear out the analysis manager if we're being destroyed -- it means we
  21. // didn't even see an invalidate call when we got invalidated.
  22. CGAM->clear();
  23. }
  24. bool CGSCCAnalysisManagerModuleProxy::Result::invalidate(
  25. Module &M, const PreservedAnalyses &PA) {
  26. // If this proxy isn't marked as preserved, then we can't even invalidate
  27. // individual CGSCC analyses, there may be an invalid set of SCC objects in
  28. // the cache making it impossible to incrementally preserve them.
  29. // Just clear the entire manager.
  30. if (!PA.preserved(ID()))
  31. CGAM->clear();
  32. // Return false to indicate that this result is still a valid proxy.
  33. return false;
  34. }
  35. char ModuleAnalysisManagerCGSCCProxy::PassID;
  36. char FunctionAnalysisManagerCGSCCProxy::PassID;
  37. FunctionAnalysisManagerCGSCCProxy::Result
  38. FunctionAnalysisManagerCGSCCProxy::run(LazyCallGraph::SCC &C) {
  39. assert(FAM->empty() && "Function analyses ran prior to the CGSCC proxy!");
  40. return Result(*FAM);
  41. }
  42. FunctionAnalysisManagerCGSCCProxy::Result::~Result() {
  43. // Clear out the analysis manager if we're being destroyed -- it means we
  44. // didn't even see an invalidate call when we got invalidated.
  45. FAM->clear();
  46. }
  47. bool FunctionAnalysisManagerCGSCCProxy::Result::invalidate(
  48. LazyCallGraph::SCC &C, const PreservedAnalyses &PA) {
  49. // If this proxy isn't marked as preserved, then we can't even invalidate
  50. // individual function analyses, there may be an invalid set of Function
  51. // objects in the cache making it impossible to incrementally preserve them.
  52. // Just clear the entire manager.
  53. if (!PA.preserved(ID()))
  54. FAM->clear();
  55. // Return false to indicate that this result is still a valid proxy.
  56. return false;
  57. }
  58. char CGSCCAnalysisManagerFunctionProxy::PassID;