The task region is emmitted in several steps:
- Emit a call to kmp_task_t *__kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds, kmp_routine_entry_t *task_entry). Here task_entry is a pointer to the function:
kmp_int32 .omp_task_entry.(kmp_int32 gtid, kmp_task_t *tt) { TaskFunction(gtid, tt->part_id, tt->shareds); return 0; }
- Copy a list of shared variables to field shareds of the resulting structure kmp_task_t returned by the previous call (if any).
- Copy a pointer to destructions function to field destructions of the resulting structure kmp_task_t.
- Emit a call to kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t *new_task), where new_task is a resulting structure from previous items.