1 //===----- CGCUDARuntime.cpp - Interface to CUDA Runtimes -----------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This provides an abstract class for CUDA code generation. Concrete
10 // subclasses of this implement code generation for specific CUDA
13 //===----------------------------------------------------------------------===//
15 #include "CGCUDARuntime.h"
17 #include "CodeGenFunction.h"
18 #include "clang/AST/Decl.h"
19 #include "clang/AST/ExprCXX.h"
21 using namespace clang
;
22 using namespace CodeGen
;
24 CGCUDARuntime::~CGCUDARuntime() {}
26 RValue
CGCUDARuntime::EmitCUDAKernelCallExpr(CodeGenFunction
&CGF
,
27 const CUDAKernelCallExpr
*E
,
28 ReturnValueSlot ReturnValue
) {
29 llvm::BasicBlock
*ConfigOKBlock
= CGF
.createBasicBlock("kcall.configok");
30 llvm::BasicBlock
*ContBlock
= CGF
.createBasicBlock("kcall.end");
32 CodeGenFunction::ConditionalEvaluation
eval(CGF
);
33 CGF
.EmitBranchOnBoolExpr(E
->getConfig(), ContBlock
, ConfigOKBlock
,
37 CGF
.EmitBlock(ConfigOKBlock
);
38 CGF
.EmitSimpleCallExpr(E
, ReturnValue
);
39 CGF
.EmitBranch(ContBlock
);
41 CGF
.EmitBlock(ContBlock
);
44 return RValue::get(nullptr);