clang 24.0.0git
CIRGenOpenMPRuntime.h
Go to the documentation of this file.
1//===--- CIRGenOpenMPRuntime.h - OpenMP code generation helpers -----------===//
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_CLANG_LIB_CIR_CODEGEN_CIRGENOPENMPRUNTIME_H
10#define LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENOPENMPRUNTIME_H
11
16#include "llvm/ADT/DenseSet.h"
17
18namespace clang::CIRGen {
19
20class CIRGenModule;
21
23 CIRGenModule &cgm;
24
25 /// Declarations that have been force-emitted for the target device because
26 /// they are transitively referenced from declare target functions.
27 llvm::DenseSet<CanonicalDeclPtr<const Decl>> alreadyEmittedTargetDecls;
28
29 /// Returns false if the given function or declare reduction should be
30 /// emitted. Returns true if it should eb skipped.
31 /// emission).
32 bool emitTargetFunctions(GlobalDecl gd);
33
34 /// Returns false if given global variable should be emitted. Returns
35 /// true if it should be skipped.
36 bool emitTargetGlobalVariable(GlobalDecl gd);
37
38public:
39 explicit CIRGenOpenMPRuntime(CIRGenModule &cgm) : cgm(cgm) {}
40
41 /// Check whether the given GlobalDecl needs special handling for device
42 /// compilation. Returns false if it should be emitted, true if it should be
43 /// skipped.
45
46 /// Mark a function reference as one that should be emitted on the device.
47 /// Returns false if it should be emitted, true if the function is already
48 /// handled and should be skipped.
50
51 /// Register a global variable that may need an offload entry.
53
54 /// Return whether unified shared memory is required.
56
57 /// If the function has an OMPDeclareTargetDeclAttr, set the corresponding
58 /// omp.declare_target attribute on the emitted cir.func op.
59 void emitDeclareTargetFunction(const FunctionDecl *fd, cir::FuncOp funcOp);
60};
61
62} // namespace clang::CIRGen
63
64#endif // LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENOPENMPRUNTIME_H
This file defines OpenMP nodes for declarative directives.
This file defines OpenMP AST classes for executable directives and clauses.
This class organizes the cross-function state that is used while generating CIR code.
void emitDeclareTargetFunction(const FunctionDecl *fd, cir::FuncOp funcOp)
If the function has an OMPDeclareTargetDeclAttr, set the corresponding omp.declare_target attribute o...
void registerTargetGlobalVariable(const VarDecl *vd)
Register a global variable that may need an offload entry.
bool hasRequiresUnifiedSharedMemory() const
Return whether unified shared memory is required.
bool emitTargetGlobal(GlobalDecl gd)
Check whether the given GlobalDecl needs special handling for device compilation.
bool markAsGlobalTarget(GlobalDecl gd)
Mark a function reference as one that should be emitted on the device.
Represents a function declaration or definition.
Definition Decl.h:2082
GlobalDecl - represents a global declaration.
Definition GlobalDecl.h:60
Represents a variable declaration or definition.
Definition Decl.h:934