[PATCH] D99681: [OpenMP] Pass mapping names to add components in a user defined mapper
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 1 10:58:26 PDT 2021
jhuber6 updated this revision to Diff 334768.
jhuber6 added a comment.
Adding test
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99681/new/
https://reviews.llvm.org/D99681
Files:
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGOpenMPRuntime.h
clang/test/OpenMP/target_map_names.cpp
Index: clang/test/OpenMP/target_map_names.cpp
===================================================================
--- clang/test/OpenMP/target_map_names.cpp
+++ clang/test/OpenMP/target_map_names.cpp
@@ -203,4 +203,10 @@
// CHECK: call void @__tgt_target_data_end_nowait_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** %{{.+}}, i8** %{{.+}}, i64* {{.+}}, i64* {{.+}}, i8** null, i8** {{.+}})
// CHECK: call void @__tgt_target_data_update_nowait_mapper(%struct.ident_t* @{{.+}}, i64 -1, i32 1, i8** %{{.+}}, i8** %{{.+}}, i64* {{.+}}, i64* {{.+}}, i8** null, i8** {{.+}})
+
+// DEBUG: void @.omp_mapper._ZTS2S3.id(i8* {{.*}}, i8* {{.*}}, i8* {{.*}}, i64 {{.*}}, i64 {{.*}}, i8* [[NAME_ARG:%.+]])
+// DEBUG: store i8* [[NAME_ARG]], i8** [[NAME_STACK:%.+]]
+// DEBUG: [[MAPPER_NAME:%.+]] = load i8*, i8** [[NAME_STACK]]
+// DEBUG: call void @__tgt_push_mapper_component(i8* %{{.*}}, i8* %{{.*}}, i8* %{{.*}}, i64 %{{.*}}, i64 %{{.*}}, i8* [[MAPPER_NAME]])
+
#endif
Index: clang/lib/CodeGen/CGOpenMPRuntime.h
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.h
+++ clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -824,7 +824,8 @@
void emitUDMapperArrayInitOrDel(CodeGenFunction &MapperCGF,
llvm::Value *Handle, llvm::Value *BasePtr,
llvm::Value *Ptr, llvm::Value *Size,
- llvm::Value *MapType, CharUnits ElementSize,
+ llvm::Value *MapType, llvm::Value *MapName,
+ CharUnits ElementSize,
llvm::BasicBlock *ExitBB, bool IsInit);
struct TaskResultTy {
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -9267,7 +9267,6 @@
SrcLocStr = OMPBuilder.getOrCreateSrcLocStr(FileName, ExprName.c_str(),
Line, Column);
}
-
return SrcLocStr;
}
@@ -9745,12 +9744,15 @@
llvm::Value *MapType = MapperCGF.EmitLoadOfScalar(
MapperCGF.GetAddrOfLocalVar(&TypeArg), /*Volatile=*/false,
C.getPointerType(Int64Ty), Loc);
+ llvm::Value *MapName = MapperCGF.EmitLoadOfScalar(
+ MapperCGF.GetAddrOfLocalVar(&NameArg),
+ /*Volatile=*/false, C.getPointerType(C.VoidPtrTy), Loc);
// Emit array initiation if this is an array section and \p MapType indicates
// that memory allocation is required.
llvm::BasicBlock *HeadBB = MapperCGF.createBasicBlock("omp.arraymap.head");
emitUDMapperArrayInitOrDel(MapperCGF, Handle, BaseIn, BeginIn, Size, MapType,
- ElementSize, HeadBB, /*IsInit=*/true);
+ MapName, ElementSize, HeadBB, /*IsInit=*/true);
// Emit a for loop to iterate through SizeArg of elements and map all of them.
@@ -9907,7 +9909,7 @@
// Emit array deletion if this is an array section and \p MapType indicates
// that deletion is required.
emitUDMapperArrayInitOrDel(MapperCGF, Handle, BaseIn, BeginIn, Size, MapType,
- ElementSize, DoneBB, /*IsInit=*/false);
+ MapName, ElementSize, DoneBB, /*IsInit=*/false);
// Emit the function exit block.
MapperCGF.EmitBlock(DoneBB, /*IsFinished=*/true);
@@ -9928,7 +9930,8 @@
void CGOpenMPRuntime::emitUDMapperArrayInitOrDel(
CodeGenFunction &MapperCGF, llvm::Value *Handle, llvm::Value *Base,
llvm::Value *Begin, llvm::Value *Size, llvm::Value *MapType,
- CharUnits ElementSize, llvm::BasicBlock *ExitBB, bool IsInit) {
+ llvm::Value *MapName, CharUnits ElementSize, llvm::BasicBlock *ExitBB,
+ bool IsInit) {
StringRef Prefix = IsInit ? ".init" : ".del";
// Evaluate if this is an array section.
@@ -9974,12 +9977,11 @@
MapperCGF.Builder.getInt64(~(MappableExprsHandler::OMP_MAP_TO |
MappableExprsHandler::OMP_MAP_FROM |
MappableExprsHandler::OMP_MAP_MEMBER_OF)));
- llvm::Value *MapNameArg = llvm::ConstantPointerNull::get(CGM.VoidPtrTy);
// Call the runtime API __tgt_push_mapper_component to fill up the runtime
// data structure.
llvm::Value *OffloadingArgs[] = {Handle, Base, Begin,
- ArraySize, MapTypeArg, MapNameArg};
+ ArraySize, MapTypeArg, MapName};
MapperCGF.EmitRuntimeCall(
OMPBuilder.getOrCreateRuntimeFunction(CGM.getModule(),
OMPRTL___tgt_push_mapper_component),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99681.334768.patch
Type: text/x-patch
Size: 4708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210401/83946cd9/attachment.bin>
More information about the cfe-commits
mailing list