OpenMPOpt.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- IPO/OpenMPOpt.h - Collection of OpenMP optimizations -----*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_TRANSFORMS_IPO_OPENMPOPT_H
  14. #define LLVM_TRANSFORMS_IPO_OPENMPOPT_H
  15. #include "llvm/Analysis/CGSCCPassManager.h"
  16. #include "llvm/Analysis/LazyCallGraph.h"
  17. #include "llvm/IR/PassManager.h"
  18. namespace llvm {
  19. namespace omp {
  20. /// Summary of a kernel (=entry point for target offloading).
  21. using Kernel = Function *;
  22. /// Set of kernels in the module
  23. using KernelSet = SetVector<Kernel>;
  24. /// Helper to determine if \p M contains OpenMP.
  25. bool containsOpenMP(Module &M);
  26. /// Helper to determine if \p M is a OpenMP target offloading device module.
  27. bool isOpenMPDevice(Module &M);
  28. /// Get OpenMP device kernels in \p M.
  29. KernelSet getDeviceKernels(Module &M);
  30. } // namespace omp
  31. /// OpenMP optimizations pass.
  32. class OpenMPOptPass : public PassInfoMixin<OpenMPOptPass> {
  33. public:
  34. PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
  35. };
  36. class OpenMPOptCGSCCPass : public PassInfoMixin<OpenMPOptCGSCCPass> {
  37. public:
  38. PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
  39. LazyCallGraph &CG, CGSCCUpdateResult &UR);
  40. };
  41. } // end namespace llvm
  42. #endif // LLVM_TRANSFORMS_IPO_OPENMPOPT_H
  43. #ifdef __GNUC__
  44. #pragma GCC diagnostic pop
  45. #endif