aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/mod-file.cpp
diff options
context:
space:
mode:
authorValentin Clement <clementval@gmail.com>2024-01-10 21:26:53 -0800
committerValentin Clement <clementval@gmail.com>2024-01-11 13:57:23 -0800
commitc8ad8024435df43a0811edb51be6ee517c44d332 (patch)
tree01299b184703d96c0a8685f603f54889efbf609d /flang/lib/Semantics/mod-file.cpp
parenta6d401703b7542e00c85767513be0851df6c67cf (diff)
downloadllvm-c8ad8024435df43a0811edb51be6ee517c44d332.zip
llvm-c8ad8024435df43a0811edb51be6ee517c44d332.tar.gz
llvm-c8ad8024435df43a0811edb51be6ee517c44d332.tar.bz2
[flang][openacc] Carry device dependent info for routine in the module file
Diffstat (limited to 'flang/lib/Semantics/mod-file.cpp')
-rw-r--r--flang/lib/Semantics/mod-file.cpp54
1 files changed, 37 insertions, 17 deletions
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index 70b6bbf..e871255 100644
--- a/flang/lib/Semantics/mod-file.cpp
+++ b/flang/lib/Semantics/mod-file.cpp
@@ -491,31 +491,51 @@ void ModFileWriter::PutDECStructure(
static const Attrs subprogramPrefixAttrs{Attr::ELEMENTAL, Attr::IMPURE,
Attr::MODULE, Attr::NON_RECURSIVE, Attr::PURE, Attr::RECURSIVE};
+static void PutOpenACCDeviceTypeRoutineInfo(
+ llvm::raw_ostream &os, const OpenACCRoutineDeviceTypeInfo &info) {
+ if (info.isSeq()) {
+ os << " seq";
+ }
+ if (info.isGang()) {
+ os << " gang";
+ if (info.gangDim() > 0) {
+ os << "(dim: " << info.gangDim() << ")";
+ }
+ }
+ if (info.isVector()) {
+ os << " vector";
+ }
+ if (info.isWorker()) {
+ os << " worker";
+ }
+ if (info.bindName()) {
+ os << " bind(" << *info.bindName() << ")";
+ }
+}
+
static void PutOpenACCRoutineInfo(
llvm::raw_ostream &os, const SubprogramDetails &details) {
for (auto info : details.openACCRoutineInfos()) {
os << "!$acc routine";
- if (info.isSeq()) {
- os << " seq";
- }
- if (info.isGang()) {
- os << " gang";
- if (info.gangDim() > 0) {
- os << "(dim: " << info.gangDim() << ")";
- }
- }
- if (info.isVector()) {
- os << " vector";
- }
- if (info.isWorker()) {
- os << " worker";
- }
+
+ PutOpenACCDeviceTypeRoutineInfo(os, info);
+
if (info.isNohost()) {
os << " nohost";
}
- if (info.bindName()) {
- os << " bind(" << *info.bindName() << ")";
+
+ for (auto dtype : info.deviceTypeInfos()) {
+ os << " device_type(";
+ if (dtype.dType() == common::OpenACCDeviceType::Star) {
+ os << "*";
+ } else {
+ os << parser::ToLowerCaseLetters(common::EnumToString(dtype.dType()));
+ }
+ os << ")";
+
+ PutOpenACCDeviceTypeRoutineInfo(os, dtype);
}
+
os << "\n";
}
}