clang  3.7.0
CGCUDARuntime.h
Go to the documentation of this file.
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 
36 protected:
38 
39 public:
41  virtual ~CGCUDARuntime();
42 
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
virtual RValue EmitCUDAKernelCallExpr(CodeGenFunction &CGF, const CUDAKernelCallExpr *E, ReturnValueSlot ReturnValue)
virtual void emitDeviceStub(CodeGenFunction &CGF, FunctionArgList &Args)=0
Emits a kernel launch stub.
virtual llvm::Function * makeModuleDtorFunction()=0
virtual llvm::Function * makeModuleCtorFunction()=0
const internal::VariadicDynCastAllOfMatcher< Stmt, CUDAKernelCallExpr > CUDAKernelCallExpr
Matches CUDA kernel call expression.
Definition: ASTMatchers.h:4113
Represents a call to a CUDA kernel function.
Definition: ExprCXX.h:155
CGCUDARuntime * CreateNVCUDARuntime(CodeGenModule &CGM)
Creates an instance of a CUDA runtime class.
Definition: CGCUDANV.cpp:315
CGCUDARuntime(CodeGenModule &CGM)
Definition: CGCUDARuntime.h:40