Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. //===- ConvergenceUtils.h -----------------------*- C++ -*-----------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. /// \file
  10. /// \brief Convergence info and convergence-aware uniform info for LLVM IR
  11. ///
  12. /// This differs from traditional divergence analysis by taking convergence
  13. /// intrinsics into account.
  14. //
  15. //===----------------------------------------------------------------------===//
  16.  
  17. #ifndef LLVM_ANALYSIS_UNIFORMITYANALYSIS_H
  18. #define LLVM_ANALYSIS_UNIFORMITYANALYSIS_H
  19.  
  20. #include "llvm/ADT/GenericUniformityInfo.h"
  21. #include "llvm/Analysis/CycleAnalysis.h"
  22.  
  23. namespace llvm {
  24.  
  25. extern template class GenericUniformityInfo<SSAContext>;
  26. using UniformityInfo = GenericUniformityInfo<SSAContext>;
  27.  
  28. /// Analysis pass which computes \ref UniformityInfo.
  29. class UniformityInfoAnalysis
  30.     : public AnalysisInfoMixin<UniformityInfoAnalysis> {
  31.   friend AnalysisInfoMixin<UniformityInfoAnalysis>;
  32.   static AnalysisKey Key;
  33.  
  34. public:
  35.   /// Provide the result typedef for this analysis pass.
  36.   using Result = UniformityInfo;
  37.  
  38.   /// Run the analysis pass over a function and produce a dominator tree.
  39.   UniformityInfo run(Function &F, FunctionAnalysisManager &);
  40.  
  41.   // TODO: verify analysis
  42. };
  43.  
  44. /// Printer pass for the \c UniformityInfo.
  45. class UniformityInfoPrinterPass
  46.     : public PassInfoMixin<UniformityInfoPrinterPass> {
  47.   raw_ostream &OS;
  48.  
  49. public:
  50.   explicit UniformityInfoPrinterPass(raw_ostream &OS);
  51.  
  52.   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
  53. };
  54.  
  55. /// Legacy analysis pass which computes a \ref CycleInfo.
  56. class UniformityInfoWrapperPass : public FunctionPass {
  57.   Function *m_function = nullptr;
  58.   UniformityInfo m_uniformityInfo;
  59.  
  60. public:
  61.   static char ID;
  62.  
  63.   UniformityInfoWrapperPass();
  64.  
  65.   UniformityInfo &getUniformityInfo() { return m_uniformityInfo; }
  66.   const UniformityInfo &getUniformityInfo() const { return m_uniformityInfo; }
  67.  
  68.   bool runOnFunction(Function &F) override;
  69.   void getAnalysisUsage(AnalysisUsage &AU) const override;
  70.   void releaseMemory() override;
  71.   void print(raw_ostream &OS, const Module *M = nullptr) const override;
  72.  
  73.   // TODO: verify analysis
  74. };
  75.  
  76. } // namespace llvm
  77.  
  78. #endif // LLVM_ANALYSIS_UNIFORMITYANALYSIS_H
  79.