This patch adds semantic checks for atomic capture construct.
Depends on D127620
Paths
| Differential D126612
[flang][OpenMP] Added semantic checks for atomic capture construct Changes PlannedPublic Authored by NimishMishra on May 29 2022, 4:46 AM.
Details Summary This patch adds semantic checks for atomic capture construct. Depends on D127620
Diff Detail
Event TimelineNimishMishra added reviewers: shraiysh, kiranchandramohan, kiranktp, peixin, MatsPetersson.May 29 2022, 5:55 AM Comment ActionsThere are still some semantic checks left. I will cover them in a separate patch Comment Actions Two minor comments at the moment. Will review it later this week.
Comment Actions Can you split this patch? The small patch with single function is easier to review. If there are multiple checks with similar style, you can put them together.
check "write statement is of the form x = expr if atomic construct is write"
check "operator must refer to the intrinsic operator and not to a user-defined operator" Or even split point 2 into three small patches.
Comment Actions
Sure. Working on splitting this patch's contents across multiple smaller patches NimishMishra retitled this revision from [flang][OpenMP] Add OpenMP 5.0 based semantic checks for atomic construct to [flang][OpenMP] Added semantic checks for atomic capture construct. NimishMishra added a parent revision: D127620: [flang][OpenMP] Added semantic checks for atomic capture, write, and update statements.
Comment Actions The design of this solution could be improved. Following whatever reviews come in https://reviews.llvm.org/D127272, we can use the same basic structural checks from that patch here to understand what the statements 1 and 2 of the atomic capture construct actually are (among read/write/update statements). That would remove dependence on global boolean flags, which don't look good design wise.
Revision Contents
Diff 447287 flang/include/flang/Parser/parse-tree.h
flang/lib/Semantics/check-omp-structure.h
flang/lib/Semantics/check-omp-structure.cpp
flang/test/Semantics/OpenMP/omp-atomic-assignment-stmt.f90
|
I have an idea here that could potentially ease lowering of atomic capture construct. To lower such constructs, we need to know what the two statements are before we can create operations for them.
My idea was if we could introduce attributes as these in the parse-tree node itself which shall be filled in during semantics. Then during lowering, we just look at Stmt1Type and Stmt2Type and create required operations for the two statements of capture construct.
The only caveat is that the node is const at the point where OmpStructureChecker is instantiated. Any ideas on how to go about this problem will greatly help.