This patch implements code generation for the teams directive. It only provides support for num_teams and thread_limit clauses, while all other clauses will come with later patches.
Details
Diff Detail
Event Timeline
lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
4378–4398 | I don't like the idea of processing num_teams and thread_limit clauses in runtime lib. This must be done in emitCommonOMPTeamsDirective(), not in runtime | |
4413–4424 | This is very similar to emitParallelOutlinedFunction(). Maybe it is a good idea to join them into a single one? |
Apply changes to reflect review: have a single emit outlined function call for both parallel and teams; call push_num_teams outside of runtime class.
I updated the patch to reflect the comments. I will wait for an answer to the comment asking to split the emit function for push_num_teams. Thanks!
lib/CodeGen/CGOpenMPRuntime.h | ||
---|---|---|
1009–1015 | I do not understand this: thread_limit and num_teams can only be input to the library function kmpc_push_num_teams, which accepts values corresponding to those two parameters. |
lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
4389–4394 | What is this? Copy-paste? | |
4395–4396 | This must be checked at the start of the function | |
lib/CodeGen/CGOpenMPRuntime.h | ||
1009–1015 | Ok, just missed it. | |
lib/CodeGen/CGStmtOpenMP.cpp | ||
2708–2709 | These vars must be declared inside 'if' stmt for clauses. | |
2741 | I don't think we need this comment now. |
lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
4389–4394 | Yes, it is - sorry! |
This must be split in 2 functions: emitNumTeamsClause() and emitThreadLimitClause().