|
7 | 7 | //===----------------------------------------------------------------------===// |
8 | 8 |
|
9 | 9 | #include "FlangOmpReportVisitor.h" |
| 10 | +#include "flang/Parser/openmp-utils.h" |
10 | 11 | #include "llvm/ADT/StringExtras.h" |
11 | 12 | #include "llvm/Frontend/OpenMP/OMP.h" |
12 | 13 |
|
@@ -118,61 +119,8 @@ std::string OpenMPCounterVisitor::getName(const OpenMPDeclarativeConstruct &c) { |
118 | 119 | c.u); |
119 | 120 | } |
120 | 121 | std::string OpenMPCounterVisitor::getName(const OpenMPConstruct &c) { |
121 | | - return std::visit( |
122 | | - Fortran::common::visitors{ |
123 | | - [&](const OpenMPStandaloneConstruct &c) -> std::string { |
124 | | - return common::visit( |
125 | | - common::visitors{ |
126 | | - [&](const OmpMetadirectiveDirective &d) { |
127 | | - return normalize_construct_name(d.source.ToString()); |
128 | | - }, |
129 | | - [&](auto &&d) { |
130 | | - const CharBlock &source{ |
131 | | - std::get<OmpDirectiveName>(d.v.t).source}; |
132 | | - return normalize_construct_name(source.ToString()); |
133 | | - }, |
134 | | - }, |
135 | | - c.u); |
136 | | - }, |
137 | | - [&](const OpenMPExecutableAllocate &c) -> std::string { |
138 | | - const CharBlock &source{std::get<0>(c.t).source}; |
139 | | - return normalize_construct_name(source.ToString()); |
140 | | - }, |
141 | | - [&](const OpenMPDeclarativeAllocate &c) -> std::string { |
142 | | - const CharBlock &source{std::get<0>(c.t).source}; |
143 | | - return normalize_construct_name(source.ToString()); |
144 | | - }, |
145 | | - [&](const OpenMPAssumeConstruct &c) -> std::string { |
146 | | - const CharBlock &source{std::get<0>(c.t).source}; |
147 | | - return normalize_construct_name(source.ToString()); |
148 | | - }, |
149 | | - [&](const OpenMPUtilityConstruct &c) -> std::string { |
150 | | - const CharBlock &source{c.source}; |
151 | | - return normalize_construct_name(source.ToString()); |
152 | | - }, |
153 | | - [&](const OpenMPSectionConstruct &c) -> std::string { |
154 | | - return "section"; |
155 | | - }, |
156 | | - [&](const OpenMPCriticalConstruct &c) -> std::string { |
157 | | - const CharBlock &source{std::get<0>(std::get<0>(c.t).t).source}; |
158 | | - return normalize_construct_name(source.ToString()); |
159 | | - }, |
160 | | - [&](const OpenMPLoopConstruct &c) -> std::string { |
161 | | - const CharBlock &source{std::get<0>(std::get<0>(c.t).t).source}; |
162 | | - return normalize_construct_name(source.ToString()); |
163 | | - }, |
164 | | - [&](const OpenMPSectionsConstruct &c) -> std::string { |
165 | | - const CharBlock &source{std::get<0>(std::get<0>(c.t).t).source}; |
166 | | - return normalize_construct_name(source.ToString()); |
167 | | - }, |
168 | | - [&](const auto &c) -> std::string { |
169 | | - using T = llvm::remove_cvref_t<decltype(c)>; |
170 | | - static_assert(std::is_base_of_v<OmpBlockConstruct, T>); |
171 | | - return normalize_construct_name( |
172 | | - c.BeginDir().DirName().source.ToString()); |
173 | | - }, |
174 | | - }, |
175 | | - c.u); |
| 122 | + return normalize_construct_name( |
| 123 | + omp::GetOmpDirectiveName(c).source.ToString()); |
176 | 124 | } |
177 | 125 |
|
178 | 126 | bool OpenMPCounterVisitor::Pre(const OpenMPDeclarativeConstruct &c) { |
@@ -256,11 +204,6 @@ void OpenMPCounterVisitor::Post(const OmpScheduleClause::Kind &c) { |
256 | 204 | clauseDetails += |
257 | 205 | "type=" + std::string{OmpScheduleClause::EnumToString(c)} + ";"; |
258 | 206 | } |
259 | | -void OpenMPCounterVisitor::Post(const OmpDirectiveNameModifier &c) { |
260 | | - clauseDetails += "name_modifier=" + |
261 | | - llvm::omp::getOpenMPDirectiveName(c.v, llvm::omp::FallbackVersion).str() + |
262 | | - ";"; |
263 | | -} |
264 | 207 | void OpenMPCounterVisitor::Post(const OmpClause &c) { |
265 | 208 | PostClauseCommon(normalize_clause_name(c.source.ToString())); |
266 | 209 | clauseDetails.clear(); |
|
0 commit comments