[PATCH] D59474: [OpenMP 5.0] Codegen support for user-defined mappers

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 18 10:25:40 PDT 2019


ABataev added a comment.

Could you provide a little bit more comments what are you doing in this patch? It would be good t have a detailed description of the codegen scheme.



================
Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:2390
   }
+  case OMPRTL__tgt_target_data_mapper: {
+    // Build void __tgt_target_data_mapper(int64_t device_id, int32_t arg_num,
----------------
You need to implement these mapper functions first.


================
Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:6769-6773
+  const OMPExecutableDirective *CurDir = nullptr;
+
+  /// The mapper directive from where the map clauses were extracted. One and
+  /// only one of CurDir and CurMapperDir is valid.
+  const OMPDeclareMapperDecl *CurMapperDir = nullptr;
----------------
Use `llvm::PointerUnion<OMPExecutableDirective *, OMPDeclareMapperDecl *>` to save the space.


================
Comment at: lib/CodeGen/CGOpenMPRuntime.h:351
+  /// is the asynchronous version.
+  llvm::DenseMap<const OMPDeclareMapperDecl *,
+                 std::pair<llvm::Function *, llvm::Function *>>
----------------
You should be very careful with this map. If the mapper is declared in the function context, it must be removed from this map as soon as the function processing is completed. All local declarations are removed after this and their address might be used again.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59474/new/

https://reviews.llvm.org/D59474





More information about the cfe-commits mailing list