Skip to content

Commit e2d1a05

Browse files
committed
clang-format
1 parent 70f8d46 commit e2d1a05

File tree

6 files changed

+48
-39
lines changed

6 files changed

+48
-39
lines changed

flang/include/flang/Lower/OpenACC.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ static constexpr llvm::StringRef declarePostDeallocSuffix =
7676

7777
static constexpr llvm::StringRef privatizationRecipePrefix = "privatization";
7878

79-
bool needsOpenACCRoutineConstruct(const Fortran::evaluate::ProcedureDesignator *);
79+
bool needsOpenACCRoutineConstruct(
80+
const Fortran::evaluate::ProcedureDesignator *);
8081

8182
mlir::Value genOpenACCConstruct(AbstractConverter &,
8283
Fortran::semantics::SemanticsContext &,

flang/include/flang/Semantics/symbol.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ class OpenACCRoutineDeviceTypeInfo {
143143
const std::variant<std::string, SymbolRef> *bindName() const {
144144
return bindName_.has_value() ? &*bindName_ : nullptr;
145145
}
146-
const std::optional<std::variant<std::string, SymbolRef>> &bindNameOpt() const {
146+
const std::optional<std::variant<std::string, SymbolRef>> &
147+
bindNameOpt() const {
147148
return bindName_;
148149
}
149150
void set_bindName(std::string &&name) { bindName_.emplace(std::move(name)); }
@@ -153,6 +154,7 @@ class OpenACCRoutineDeviceTypeInfo {
153154

154155
friend llvm::raw_ostream &operator<<(
155156
llvm::raw_ostream &, const OpenACCRoutineDeviceTypeInfo &);
157+
156158
private:
157159
bool isSeq_{false};
158160
bool isVector_{false};

flang/lib/Lower/Bridge.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
465465
/// Declare a function.
466466
void declareFunction(Fortran::lower::pft::FunctionLikeUnit &funit) {
467467
setCurrentPosition(funit.getStartingSourceLoc());
468-
builder = new fir::FirOpBuilder(
469-
bridge.getModule(), bridge.getKindMap(), &mlirSymbolTable);
468+
builder = new fir::FirOpBuilder(bridge.getModule(), bridge.getKindMap(),
469+
&mlirSymbolTable);
470470
for (int entryIndex = 0, last = funit.entryPointList.size();
471471
entryIndex < last; ++entryIndex) {
472472
funit.setActiveEntry(entryIndex);
@@ -1031,9 +1031,9 @@ class FirConverter : public Fortran::lower::AbstractConverter {
10311031
return bridge.getSemanticsContext().FindScope(currentPosition);
10321032
}
10331033

1034-
fir::FirOpBuilder &getFirOpBuilder() override final {
1034+
fir::FirOpBuilder &getFirOpBuilder() override final {
10351035
CHECK(builder && "builder is not set before calling getFirOpBuilder");
1036-
return *builder;
1036+
return *builder;
10371037
}
10381038

10391039
mlir::ModuleOp getModuleOp() override final { return bridge.getModule(); }
@@ -5616,10 +5616,10 @@ class FirConverter : public Fortran::lower::AbstractConverter {
56165616
LLVM_DEBUG(llvm::dbgs() << "\n[bridge - startNewFunction]";
56175617
if (auto *sym = scope.symbol()) llvm::dbgs() << " " << *sym;
56185618
llvm::dbgs() << "\n");
5619-
// I don't think setting the builder is necessary here, because callee
5619+
// I don't think setting the builder is necessary here, because callee
56205620
// always looks up the FuncOp from the module. If there was a function that
56215621
// was not declared yet. This call to callee will cause an assertion
5622-
//failure.
5622+
// failure.
56235623
Fortran::lower::CalleeInterface callee(funit, *this);
56245624
mlir::func::FuncOp func = callee.addEntryBlockAndMapArguments();
56255625
builder =

flang/lib/Lower/CallInterface.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,11 +717,14 @@ void Fortran::lower::CallInterface<T>::declare() {
717717
func.setArgAttrs(placeHolder.index(), placeHolder.value().attributes);
718718

719719
setCUDAAttributes(func, side().getProcedureSymbol(), characteristic);
720-
720+
721721
if (const Fortran::semantics::Symbol *sym = side().getProcedureSymbol()) {
722-
if (const auto &info{sym->GetUltimate().detailsIf<Fortran::semantics::SubprogramDetails>()}) {
722+
if (const auto &info{
723+
sym->GetUltimate()
724+
.detailsIf<Fortran::semantics::SubprogramDetails>()}) {
723725
if (!info->openACCRoutineInfos().empty()) {
724-
genOpenACCRoutineConstruct(converter, module, func, info->openACCRoutineInfos());
726+
genOpenACCRoutineConstruct(converter, module, func,
727+
info->openACCRoutineInfos());
725728
}
726729
}
727730
}

flang/lib/Lower/OpenACC.cpp

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
#include "flang/Semantics/expression.h"
3333
#include "flang/Semantics/scope.h"
3434
#include "flang/Semantics/tools.h"
35+
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
36+
#include "mlir/IR/MLIRContext.h"
37+
#include "mlir/Support/LLVM.h"
3538
#include "llvm/ADT/STLExtras.h"
3639
#include "llvm/Frontend/OpenACC/ACC.h.inc"
3740
#include "llvm/Support/CommandLine.h"
3841
#include "llvm/Support/Debug.h"
3942
#include "llvm/Support/ErrorHandling.h"
40-
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
41-
#include "mlir/IR/MLIRContext.h"
42-
#include "mlir/Support/LLVM.h"
4343

4444
#define DEBUG_TYPE "flang-lower-openacc"
4545

@@ -4141,7 +4141,9 @@ static void attachRoutineInfo(mlir::func::FuncOp func,
41414141
mlir::acc::RoutineInfoAttr::get(func.getContext(), routines));
41424142
}
41434143

4144-
static mlir::ArrayAttr getArrayAttrOrNull(fir::FirOpBuilder &builder, llvm::SmallVector<mlir::Attribute> &attributes) {
4144+
static mlir::ArrayAttr
4145+
getArrayAttrOrNull(fir::FirOpBuilder &builder,
4146+
llvm::SmallVector<mlir::Attribute> &attributes) {
41454147
if (attributes.empty()) {
41464148
return nullptr;
41474149
} else {
@@ -4181,25 +4183,24 @@ void createOpenACCRoutineConstruct(
41814183
mlir::OpBuilder modBuilder(mod.getBodyRegion());
41824184
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
41834185
modBuilder.create<mlir::acc::RoutineOp>(
4184-
loc, routineOpStr, funcName,
4185-
getArrayAttrOrNull(builder, bindNames),
4186+
loc, routineOpStr, funcName, getArrayAttrOrNull(builder, bindNames),
41864187
getArrayAttrOrNull(builder, bindNameDeviceTypes),
41874188
getArrayAttrOrNull(builder, workerDeviceTypes),
41884189
getArrayAttrOrNull(builder, vectorDeviceTypes),
4189-
getArrayAttrOrNull(builder, seqDeviceTypes),
4190-
hasNohost, /*implicit=*/false,
4191-
getArrayAttrOrNull(builder, gangDeviceTypes),
4190+
getArrayAttrOrNull(builder, seqDeviceTypes), hasNohost,
4191+
/*implicit=*/false, getArrayAttrOrNull(builder, gangDeviceTypes),
41924192
getArrayAttrOrNull(builder, gangDimValues),
41934193
getArrayAttrOrNull(builder, gangDimDeviceTypes));
41944194

41954195
auto symbolRefAttr = builder.getSymbolRefAttr(routineOpStr);
41964196
if (funcOp) {
4197-
4197+
41984198
attachRoutineInfo(funcOp, symbolRefAttr);
41994199
} else {
42004200
// FuncOp is not lowered yet. Keep the information so the routine info
42014201
// can be attached later to the funcOp.
4202-
converter.getAccDelayedRoutines().push_back(std::make_pair(funcName, symbolRefAttr));
4202+
converter.getAccDelayedRoutines().push_back(
4203+
std::make_pair(funcName, symbolRefAttr));
42034204
}
42044205
}
42054206

@@ -4218,7 +4219,7 @@ static void interpretRoutineDeviceInfo(
42184219
auto getDeviceTypeAttr = [&]() -> mlir::Attribute {
42194220
auto context = builder.getContext();
42204221
auto value = getDeviceType(dinfo.dType());
4221-
return mlir::acc::DeviceTypeAttr::get(context, value );
4222+
return mlir::acc::DeviceTypeAttr::get(context, value);
42224223
};
42234224
if (dinfo.isSeq()) {
42244225
seqDeviceTypes.push_back(getDeviceTypeAttr());
@@ -4244,14 +4245,15 @@ static void interpretRoutineDeviceInfo(
42444245
const auto &bindName = dinfo.bindNameOpt().value();
42454246
mlir::Attribute bindNameAttr;
42464247
if (const auto &bindStr{std::get_if<std::string>(&bindName)}) {
4247-
bindNameAttr = builder.getStringAttr(*bindStr);
4248-
} else if (const auto &bindSym{std::get_if<Fortran::semantics::SymbolRef>(&bindName)}) {
4249-
bindNameAttr = builder.getStringAttr(converter.mangleName(*bindSym));
4250-
} else {
4251-
llvm_unreachable("Unsupported bind name type");
4252-
}
4253-
bindNames.push_back(bindNameAttr);
4254-
bindNameDeviceTypes.push_back(getDeviceTypeAttr());
4248+
bindNameAttr = builder.getStringAttr(*bindStr);
4249+
} else if (const auto &bindSym{
4250+
std::get_if<Fortran::semantics::SymbolRef>(&bindName)}) {
4251+
bindNameAttr = builder.getStringAttr(converter.mangleName(*bindSym));
4252+
} else {
4253+
llvm_unreachable("Unsupported bind name type");
4254+
}
4255+
bindNames.push_back(bindNameAttr);
4256+
bindNameDeviceTypes.push_back(getDeviceTypeAttr());
42554257
}
42564258
}
42574259

@@ -4277,18 +4279,18 @@ void Fortran::lower::genOpenACCRoutineConstruct(
42774279
}
42784280
// Note: Device Independent Attributes are set to the
42794281
// none device type in `info`.
4280-
interpretRoutineDeviceInfo(converter, info, seqDeviceTypes, vectorDeviceTypes,
4281-
workerDeviceTypes, bindNameDeviceTypes,
4282-
bindNames, gangDeviceTypes, gangDimValues,
4283-
gangDimDeviceTypes);
4282+
interpretRoutineDeviceInfo(converter, info, seqDeviceTypes,
4283+
vectorDeviceTypes, workerDeviceTypes,
4284+
bindNameDeviceTypes, bindNames, gangDeviceTypes,
4285+
gangDimValues, gangDimDeviceTypes);
42844286

42854287
// Device Dependent Attributes
42864288
for (const Fortran::semantics::OpenACCRoutineDeviceTypeInfo &dinfo :
42874289
info.deviceTypeInfos()) {
42884290
interpretRoutineDeviceInfo(
4289-
converter, dinfo, seqDeviceTypes, vectorDeviceTypes, workerDeviceTypes,
4290-
bindNameDeviceTypes, bindNames, gangDeviceTypes, gangDimValues,
4291-
gangDimDeviceTypes);
4291+
converter, dinfo, seqDeviceTypes, vectorDeviceTypes,
4292+
workerDeviceTypes, bindNameDeviceTypes, bindNames, gangDeviceTypes,
4293+
gangDimValues, gangDimDeviceTypes);
42924294
}
42934295
}
42944296
createOpenACCRoutineConstruct(

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,8 @@ void AccAttributeVisitor::AddRoutineInfoToSymbol(
11031103
}
11041104
symbol.get<SubprogramDetails>().add_openACCRoutineInfo(info);
11051105
} else {
1106-
llvm::errs() << "Couldnot add routine info to symbol: " << symbol.name() << "\n";
1106+
llvm::errs() << "Couldnot add routine info to symbol: " << symbol.name()
1107+
<< "\n";
11071108
}
11081109
}
11091110

0 commit comments

Comments
 (0)