-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[flang][OpenMP]Add symbls omp_in, omp_out and omp_priv in DECLARE RED… #129908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
eaff8c5
df74037
2708306
05c5f83
1c8e0b9
f83bcd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2705,11 +2705,14 @@ class UnparseVisitor { | |
| Walk(std::get<std::list<ActualArgSpec>>(x.t)); | ||
| Put(")"); | ||
| } | ||
| void Unparse(const OmpInitializerExpr &x) { | ||
| Word("OMP_PRIV = "); | ||
| Walk(x.v); | ||
| void Unparse(const OmpInitializerClause &x) { | ||
| // Don't let the visitor go to the normal AssignmentStmt Unparse function, | ||
| // it adds an extra newline that we don't want. | ||
| if (const auto *assignment = std::get_if<AssignmentStmt>(&x.u)) | ||
| Walk(assignment->t, "="); | ||
| else | ||
| Walk(x.u); | ||
|
||
| } | ||
| void Unparse(const OmpInitializerClause &x) { Walk(x.u); } | ||
| void Unparse(const OpenMPDeclareReductionConstruct &x) { | ||
| BeginOpenMP(); | ||
| Word("!$OMP DECLARE REDUCTION "); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1656,6 +1656,7 @@ class OmpVisitor : public virtual DeclarationVisitor { | |
| const parser::OmpClauseList &clauses); | ||
| void ProcessReductionSpecifier(const parser::OmpReductionSpecifier &spec, | ||
| const std::optional<parser::OmpClauseList> &clauses); | ||
| void CreateTempSymbol(const parser::CharBlock &name, const DeclTypeSpec &dts); | ||
| }; | ||
|
|
||
| bool OmpVisitor::NeedsScope(const parser::OpenMPBlockConstruct &x) { | ||
|
|
@@ -1748,6 +1749,14 @@ void OmpVisitor::ProcessMapperSpecifier(const parser::OmpMapperSpecifier &spec, | |
| PopScope(); | ||
| } | ||
|
|
||
| void OmpVisitor::CreateTempSymbol( | ||
kiranchandramohan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const parser::CharBlock &name, const DeclTypeSpec &dts) { | ||
| ObjectEntityDetails details; | ||
kiranchandramohan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| details.set_type(dts); | ||
|
|
||
| MakeSymbol(name, Attrs{}, std::move(details)); | ||
| } | ||
|
|
||
| void OmpVisitor::ProcessReductionSpecifier( | ||
| const parser::OmpReductionSpecifier &spec, | ||
| const std::optional<parser::OmpClauseList> &clauses) { | ||
|
|
@@ -1761,11 +1770,26 @@ void OmpVisitor::ProcessReductionSpecifier( | |
| // Creating a new scope in case the combiner expression (or clauses) use | ||
| // reerved identifiers, like "omp_in". This is a temporary solution until | ||
| // we deal with these in a more thorough way. | ||
| PushScope(Scope::Kind::OtherConstruct, nullptr); | ||
| Walk(std::get<parser::OmpTypeNameList>(spec.t)); | ||
| Walk(std::get<std::optional<parser::OmpReductionCombiner>>(spec.t)); | ||
| Walk(clauses); | ||
| PopScope(); | ||
| auto &typeList = std::get<parser::OmpTypeNameList>(spec.t); | ||
kiranchandramohan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| for (auto &t : typeList.v) { | ||
| PushScope(Scope::Kind::OtherConstruct, nullptr); | ||
| BeginDeclTypeSpec(); | ||
| // We need to walk t.u because Walk(t) does it's own BeginDeclTypeSpec. | ||
| Walk(t.u); | ||
|
|
||
| auto *typeSpec = GetDeclTypeSpec(); | ||
kiranchandramohan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| assert(typeSpec && "We should have a type here"); | ||
| const parser::CharBlock ompVarNames[] = { | ||
| {"omp_in", 6}, {"omp_out", 7}, {"omp_priv", 8}}; | ||
|
||
|
|
||
| for (auto &nm : ompVarNames) { | ||
| CreateTempSymbol(nm, *typeSpec); | ||
kiranchandramohan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| EndDeclTypeSpec(); | ||
| Walk(std::get<std::optional<parser::OmpReductionCombiner>>(spec.t)); | ||
| Walk(clauses); | ||
| PopScope(); | ||
| } | ||
| } | ||
|
|
||
| bool OmpVisitor::Pre(const parser::OmpDirectiveSpecification &x) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.