16c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne//===----- CGCUDARuntime.h - Interface to CUDA Runtimes ---------*- C++ -*-===//
26c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne//
36c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne//                     The LLVM Compiler Infrastructure
46c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne//
56c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne// This file is distributed under the University of Illinois Open Source
66c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne// License. See LICENSE.TXT for details.
76c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne//
86c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne//===----------------------------------------------------------------------===//
96c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne//
106c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne// This provides an abstract class for CUDA code generation.  Concrete
116c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne// subclasses of this implement code generation for specific CUDA
126c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne// runtime libraries.
136c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne//
146c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne//===----------------------------------------------------------------------===//
156c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
166c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne#ifndef CLANG_CODEGEN_CUDARUNTIME_H
176c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne#define CLANG_CODEGEN_CUDARUNTIME_H
186c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
196c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbournenamespace clang {
206c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
216c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourneclass CUDAKernelCallExpr;
226c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
236c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbournenamespace CodeGen {
246c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
256c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourneclass CodeGenFunction;
266c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourneclass CodeGenModule;
27a4ae2294b6ebfb2554aacb6a6a0682fb5ed1f276Peter Collingbourneclass FunctionArgList;
286c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourneclass ReturnValueSlot;
296c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourneclass RValue;
306c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
316c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourneclass CGCUDARuntime {
326c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourneprotected:
336c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne  CodeGenModule &CGM;
346c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
356c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbournepublic:
366c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne  CGCUDARuntime(CodeGenModule &CGM) : CGM(CGM) {}
376c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne  virtual ~CGCUDARuntime();
386c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
396c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne  virtual RValue EmitCUDAKernelCallExpr(CodeGenFunction &CGF,
406c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne                                        const CUDAKernelCallExpr *E,
416c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne                                        ReturnValueSlot ReturnValue);
426c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
43a4ae2294b6ebfb2554aacb6a6a0682fb5ed1f276Peter Collingbourne  virtual void EmitDeviceStubBody(CodeGenFunction &CGF,
44a4ae2294b6ebfb2554aacb6a6a0682fb5ed1f276Peter Collingbourne                                  FunctionArgList &Args) = 0;
45a4ae2294b6ebfb2554aacb6a6a0682fb5ed1f276Peter Collingbourne
466c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne};
476c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
486c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne/// Creates an instance of a CUDA runtime class.
496c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter CollingbourneCGCUDARuntime *CreateNVCUDARuntime(CodeGenModule &CGM);
506c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
516c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne}
526c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne}
536c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne
546c0aa5ff6e6253db0f993053599e2a52b5b93b2dPeter Collingbourne#endif
55