@@ -7524,6 +7524,9 @@ class MappableExprsHandler {
75247524 // types below. The generated information is expressed in this order:
75257525 // base pointer, section pointer, size, flags
75267526 // (to add to the ones that come from the map type and modifier).
7527+ // Entries annotated with (+) are only generated for "target" constructs,
7528+ // and only if the variable at the beginning of the expression is used in
7529+ // the region.
75277530 //
75287531 // double d;
75297532 // int i[100];
@@ -7539,6 +7542,7 @@ class MappableExprsHandler {
75397542 // float f[50];
75407543 // S1 s;
75417544 // double *p;
7545+ // double *&pref;
75427546 // struct S2 *ps;
75437547 // int &ref;
75447548 // }
@@ -7558,22 +7562,36 @@ class MappableExprsHandler {
75587562 // &p, &p, sizeof(float*), TARGET_PARAM | TO | FROM
75597563 //
75607564 // map(p[1:24])
7561- // p, &p[1], 24*sizeof(float), TARGET_PARAM | TO | FROM
7562- // &p, &p[1], sizeof(p), ATTACH
7565+ // p, &p[1], 24*sizeof(float), TARGET_PARAM | TO | FROM // map pointee
7566+ // &p, &p[1], sizeof(void*), ATTACH // attach pointer/pointee, if both
7567+ // // are present, and either is new
75637568 //
75647569 // map((22])p)
75657570 // p, p, 22*sizeof(float), TARGET_PARAM | TO | FROM
7566- // &p, p, sizeof(float *), ATTACH
7571+ // &p, p, sizeof(void *), ATTACH
75677572 //
75687573 // map((*a)[0:3])
7569- // &(*a), &(*a), sizeof(pointer), TARGET_PARAM | TO | FROM
7570- // &(*a), &(*a)[0], 3*sizeof(int), PTR_AND_OBJ | TO | FROM
7574+ // a, a, 0, TARGET_PARAM | IMPLICIT // (+)
7575+ // &a, a, sizeof(void*), ATTACH // (+)
7576+ // (*a)[0], &(*a)[0], 3 * sizeof(int), TO | FROM
7577+ // &(*a), &(*a)[0], sizeof(void*), ATTACH
7578+ // (+) Only on target, if a is used in the region
7579+ // Note: Since the attach base-pointer is `*a`, which is not a scalar
7580+ // variable, it doesn't determine the clause on `a`. `a` is mapped using
7581+ // a zero-length-array-section map by generateDefaultMapInfo, if it is
7582+ // referenced in the target region, because it is a pointer.
75717583 //
75727584 // map(**a)
7573- // &(*a), &(*a), sizeof(pointer), TARGET_PARAM | TO | FROM
7574- // &(*a), &(**a), sizeof(int), PTR_AND_OBJ | TO | FROM
7585+ // a, a, 0, TARGET_PARAM | IMPLICIT // (+)
7586+ // &a, a, sizeof(void*), ATTACH // (+)
7587+ // &(*a)[0], &(*a)[0], sizeof(int), TO | FROM
7588+ // &(*a), &(*a)[0], sizeof(void*), ATTACH
7589+ // (+) Only on target, if a is used in the region
75757590 //
75767591 // map(s)
7592+ // FIXME: This needs to also imply map(ref_ptr_ptee: s.ref), since the
7593+ // effect is supposed to be same as if the user had a map for every element
7594+ // of the struct. We currently do a shallow-map of s.
75777595 // &s, &s, sizeof(S2), TARGET_PARAM | TO | FROM
75787596 //
75797597 // map(s.i)
@@ -7586,54 +7604,60 @@ class MappableExprsHandler {
75867604 // &s, &(s.p), sizeof(double*), TARGET_PARAM | TO | FROM
75877605 //
75887606 // map(to: s.p[:22])
7589- // &s, &(s.p), sizeof(double*), TARGET_PARAM (*)
7590- // &s, &(s.p), sizeof(double*), MEMBER_OF(1) (**)
7591- // &(s.p), &(s.p[0]), 22*sizeof(double),
7592- // MEMBER_OF(1) | PTR_AND_OBJ | TO (***)
7593- // (*) alloc space for struct members, only this is a target parameter
7594- // (**) map the pointer (nothing to be mapped in this example) (the compiler
7595- // optimizes this entry out, same in the examples below)
7596- // (***) map the pointee (map: to)
7607+ // &s, &(s.p), sizeof(double*), TARGET_PARAM | IMPLICIT // (+)
7608+ // &(s.p[0]), &(s.p[0]), 22 * sizeof(double*), TO | FROM
7609+ // &(s.p), &(s.p[0]), sizeof(void*), ATTACH
75977610 //
75987611 // map(to: s.ref)
7599- // &s, &(s.ref), sizeof(int*), TARGET_PARAM (*)
7600- // &s, &(s.ref), sizeof(int), MEMBER_OF(1) | PTR_AND_OBJ | TO (***)
7601- // (*) alloc space for struct members, only this is a target parameter
7612+ // &s, &(ptr( s.ref) ), sizeof(int*), TARGET_PARAM (*)
7613+ // &s, &(ptee( s.ref) ), sizeof(int), MEMBER_OF(1) | PTR_AND_OBJ | TO (***)
7614+ // (*) alloc space for struct members, only this is a target parameter.
76027615 // (**) map the pointer (nothing to be mapped in this example) (the compiler
76037616 // optimizes this entry out, same in the examples below)
76047617 // (***) map the pointee (map: to)
7618+ // Note: ptr(s.ref) represents the referring pointer of s.ref
7619+ // ptee(s.ref) represents the referenced pointee of s.ref
7620+ //
7621+ // map(to: s.pref)
7622+ // &s, &(ptr(s.pref)), sizeof(double**), TARGET_PARAM
7623+ // &s, &(ptee(s.pref)), sizeof(double*), MEMBER_OF(1) | PTR_AND_OBJ | TO
7624+ //
7625+ // map(to: s.pref[:22])
7626+ // &s, &(ptr(s.pref)), sizeof(double**), TARGET_PARAM | IMPLICIT // (+)
7627+ // &s, &(ptee(s.pref)), sizeof(double*), MEMBER_OF(1) | PTR_AND_OBJ | TO |
7628+ // FROM | IMPLICIT // (+)
7629+ // &(ptee(s.pref)[0]), &(ptee(s.pref)[0]), 22 * sizeof(double), TO
7630+ // &(ptee(s.pref)), &(ptee(s.pref)[0]), sizeof(void*), ATTACH
76057631 //
76067632 // map(s.ps)
76077633 // &s, &(s.ps), sizeof(S2*), TARGET_PARAM | TO | FROM
76087634 //
76097635 // map(from: s.ps->s.i)
7610- // &s, &(s.ps), sizeof(S2*), TARGET_PARAM
7611- // &s , &(s.ps), sizeof(S2* ), MEMBER_OF(1)
7612- // &(s.ps), &(s.ps->s.i), sizeof(int ), MEMBER_OF(1) | PTR_AND_OBJ | FROM
7636+ // &s, &(s.ps), sizeof(S2*), TARGET_PARAM | TO | FROM | IMPLICIT // (+)
7637+ // &(s.ps[0]) , &(s.ps->s.i ), sizeof(int ), FROM
7638+ // &(s.ps), &(s.ps->s.i), sizeof(void* ), ATTACH
76137639 //
76147640 // map(to: s.ps->ps)
7615- // &s, &(s.ps), sizeof(S2*), TARGET_PARAM
7616- // &s , &(s.ps), sizeof(S2*), MEMBER_OF(1)
7617- // &(s.ps), &(s.ps->ps), sizeof(S2 *), MEMBER_OF(1) | PTR_AND_OBJ | TO
7641+ // &s, &(s.ps), sizeof(S2*), TARGET_PARAM | TO | FROM | IMPLICIT // (+)
7642+ // &(s.ps[0]) , &(s.ps->ps ), sizeof(S2*), TO
7643+ // &(s.ps), &(s.ps->ps), sizeof(void *), ATTACH
76187644 //
76197645 // map(s.ps->ps->ps)
7620- // &s, &(s.ps), sizeof(S2*), TARGET_PARAM
7621- // &s, &(s.ps), sizeof(S2*), MEMBER_OF(1)
7622- // &(s.ps), &(s.ps->ps), sizeof(S2*), MEMBER_OF(1) | PTR_AND_OBJ
7623- // &(s.ps->ps), &(s.ps->ps->ps), sizeof(S2*), PTR_AND_OBJ | TO | FROM
7646+ // &s, &(s.ps), sizeof(S2*), TARGET_PARAM | TO | FROM | IMPLICIT // (+)
7647+ // &(s.ps->ps[0]), &(s.ps->ps->ps), sizeof(S2*), TO
7648+ // &(s.ps->ps), &(s.ps->ps->ps), sizeof(void*), ATTACH
76247649 //
76257650 // map(to: s.ps->ps->s.f[:22])
7626- // &s, &(s.ps), sizeof(S2*), TARGET_PARAM
7627- // &s, &(s.ps), sizeof(S2*), MEMBER_OF(1)
7628- // &(s.ps), &(s.ps->ps), sizeof(S2*), MEMBER_OF(1) | PTR_AND_OBJ
7629- // &(s.ps->ps), &(s.ps->ps->s.f[0]), 22*sizeof(float), PTR_AND_OBJ | TO
7651+ // &s, &(s.ps), sizeof(S2*), TARGET_PARAM | TO | FROM | IMPLICIT // (+)
7652+ // &(s.ps->ps[0]), &(s.ps->ps->s.f[0]), 22*sizeof(float), TO
7653+ // &(s.ps->ps), &(s.ps->ps->s.f[0]), sizeof(void*), ATTACH
76307654 //
76317655 // map(ps)
76327656 // &ps, &ps, sizeof(S2*), TARGET_PARAM | TO | FROM
76337657 //
76347658 // map(ps->i)
76357659 // ps, &(ps->i), sizeof(int), TARGET_PARAM | TO | FROM
7636- // &ps, &(ps->i), sizeof(ps ), ATTACH
7660+ // &ps, &(ps->i), sizeof(void* ), ATTACH
76377661 //
76387662 // map(ps->s.f)
76397663 // ps, &(ps->s.f[0]), 50*sizeof(float), TARGET_PARAM | TO | FROM
@@ -7644,68 +7668,76 @@ class MappableExprsHandler {
76447668 // &ps, &(ps->p), sizeof(ps), ATTACH
76457669 //
76467670 // map(to: ps->p[:22])
7647- // ps, &(ps->p), sizeof(double*), TARGET_PARAM
7648- // ps, &(ps->p), sizeof(double*), MEMBER_OF(1)
7649- // &(ps->p), &(ps->p[0]), 22*sizeof(double), MEMBER_OF(1) | PTR_AND_OBJ | TO
7671+ // ps, &(ps[0]), 0, TARGET_PARAM | IMPLICIT // (+)
7672+ // &ps, &(ps[0]), sizeof(void*), ATTACH // (+)
7673+ // &(ps->p[0]), &(ps->p[0]), 22*sizeof(double), TO
7674+ // &(ps->p), &(ps->p[0]), sizeof(void*), ATTACH
76507675 //
76517676 // map(ps->ps)
76527677 // ps, &(ps->ps), sizeof(S2*), TARGET_PARAM | TO | FROM
76537678 // &ps, &(ps->ps), sizeof(ps), ATTACH
76547679 //
76557680 // map(from: ps->ps->s.i)
7656- // ps, &(ps->ps), sizeof(S2*), TARGET_PARAM
7657- // ps, &(ps->ps), sizeof(S2*), MEMBER_OF(1)
7658- // &(ps->ps), &(ps->ps->s.i), sizeof(int), MEMBER_OF(1) | PTR_AND_OBJ | FROM
7681+ // ps, &(ps[0]), 0, TARGET_PARAM | IMPLICIT // (+)
7682+ // &ps, &(ps[0]), sizeof(void*), ATTACH // (+)
7683+ // &(ps->ps[0]), &(ps->ps->s.i), sizeof(int), FROM
7684+ // &(ps->ps), &(ps->ps->s.i), sizeof(void*), ATTACH
76597685 //
76607686 // map(from: ps->ps->ps)
7661- // ps, &(ps->ps), sizeof(S2*), TARGET_PARAM
7662- // ps, &(ps->ps), sizeof(S2*), MEMBER_OF(1)
7663- // &(ps->ps), &(ps->ps->ps), sizeof(S2*), MEMBER_OF(1) | PTR_AND_OBJ | FROM
7687+ // ps, &ps[0], 0, TARGET_PARAM | IMPLICIT // (+)
7688+ // &ps, &(ps[0]), sizeof(void*), ATTACH // (+)
7689+ // &(ps->ps[0]), &(ps->ps->ps), sizeof(S2*), FROM
7690+ // &(ps->ps), &(ps->ps->ps), sizeof(void*), ATTACH
76647691 //
76657692 // map(ps->ps->ps->ps)
7666- // ps, &(ps->ps), sizeof(S2*) , TARGET_PARAM
7667- // ps, &(ps->ps ), sizeof(S2 *), MEMBER_OF(1 )
7668- // &(ps->ps), &(ps->ps->ps), sizeof(S2*), MEMBER_OF(1) | PTR_AND_OBJ
7669- // &(ps->ps->ps), &(ps->ps->ps->ps), sizeof(S2 *), PTR_AND_OBJ | TO | FROM
7693+ // ps, &ps[0], 0 , TARGET_PARAM | IMPLICIT // (+)
7694+ // & ps, &(ps[0] ), sizeof(void *), ATTACH // (+ )
7695+ // &(ps->ps->ps[0] ), &(ps->ps->ps->ps ), sizeof(S2*), FROM
7696+ // &(ps->ps->ps), &(ps->ps->ps->ps), sizeof(void *), ATTACH
76707697 //
76717698 // map(to: ps->ps->ps->s.f[:22])
7672- // ps, &(ps->ps), sizeof(S2*) , TARGET_PARAM
7673- // ps, &(ps->ps ), sizeof(S2 *), MEMBER_OF(1 )
7674- // &(ps->ps), &(ps->ps->ps), sizeof(S2* ), MEMBER_OF(1) | PTR_AND_OBJ
7675- // &(ps->ps->ps), &(ps->ps->ps->s.f[0]), 22* sizeof(float ), PTR_AND_OBJ | TO
7699+ // ps, &ps[0], 0 , TARGET_PARAM | IMPLICIT // (+)
7700+ // & ps, &(ps[0] ), sizeof(void *), ATTACH // (+ )
7701+ // &(ps->ps->ps[0] ), &(ps->ps->ps->s.f[0] ), 22* sizeof(float ), TO
7702+ // &(ps->ps->ps), &(ps->ps->ps->s.f[0]), sizeof(void* ), ATTACH
76767703 //
76777704 // map(to: s.f[:22]) map(from: s.p[:33])
7705+ // On target, and if s is used in the region:
7706+ //
76787707 // &s, &(s.f[0]), 50*sizeof(float) + sizeof(struct S1) +
76797708 // sizeof(double*) (**), TARGET_PARAM
76807709 // &s, &(s.f[0]), 22*sizeof(float), MEMBER_OF(1) | TO
7681- // &s, &(s.p), sizeof(double*), MEMBER_OF(1)
7682- // &(s.p), &(s.p[0]), 33*sizeof(double), MEMBER_OF(1) | PTR_AND_OBJ | FROM
7710+ // &s, &(s.p), sizeof(double*), MEMBER_OF(1) | TO | FROM | IMPLICIT
7711+ // &(s.p[0]), &(s.p[0]), 33*sizeof(double), FROM
7712+ // &(s.p), &(s.p[0]), sizeof(void*), ATTACH
76837713 // (*) allocate contiguous space needed to fit all mapped members even if
76847714 // we allocate space for members not mapped (in this example,
76857715 // s.f[22..49] and s.s are not mapped, yet we must allocate space for
76867716 // them as well because they fall between &s.f[0] and &s.p)
76877717 //
7718+ // On other constructs, and, if s is not used in the region, on target:
7719+ // &s, &(s.f[0]), 22*sizeof(float), TO
7720+ // &(s.p[0]), &(s.p[0]), 33*sizeof(double), FROM
7721+ // &(s.p), &(s.p[0]), sizeof(void*), ATTACH
7722+ //
76887723 // map(from: s.f[:22]) map(to: ps->p[:33])
76897724 // &s, &(s.f[0]), 22*sizeof(float), TARGET_PARAM | FROM
7690- // ps, &(ps->p), sizeof(S2*), TARGET_PARAM
7691- // ps, &(ps->p), sizeof(double*), MEMBER_OF(2) (*)
7692- // &(ps->p), &(ps->p[0]), 33*sizeof(double), MEMBER_OF(2) | PTR_AND_OBJ | TO
7693- // (*) the struct this entry pertains to is the 2nd element in the list of
7694- // arguments, hence MEMBER_OF(2)
7725+ // &ps[0], &ps[0], 0, TARGET_PARAM | IMPLICIT // (+)
7726+ // &(ps->p[0]), &(ps->p[0]), 33*sizeof(double), TO
7727+ // &(ps->p), &(ps->p[0]), sizeof(void*), ATTACH
76957728 //
76967729 // map(from: s.f[:22], s.s) map(to: ps->p[:33])
76977730 // &s, &(s.f[0]), 50*sizeof(float) + sizeof(struct S1), TARGET_PARAM
76987731 // &s, &(s.f[0]), 22*sizeof(float), MEMBER_OF(1) | FROM
76997732 // &s, &(s.s), sizeof(struct S1), MEMBER_OF(1) | FROM
7700- // ps, &(ps->p), sizeof(S2*), TARGET_PARAM
7701- // ps, &(ps->p), sizeof(double*), MEMBER_OF(4) (*)
7702- // &(ps->p), &(ps->p[0]), 33*sizeof(double), MEMBER_OF(4) | PTR_AND_OBJ | TO
7703- // (*) the struct this entry pertains to is the 4th element in the list
7704- // of arguments, hence MEMBER_OF(4)
7733+ // ps, &ps[0], 0, TARGET_PARAM | IMPLICIT // (+)
7734+ // &ps, &(ps[0]), sizeof(void*), ATTACH // (+)
7735+ // &(ps->p[0]), &(ps->p[0]), 33*sizeof(double), TO
7736+ // &(ps->p), &(ps->p[0]), sizeof(void*), ATTACH
77057737 //
7706- // map(p, p [:100])
7738+ // map(p[:100], p )
77077739 // &p, &p, sizeof(float*), TARGET_PARAM | TO | FROM
7708- // &p[0] , &p[0], 100*sizeof(float), TO | FROM
7740+ // p , &p[0], 100*sizeof(float), TO | FROM
77097741 // &p, &p[0], sizeof(float*), ATTACH
77107742
77117743 // Track if the map information being generated is the first for a capture.
0 commit comments