LLVM 20.0.0git
OpenMPOpt.h
Go to the documentation of this file.
1//===- IPO/OpenMPOpt.h - Collection of OpenMP optimizations -----*- 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#ifndef LLVM_TRANSFORMS_IPO_OPENMPOPT_H
10#define LLVM_TRANSFORMS_IPO_OPENMPOPT_H
11
14#include "llvm/IR/PassManager.h"
15
16namespace llvm {
17
18namespace omp {
19
20/// Summary of a kernel (=entry point for target offloading).
21using Kernel = Function *;
22
23/// Set of kernels in the module
25
26/// Helper to determine if \p M contains OpenMP.
27bool containsOpenMP(Module &M);
28
29/// Helper to determine if \p M is a OpenMP target offloading device module.
30bool isOpenMPDevice(Module &M);
31
32/// Return true iff \p Fn is an OpenMP GPU kernel; \p Fn has the "kernel"
33/// attribute.
34bool isOpenMPKernel(Function &Fn);
35
36/// Get OpenMP device kernels in \p M.
38
39} // namespace omp
40
41/// OpenMP optimizations pass.
42class OpenMPOptPass : public PassInfoMixin<OpenMPOptPass> {
43public:
44 OpenMPOptPass() = default;
45 OpenMPOptPass(ThinOrFullLTOPhase LTOPhase) : LTOPhase(LTOPhase) {}
46
48
49private:
51};
52
53class OpenMPOptCGSCCPass : public PassInfoMixin<OpenMPOptCGSCCPass> {
54public:
55 OpenMPOptCGSCCPass() = default;
56 OpenMPOptCGSCCPass(ThinOrFullLTOPhase LTOPhase) : LTOPhase(LTOPhase) {}
57
60
61private:
63};
64
65} // end namespace llvm
66
67#endif // LLVM_TRANSFORMS_IPO_OPENMPOPT_H
This header provides classes for managing passes over SCCs of the call graph.
This header defines various interfaces for pass management in LLVM.
Implements a lazy call graph analysis and related passes for the new pass manager.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
An SCC of the call graph.
A lazily constructed view of the call graph of a module.
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, LazyCallGraph &CG, CGSCCUpdateResult &UR)
Definition: OpenMPOpt.cpp:5837
OpenMPOptCGSCCPass(ThinOrFullLTOPhase LTOPhase)
Definition: OpenMPOpt.h:56
OpenMP optimizations pass.
Definition: OpenMPOpt.h:42
OpenMPOptPass()=default
OpenMPOptPass(ThinOrFullLTOPhase LTOPhase)
Definition: OpenMPOpt.h:45
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
Definition: OpenMPOpt.cpp:5724
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
A vector that has set insertion semantics.
Definition: SetVector.h:57
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
bool isOpenMPDevice(Module &M)
Helper to determine if M is a OpenMP target offloading device module.
Definition: OpenMPOpt.cpp:5952
bool containsOpenMP(Module &M)
Helper to determine if M contains OpenMP.
Definition: OpenMPOpt.cpp:5944
KernelSet getDeviceKernels(Module &M)
Get OpenMP device kernels in M.
Definition: OpenMPOpt.cpp:5912
bool isOpenMPKernel(Function &Fn)
Return true iff Fn is an OpenMP GPU kernel; Fn has the "kernel" attribute.
Definition: OpenMPOpt.cpp:5908
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
Definition: Pass.h:76
@ None
No LTO/ThinLTO behavior needed.
Support structure for SCC passes to communicate updates the call graph back to the CGSCC pass manager...
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69