/home/runner/work/DirectXShaderCompiler/DirectXShaderCompiler/tools/clang/lib/CodeGen/CGCUDARuntime.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===----- CGCUDARuntime.h - Interface to CUDA Runtimes ---------*- C++ -*-===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | // |
10 | | // This provides an abstract class for CUDA code generation. Concrete |
11 | | // subclasses of this implement code generation for specific CUDA |
12 | | // runtime libraries. |
13 | | // |
14 | | //===----------------------------------------------------------------------===// |
15 | | |
16 | | #ifndef LLVM_CLANG_LIB_CODEGEN_CGCUDARUNTIME_H |
17 | | #define LLVM_CLANG_LIB_CODEGEN_CGCUDARUNTIME_H |
18 | | |
19 | | namespace llvm { |
20 | | class Function; |
21 | | } |
22 | | |
23 | | namespace clang { |
24 | | |
25 | | class CUDAKernelCallExpr; |
26 | | |
27 | | namespace CodeGen { |
28 | | |
29 | | class CodeGenFunction; |
30 | | class CodeGenModule; |
31 | | class FunctionArgList; |
32 | | class ReturnValueSlot; |
33 | | class RValue; |
34 | | |
35 | | class CGCUDARuntime { |
36 | | protected: |
37 | | CodeGenModule &CGM; |
38 | | |
39 | | public: |
40 | 0 | CGCUDARuntime(CodeGenModule &CGM) : CGM(CGM) {} |
41 | | virtual ~CGCUDARuntime(); |
42 | | |
43 | | virtual RValue EmitCUDAKernelCallExpr(CodeGenFunction &CGF, |
44 | | const CUDAKernelCallExpr *E, |
45 | | ReturnValueSlot ReturnValue); |
46 | | |
47 | | /// Emits a kernel launch stub. |
48 | | virtual void emitDeviceStub(CodeGenFunction &CGF, FunctionArgList &Args) = 0; |
49 | | |
50 | | /// Constructs and returns a module initialization function or nullptr if it's |
51 | | /// not needed. Must be called after all kernels have been emitted. |
52 | | virtual llvm::Function *makeModuleCtorFunction() = 0; |
53 | | |
54 | | /// Returns a module cleanup function or nullptr if it's not needed. |
55 | | /// Must be called after ModuleCtorFunction |
56 | | virtual llvm::Function *makeModuleDtorFunction() = 0; |
57 | | }; |
58 | | |
59 | | /// Creates an instance of a CUDA runtime class. |
60 | | CGCUDARuntime *CreateNVCUDARuntime(CodeGenModule &CGM); |
61 | | |
62 | | } |
63 | | } |
64 | | |
65 | | #endif |