| Peter Collingbourne | fe88342 | 2011-10-06 18:29:37 +0000 | [diff] [blame] | 1 | //===----- CGCUDARuntime.cpp - Interface to CUDA Runtimes -----------------===// | 
|  | 2 | // | 
|  | 3 | //                     The LLVM Compiler Infrastructure | 
|  | 4 | // | 
|  | 5 | // This file is distributed under the University of Illinois Open Source | 
|  | 6 | // License. See LICENSE.TXT for details. | 
|  | 7 | // | 
|  | 8 | //===----------------------------------------------------------------------===// | 
|  | 9 | // | 
|  | 10 | // This provides an abstract class for CUDA code generation.  Concrete | 
|  | 11 | // subclasses of this implement code generation for specific CUDA | 
|  | 12 | // runtime libraries. | 
|  | 13 | // | 
|  | 14 | //===----------------------------------------------------------------------===// | 
|  | 15 |  | 
|  | 16 | #include "CGCUDARuntime.h" | 
| Peter Collingbourne | fe88342 | 2011-10-06 18:29:37 +0000 | [diff] [blame] | 17 | #include "CGCall.h" | 
|  | 18 | #include "CodeGenFunction.h" | 
| Chandler Carruth | 3a02247 | 2012-12-04 09:13:33 +0000 | [diff] [blame] | 19 | #include "clang/AST/Decl.h" | 
|  | 20 | #include "clang/AST/ExprCXX.h" | 
| Peter Collingbourne | fe88342 | 2011-10-06 18:29:37 +0000 | [diff] [blame] | 21 |  | 
|  | 22 | using namespace clang; | 
|  | 23 | using namespace CodeGen; | 
|  | 24 |  | 
| Angel Garcia Gomez | 637d1e6 | 2015-10-20 13:23:58 +0000 | [diff] [blame] | 25 | CGCUDARuntime::~CGCUDARuntime() {} | 
| Peter Collingbourne | fe88342 | 2011-10-06 18:29:37 +0000 | [diff] [blame] | 26 |  | 
|  | 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"); | 
|  | 32 |  | 
|  | 33 | CodeGenFunction::ConditionalEvaluation eval(CGF); | 
| Justin Bogner | ef512b9 | 2014-01-06 22:27:43 +0000 | [diff] [blame] | 34 | CGF.EmitBranchOnBoolExpr(E->getConfig(), ContBlock, ConfigOKBlock, | 
|  | 35 | /*TrueCount=*/0); | 
| Peter Collingbourne | fe88342 | 2011-10-06 18:29:37 +0000 | [diff] [blame] | 36 |  | 
|  | 37 | eval.begin(CGF); | 
|  | 38 | CGF.EmitBlock(ConfigOKBlock); | 
| John McCall | b92ab1a | 2016-10-26 23:46:34 +0000 | [diff] [blame] | 39 | CGF.EmitSimpleCallExpr(E, ReturnValue); | 
| Peter Collingbourne | fe88342 | 2011-10-06 18:29:37 +0000 | [diff] [blame] | 40 | CGF.EmitBranch(ContBlock); | 
|  | 41 |  | 
|  | 42 | CGF.EmitBlock(ContBlock); | 
|  | 43 | eval.end(CGF); | 
|  | 44 |  | 
| Craig Topper | 8a13c41 | 2014-05-21 05:09:00 +0000 | [diff] [blame] | 45 | return RValue::get(nullptr); | 
| Peter Collingbourne | fe88342 | 2011-10-06 18:29:37 +0000 | [diff] [blame] | 46 | } |