Skip to content

Commit 89822ff

Browse files
committed
Revert "[flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (#139131)"
This reverts commit 41aa674. Breaks build: https://lab.llvm.org/buildbot/#/builders/140/builds/22826
1 parent bb0a078 commit 89822ff

File tree

15 files changed

+56
-96
lines changed

15 files changed

+56
-96
lines changed

flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,8 @@ void OpenMPCounterVisitor::Post(const OmpScheduleClause::Kind &c) {
267267
"type=" + std::string{OmpScheduleClause::EnumToString(c)} + ";";
268268
}
269269
void OpenMPCounterVisitor::Post(const OmpDirectiveNameModifier &c) {
270-
clauseDetails += "name_modifier=" +
271-
llvm::omp::getOpenMPDirectiveName(c.v, llvm::omp::FallbackVersion).str() +
272-
";";
270+
clauseDetails +=
271+
"name_modifier=" + llvm::omp::getOpenMPDirectiveName(c.v).str() + ";";
273272
}
274273
void OpenMPCounterVisitor::Post(const OmpClause &c) {
275274
PostClauseCommon(normalize_clause_name(c.source.ToString()));

flang/include/flang/Parser/dump-parse-tree.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "flang/Common/idioms.h"
1818
#include "flang/Common/indirection.h"
1919
#include "flang/Support/Fortran.h"
20-
#include "llvm/Frontend/OpenMP/OMP.h"
2120
#include "llvm/Support/raw_ostream.h"
2221
#include <string>
2322
#include <type_traits>
@@ -546,8 +545,8 @@ class ParseTreeDumper {
546545
NODE(parser, OmpBeginSectionsDirective)
547546
NODE(parser, OmpBlockDirective)
548547
static std::string GetNodeName(const llvm::omp::Directive &x) {
549-
return llvm::Twine("llvm::omp::Directive = ",
550-
llvm::omp::getOpenMPDirectiveName(x, llvm::omp::FallbackVersion))
548+
return llvm::Twine(
549+
"llvm::omp::Directive = ", llvm::omp::getOpenMPDirectiveName(x))
551550
.str();
552551
}
553552
NODE(parser, OmpClause)

flang/include/flang/Parser/unparse.h

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ namespace llvm {
1818
class raw_ostream;
1919
}
2020

21-
namespace Fortran::common {
22-
class LangOptions;
23-
}
24-
2521
namespace Fortran::evaluate {
2622
struct GenericExprWrapper;
2723
struct GenericAssignmentWrapper;
@@ -51,18 +47,15 @@ struct AnalyzedObjectsAsFortran {
5147
// Converts parsed program (or fragment) to out as Fortran.
5248
template <typename A>
5349
void Unparse(llvm::raw_ostream &out, const A &root,
54-
const common::LangOptions &langOpts, Encoding encoding = Encoding::UTF_8,
55-
bool capitalizeKeywords = true, bool backslashEscapes = true,
56-
preStatementType *preStatement = nullptr,
50+
Encoding encoding = Encoding::UTF_8, bool capitalizeKeywords = true,
51+
bool backslashEscapes = true, preStatementType *preStatement = nullptr,
5752
AnalyzedObjectsAsFortran * = nullptr);
5853

5954
extern template void Unparse(llvm::raw_ostream &out, const Program &program,
60-
const common::LangOptions &langOpts, Encoding encoding,
61-
bool capitalizeKeywords, bool backslashEscapes,
55+
Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
6256
preStatementType *preStatement, AnalyzedObjectsAsFortran *);
6357
extern template void Unparse(llvm::raw_ostream &out, const Expr &expr,
64-
const common::LangOptions &langOpts, Encoding encoding,
65-
bool capitalizeKeywords, bool backslashEscapes,
58+
Encoding encoding, bool capitalizeKeywords, bool backslashEscapes,
6659
preStatementType *preStatement, AnalyzedObjectsAsFortran *);
6760
} // namespace Fortran::parser
6861

flang/include/flang/Semantics/unparse-with-symbols.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,13 @@ namespace llvm {
1616
class raw_ostream;
1717
}
1818

19-
namespace Fortran::common {
20-
class LangOptions;
21-
}
22-
2319
namespace Fortran::parser {
2420
struct Program;
2521
}
2622

2723
namespace Fortran::semantics {
2824
class SemanticsContext;
2925
void UnparseWithSymbols(llvm::raw_ostream &, const parser::Program &,
30-
const common::LangOptions &,
3126
parser::Encoding encoding = parser::Encoding::UTF_8);
3227
void UnparseWithModules(llvm::raw_ostream &, SemanticsContext &,
3328
const parser::Program &,

flang/lib/Frontend/ParserActions.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void debugUnparseNoSema(CompilerInstance &ci, llvm::raw_ostream &out) {
119119
auto &parseTree{ci.getParsing().parseTree()};
120120

121121
// TODO: Options should come from CompilerInvocation
122-
Unparse(out, *parseTree, ci.getInvocation().getLangOpts(),
122+
Unparse(out, *parseTree,
123123
/*encoding=*/parser::Encoding::UTF_8,
124124
/*capitalizeKeywords=*/true, /*backslashEscapes=*/false,
125125
/*preStatement=*/nullptr,
@@ -131,7 +131,6 @@ void debugUnparseWithSymbols(CompilerInstance &ci) {
131131
auto &parseTree{*ci.getParsing().parseTree()};
132132

133133
semantics::UnparseWithSymbols(llvm::outs(), parseTree,
134-
ci.getInvocation().getLangOpts(),
135134
/*encoding=*/parser::Encoding::UTF_8);
136135
}
137136

flang/lib/Lower/OpenMP/ClauseProcessor.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,9 @@ void ClauseProcessor::processTODO(mlir::Location currentLocation,
200200
auto checkUnhandledClause = [&](llvm::omp::Clause id, const auto *x) {
201201
if (!x)
202202
return;
203-
unsigned version = semaCtx.langOptions().OpenMPVersion;
204203
TODO(currentLocation,
205204
"Unhandled clause " + llvm::omp::getOpenMPClauseName(id).upper() +
206-
" in " +
207-
llvm::omp::getOpenMPDirectiveName(directive, version).upper() +
205+
" in " + llvm::omp::getOpenMPDirectiveName(directive).upper() +
208206
" construct");
209207
};
210208

flang/lib/Lower/OpenMP/Decomposer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct ConstructDecomposition {
7070
namespace Fortran::lower::omp {
7171
LLVM_DUMP_METHOD llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
7272
const UnitConstruct &uc) {
73-
os << llvm::omp::getOpenMPDirectiveName(uc.id, llvm::omp::FallbackVersion);
73+
os << llvm::omp::getOpenMPDirectiveName(uc.id);
7474
for (auto [index, clause] : llvm::enumerate(uc.clauses)) {
7575
os << (index == 0 ? '\t' : ' ');
7676
os << llvm::omp::getOpenMPClauseName(clause.id);

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3754,11 +3754,9 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
37543754
item);
37553755
break;
37563756
case llvm::omp::Directive::OMPD_tile:
3757-
case llvm::omp::Directive::OMPD_unroll: {
3758-
unsigned version = semaCtx.langOptions().OpenMPVersion;
3757+
case llvm::omp::Directive::OMPD_unroll:
37593758
TODO(loc, "Unhandled loop directive (" +
3760-
llvm::omp::getOpenMPDirectiveName(dir, version) + ")");
3761-
}
3759+
llvm::omp::getOpenMPDirectiveName(dir) + ")");
37623760
// case llvm::omp::Directive::OMPD_workdistribute:
37633761
case llvm::omp::Directive::OMPD_workshare:
37643762
newOp = genWorkshareOp(converter, symTable, stmtCtx, semaCtx, eval, loc,

flang/lib/Parser/openmp-parsers.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ OmpDirectiveNameParser::directives() const {
125125
void OmpDirectiveNameParser::initTokens(NameWithId *table) const {
126126
for (size_t i{0}, e{llvm::omp::Directive_enumSize}; i != e; ++i) {
127127
auto id{static_cast<llvm::omp::Directive>(i)};
128-
llvm::StringRef name{
129-
llvm::omp::getOpenMPDirectiveName(id, llvm::omp::FallbackVersion)};
128+
llvm::StringRef name{llvm::omp::getOpenMPDirectiveName(id)};
130129
table[i] = std::make_pair(name.str(), id);
131130
}
132131
// Sort the table with respect to the directive name length in a descending

flang/lib/Parser/parse-tree.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "flang/Common/indirection.h"
1212
#include "flang/Parser/tools.h"
1313
#include "flang/Parser/user-state.h"
14-
#include "llvm/Frontend/OpenMP/OMP.h"
1514
#include "llvm/Support/raw_ostream.h"
1615
#include <algorithm>
1716

@@ -306,9 +305,7 @@ std::string OmpTraitSelectorName::ToString() const {
306305
return std::string(EnumToString(v));
307306
},
308307
[&](llvm::omp::Directive d) {
309-
return llvm::omp::getOpenMPDirectiveName(
310-
d, llvm::omp::FallbackVersion)
311-
.str();
308+
return llvm::omp::getOpenMPDirectiveName(d).str();
312309
},
313310
[&](const std::string &s) { //
314311
return s;

0 commit comments

Comments
 (0)