@@ -109,7 +109,7 @@ struct OffloadModuleOpts {
109
109
110
110
// Shares assinging of the OpenMP OffloadModuleInterface and its assorted
111
111
// attributes accross Flang tools (bbc/flang)
112
- void setOffloadModuleInterfaceAttributes (
112
+ [[maybe_unused]] static void setOffloadModuleInterfaceAttributes (
113
113
mlir::ModuleOp &module , OffloadModuleOpts Opts) {
114
114
// Should be registered by the OpenMPDialect
115
115
if (auto offloadMod = llvm::dyn_cast<mlir::omp::OffloadModuleInterface>(
@@ -127,10 +127,18 @@ void setOffloadModuleInterfaceAttributes(
127
127
}
128
128
}
129
129
130
- void setOpenMPVersionAttribute (mlir::ModuleOp &module , int64_t version) {
130
+ [[maybe_unused]] static void setOpenMPVersionAttribute (
131
+ mlir::ModuleOp &module , int64_t version) {
131
132
module .getOperation ()->setAttr (
132
133
mlir::StringAttr::get (module .getContext (), llvm::Twine{" omp.version" }),
133
134
mlir::omp::VersionAttr::get (module .getContext (), version));
134
135
}
135
136
137
+ [[maybe_unused]] static int64_t getOpenMPVersionAttribute (
138
+ mlir::ModuleOp module , int64_t fallback = -1 ) {
139
+ if (mlir::Attribute verAttr = module ->getAttr (" omp.version" ))
140
+ return llvm::cast<mlir::omp::VersionAttr>(verAttr).getVersion ();
141
+ return fallback;
142
+ }
143
+
136
144
#endif // FORTRAN_TOOLS_CROSS_TOOL_HELPERS_H
0 commit comments