TIFitis added inline comments.

================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:7170-7234
+    const llvm::Value *DevPtr = nullptr;
 
     // In order to identify the right initializer we need to match the
     // declaration used by the mapping logic. In some cases we may get
     // OMPCapturedExprDecl that refers to the original declaration.
-    const ValueDecl *MatchingVD = OrigVD;
-    if (const auto *OED = dyn_cast<OMPCapturedExprDecl>(MatchingVD)) {
+    if (const auto *OED = dyn_cast<OMPCapturedExprDecl>(OrigVD)) {
       // OMPCapturedExprDecl are used to privative fields of the current
----------------
Currently clang maintains a map between Clang::ValueDecl and corresponding 
address in Info.CaptureDeviceAddrMap.

Please see the EmitOMPUseDeviceAddrClause function just below this to see how 
it does so.

I would however like to get rid of this map as it allows us to then get rid of 
another map in the MapInfosTy and a clang specific callback for maintaining 
these maps..

This map is only used to retain the mapping between a ValueDecl inside a map 
clause to its corresponding llvm address.

The highlighted code here tries to retrieve this llvm address back from the 
ValueDecl without using the map, but as you can it is a very hacky way of doing 
so. But my intuition says that there must be a much simpler method of 
retrieving this address as Clang must be storing it in some way in order for it 
to generate code.

It would be great if someone with more experience in Clang codegen could help 
me achieve this. 

Also I am aware that I am probably doing a very poor job at explaining this. 
Please let me know if you have any questions or would like me to try and 
explain it with more clarity.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152554

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to