diff options
| author | Tobias Grosser <tobias@grosser.es> | 2016-07-28 06:47:59 +0000 |
|---|---|---|
| committer | Tobias Grosser <tobias@grosser.es> | 2016-07-28 06:47:59 +0000 |
| commit | d8b94bcac1e43a3ccd9a3d94199026e7bfb921eb (patch) | |
| tree | 24b64d65ac948d7d5ff5187ee3aeba9456be2864 /polly/lib/CodeGen/PPCGCodeGeneration.cpp | |
| parent | a490147c908272a85285a658850ca47949773b9d (diff) | |
| download | bcm5719-llvm-d8b94bcac1e43a3ccd9a3d94199026e7bfb921eb.tar.gz bcm5719-llvm-d8b94bcac1e43a3ccd9a3d94199026e7bfb921eb.zip | |
GPGPU: Pass context parameters to GPU kernel
llvm-svn: 276963
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
| -rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index f8cf3b78515..955aaac08b4 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -929,6 +929,24 @@ Value *GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel, Index++; } + int NumVars = isl_space_dim(Kernel->space, isl_dim_param); + + for (long i = 0; i < NumVars; i++) { + isl_id *Id = isl_space_get_dim_id(Kernel->space, isl_dim_param, i); + Value *Val = IDToValue[Id]; + isl_id_free(Id); + Instruction *Param = new AllocaInst( + Val->getType(), Launch + "_param_" + std::to_string(Index), + EntryBlock->getTerminator()); + Builder.CreateStore(Val, Param); + Value *Slot = Builder.CreateGEP( + Parameters, {Builder.getInt64(0), Builder.getInt64(Index)}); + Value *ParamTyped = + Builder.CreatePointerCast(Param, Builder.getInt8PtrTy()); + Builder.CreateStore(ParamTyped, Slot); + Index++; + } + auto Location = EntryBlock->getTerminator(); return new BitCastInst(Parameters, Builder.getInt8PtrTy(), Launch + "_params_i8ptr", Location); |

