summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/PPCGCodeGeneration.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2016-07-28 06:47:56 +0000
committerTobias Grosser <tobias@grosser.es>2016-07-28 06:47:56 +0000
commita490147c908272a85285a658850ca47949773b9d (patch)
treed63612e2db9866ccd22a4b08136d079ad97e77da /polly/lib/CodeGen/PPCGCodeGeneration.cpp
parent44143bb927ce58beabd92adbd4115364a4c093c4 (diff)
downloadbcm5719-llvm-a490147c908272a85285a658850ca47949773b9d.tar.gz
bcm5719-llvm-a490147c908272a85285a658850ca47949773b9d.zip
GPGPU: Pass host iterators to kernel
llvm-svn: 276962
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
-rw-r--r--polly/lib/CodeGen/PPCGCodeGeneration.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index 3a6b80b75a3..f8cf3b78515 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -911,6 +911,24 @@ Value *GPUNodeBuilder::createLaunchParameters(ppcg_kernel *Kernel,
Index++;
}
+ int NumHostIters = isl_space_dim(Kernel->space, isl_dim_set);
+
+ for (long i = 0; i < NumHostIters; i++) {
+ isl_id *Id = isl_space_get_dim_id(Kernel->space, isl_dim_set, 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);
OpenPOWER on IntegriCloud