[LIBOMPTARGET] Add support for mapping of lambda captures.
authorAlexey Bataev <a.bataev@hotmail.com>
Tue, 30 Oct 2018 15:42:12 +0000 (15:42 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Tue, 30 Oct 2018 15:42:12 +0000 (15:42 +0000)
commite5369885dd8c925f7394207dd2752d488f0379a3
treef6cb31461b66c393921c3fb2f58b9a79fc593901
parentb12e410082d4974d930a1e9eb2e2e1c7714c66c7
[LIBOMPTARGET] Add support for mapping of lambda captures.

Summary:
Added support for correct mapping of variables captured by reference in
lambdas. That kind of mapping may appear only in target-executable
regions and must follow the original lambda or another lambda capture
for the same lambda.
The expected data: base address - the address of the lambda, begin
pointer - pointer to the address of the lambda capture, size - size of
the captured variable.
When OMP_TGT_MAPTYPE_PTR_AND_OBJ mapping type is seen in
target-executable region, the target address of the last processed item
is taken as the address of the original lambda `tgt_lambda_ptr`. Then,
the pointer to capture on the device is calculated like `tgt_lambda_ptr
+ (host_begin_pointer - host_begin_base)` and the target-based address
of the original variable (which host address is
`*(void**)begin_pointer`) is written to that pointer.

Reviewers: kkwli0, gtbercea, grokos

Subscribers: openmp-commits

Differential Revision: https://reviews.llvm.org/D51107

llvm-svn: 345608
openmp/libomptarget/src/omptarget.cpp