Path: blob/main/contrib/llvm-project/clang/lib/CodeGen/CGCUDARuntime.cpp
35233 views
//===----- CGCUDARuntime.cpp - Interface to CUDA Runtimes -----------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This provides an abstract class for CUDA code generation. Concrete9// subclasses of this implement code generation for specific CUDA10// runtime libraries.11//12//===----------------------------------------------------------------------===//1314#include "CGCUDARuntime.h"15#include "CGCall.h"16#include "CodeGenFunction.h"17#include "clang/AST/Decl.h"18#include "clang/AST/ExprCXX.h"1920using namespace clang;21using namespace CodeGen;2223CGCUDARuntime::~CGCUDARuntime() {}2425RValue CGCUDARuntime::EmitCUDAKernelCallExpr(CodeGenFunction &CGF,26const CUDAKernelCallExpr *E,27ReturnValueSlot ReturnValue) {28llvm::BasicBlock *ConfigOKBlock = CGF.createBasicBlock("kcall.configok");29llvm::BasicBlock *ContBlock = CGF.createBasicBlock("kcall.end");3031CodeGenFunction::ConditionalEvaluation eval(CGF);32CGF.EmitBranchOnBoolExpr(E->getConfig(), ContBlock, ConfigOKBlock,33/*TrueCount=*/0);3435eval.begin(CGF);36CGF.EmitBlock(ConfigOKBlock);37CGF.EmitSimpleCallExpr(E, ReturnValue);38CGF.EmitBranch(ContBlock);3940CGF.EmitBlock(ContBlock);41eval.end(CGF);4243return RValue::get(nullptr);44}454647