2011-10-07 02:29:37 +08:00
|
|
|
//===----- CGCUDARuntime.cpp - Interface to CUDA Runtimes -----------------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2011-10-07 02:29:37 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This provides an abstract class for CUDA code generation. Concrete
|
|
|
|
// subclasses of this implement code generation for specific CUDA
|
|
|
|
// runtime libraries.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "CGCUDARuntime.h"
|
|
|
|
#include "CGCall.h"
|
|
|
|
#include "CodeGenFunction.h"
|
2012-12-04 17:13:33 +08:00
|
|
|
#include "clang/AST/Decl.h"
|
|
|
|
#include "clang/AST/ExprCXX.h"
|
2011-10-07 02:29:37 +08:00
|
|
|
|
|
|
|
using namespace clang;
|
|
|
|
using namespace CodeGen;
|
|
|
|
|
2015-10-20 21:23:58 +08:00
|
|
|
CGCUDARuntime::~CGCUDARuntime() {}
|
2011-10-07 02:29:37 +08:00
|
|
|
|
|
|
|
RValue CGCUDARuntime::EmitCUDAKernelCallExpr(CodeGenFunction &CGF,
|
|
|
|
const CUDAKernelCallExpr *E,
|
|
|
|
ReturnValueSlot ReturnValue) {
|
|
|
|
llvm::BasicBlock *ConfigOKBlock = CGF.createBasicBlock("kcall.configok");
|
|
|
|
llvm::BasicBlock *ContBlock = CGF.createBasicBlock("kcall.end");
|
|
|
|
|
|
|
|
CodeGenFunction::ConditionalEvaluation eval(CGF);
|
2014-01-07 06:27:43 +08:00
|
|
|
CGF.EmitBranchOnBoolExpr(E->getConfig(), ContBlock, ConfigOKBlock,
|
|
|
|
/*TrueCount=*/0);
|
2011-10-07 02:29:37 +08:00
|
|
|
|
|
|
|
eval.begin(CGF);
|
|
|
|
CGF.EmitBlock(ConfigOKBlock);
|
2016-10-27 07:46:34 +08:00
|
|
|
CGF.EmitSimpleCallExpr(E, ReturnValue);
|
2011-10-07 02:29:37 +08:00
|
|
|
CGF.EmitBranch(ContBlock);
|
|
|
|
|
|
|
|
CGF.EmitBlock(ContBlock);
|
|
|
|
eval.end(CGF);
|
|
|
|
|
2014-05-21 13:09:00 +08:00
|
|
|
return RValue::get(nullptr);
|
2011-10-07 02:29:37 +08:00
|
|
|
}
|