This is an archive of the discontinued LLVM Phabricator instance.

[OPENMP] Codegen for 'omp master' directive
ClosedPublic

Authored by ABataev on Dec 1 2014, 8:43 PM.

Details

Summary

Patch adds 2 library functions to OpenMPRuntime class - int32 kmpc_master(ident_t *, int32 gtid) and void kmpc_end_master(ident_t *, int32 gtid);
For 'omp master' directive the next code is generated:

if (__kmpc_master(loc, gtid)) {
  <Associated structured block>;
  __kmpc_end_master(log, gtid);
}

Diff Detail

Event Timeline

ABataev updated this revision to Diff 16796.Dec 1 2014, 8:43 PM
ABataev retitled this revision from to [OPENMP] Codegen for 'omp master' directive.
ABataev updated this object.
ABataev edited the test plan for this revision. (Show Details)
ABataev added a subscriber: Unknown Object (MLST).
rjmccall edited edge metadata.Dec 2 2014, 11:11 AM

Generally looks good. A few comments.

lib/CodeGen/CGOpenMPRuntime.cpp
685

Please add a comment here that it's illegal to branch in or out of the master block — which I assume you're enforcing in Sema somehow — so you can just call __kmpc_end_master on fallthrough rather than pushing a normal cleanup for it.

lib/CodeGen/CGOpenMPRuntime.h
101

Please leave a trailing comma on the last enumerator. Makes a minor improvement to diffs.

Thanks for the review John! I really appreciate it!!!

lib/CodeGen/CGOpenMPRuntime.cpp
685

Yes, it is prohibited by the OpenMP spec and enforced in Sema. I'll add a comment.

lib/CodeGen/CGOpenMPRuntime.h
101

Ok

ABataev updated this revision to Diff 16853.Dec 3 2014, 12:43 AM
ABataev edited edge metadata.

Update after review

Looks good, thanks!

ABataev closed this revision.Dec 3 2014, 11:24 PM
ABataev updated this revision to Diff 16909.

Closed by commit rL223342 (authored by @ABataev).