1 //===----- CGCUDARuntime.h - Interface to CUDA Runtimes ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This provides an abstract class for CUDA code generation. Concrete
11 // subclasses of this implement code generation for specific CUDA
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CLANG_LIB_CODEGEN_CGCUDARUNTIME_H
17 #define LLVM_CLANG_LIB_CODEGEN_CGCUDARUNTIME_H
25 class CUDAKernelCallExpr;
29 class CodeGenFunction;
31 class FunctionArgList;
32 class ReturnValueSlot;
40 CGCUDARuntime(CodeGenModule &CGM) : CGM(CGM) {}
41 virtual ~CGCUDARuntime();
43 virtual RValue EmitCUDAKernelCallExpr(CodeGenFunction &CGF,
44 const CUDAKernelCallExpr *E,
45 ReturnValueSlot ReturnValue);
47 /// Emits a kernel launch stub.
48 virtual void emitDeviceStub(CodeGenFunction &CGF, FunctionArgList &Args) = 0;
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;
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;
59 /// Creates an instance of a CUDA runtime class.
60 CGCUDARuntime *CreateNVCUDARuntime(CodeGenModule &CGM);