1 //===----- CGCUDARuntime.cpp - Interface to CUDA Runtimes -----------------===//
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 #include "CGCUDARuntime.h"
18 #include "CodeGenFunction.h"
19 #include "clang/AST/Decl.h"
20 #include "clang/AST/ExprCXX.h"
22 using namespace clang;
23 using namespace CodeGen;
25 CGCUDARuntime::~CGCUDARuntime() {}
27 RValue CGCUDARuntime::EmitCUDAKernelCallExpr(CodeGenFunction &CGF,
28 const CUDAKernelCallExpr *E,
29 ReturnValueSlot ReturnValue) {
30 llvm::BasicBlock *ConfigOKBlock = CGF.createBasicBlock("kcall.configok");
31 llvm::BasicBlock *ContBlock = CGF.createBasicBlock("kcall.end");
33 CodeGenFunction::ConditionalEvaluation eval(CGF);
34 CGF.EmitBranchOnBoolExpr(E->getConfig(), ContBlock, ConfigOKBlock,
38 CGF.EmitBlock(ConfigOKBlock);
39 CGF.EmitSimpleCallExpr(E, ReturnValue);
40 CGF.EmitBranch(ContBlock);
42 CGF.EmitBlock(ContBlock);
45 return RValue::get(nullptr);