[PATCH] [OPENMP] Initial codegen for 'omp sections' and 'omp section' directives.

Alexey Bataev a.bataev at hotmail.com
Wed Mar 11 02:29:34 PDT 2015


Hi rjmccall, hfinkel, fraggamuffin, ejstotzer,

If only one section is found in the sections region, it is emitted just like single region.
Otherwise it is emitted as a static non-chunked loop.
```
#pragma omp sections
{
#pragma omp section
{1}
...
#pragma omp section
{n}
}
```
is translated to something like
```
i32 <iter_var>
i32 <last_iter> = 0
i32 <lower_bound> = 0
i32 <upper_bound> = n-1
i32 <stride> = 1
call void @__kmpc_for_static_init_4(<loc>, i32 <gtid>, i32 34/*static non-chunked*/, i32* <last_iter>, i32* <lower_bound>, i32* <upper_bound>, i32* <stride>, i32 1/*increment always 1*/, i32 1/*chunk always 1*/)
<upper_bound> = min(<upper_bound>, n-1)
<iter_var> = <lb>
check:
br <iter_var> <= <upper_bound>, label cont, label exit
continue:
switch (IV) {
case 0:
{1};
break;
...
case <NumSection> - 1:
{n};
break;
}
++<iter_var>
br label check
exit:
call void @__kmpc_for_static_fini(<loc>, i32 <gtid>)
```

http://reviews.llvm.org/D8244

Files:
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  test/OpenMP/sections_codegen.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8244.21681.patch
Type: text/x-patch
Size: 14276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150311/94eb5c2a/attachment.bin>


More information about the cfe-commits mailing list