clang 23.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 /// If the function has an OMPDeclareTargetDeclAttr, set the corresponding
52 /// omp.declare_target attribute on the emitted cir.func op.
53 void emitDeclareTargetFunction(const FunctionDecl *fd, cir::FuncOp funcOp);
54};
55
56} // namespace clang::CIRGen
57
58#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...
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:2015
GlobalDecl - represents a global declaration.
Definition GlobalDecl.h:57