@@ -3623,6 +3623,9 @@ static llvm::omp::OpenMPOffloadMappingFlags mapParentWithMembers(
36233623 LLVM::ModuleTranslation &moduleTranslation, llvm::IRBuilderBase &builder,
36243624 llvm::OpenMPIRBuilder &ompBuilder, DataLayout &dl, MapInfosTy &combinedInfo,
36253625 MapInfoData &mapData, uint64_t mapDataIndex, bool isTargetParams) {
3626+ assert (!ompBuilder.Config .isTargetDevice () &&
3627+ " function only supported for host device codegen" );
3628+
36263629 // Map the first segment of our structure
36273630 combinedInfo.Types .emplace_back (
36283631 isTargetParams
@@ -3731,6 +3734,8 @@ static void processMapMembersWithParent(
37313734 llvm::OpenMPIRBuilder &ompBuilder, DataLayout &dl, MapInfosTy &combinedInfo,
37323735 MapInfoData &mapData, uint64_t mapDataIndex,
37333736 llvm::omp::OpenMPOffloadMappingFlags memberOfFlag) {
3737+ assert (!ompBuilder.Config .isTargetDevice () &&
3738+ " function only supported for host device codegen" );
37343739
37353740 auto parentClause =
37363741 llvm::cast<omp::MapInfoOp>(mapData.MapClause [mapDataIndex]);
@@ -3844,6 +3849,9 @@ static void processMapWithMembersOf(LLVM::ModuleTranslation &moduleTranslation,
38443849 DataLayout &dl, MapInfosTy &combinedInfo,
38453850 MapInfoData &mapData, uint64_t mapDataIndex,
38463851 bool isTargetParams) {
3852+ assert (!ompBuilder.Config .isTargetDevice () &&
3853+ " function only supported for host device codegen" );
3854+
38473855 auto parentClause =
38483856 llvm::cast<omp::MapInfoOp>(mapData.MapClause [mapDataIndex]);
38493857
@@ -3885,6 +3893,8 @@ static void
38853893createAlteredByCaptureMap (MapInfoData &mapData,
38863894 LLVM::ModuleTranslation &moduleTranslation,
38873895 llvm::IRBuilderBase &builder) {
3896+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
3897+ " function only supported for host device codegen" );
38883898 for (size_t i = 0 ; i < mapData.MapClause .size (); ++i) {
38893899 // if it's declare target, skip it, it's handled separately.
38903900 if (!mapData.IsDeclareTarget [i]) {
@@ -3949,6 +3959,9 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
39493959 LLVM::ModuleTranslation &moduleTranslation,
39503960 DataLayout &dl, MapInfosTy &combinedInfo,
39513961 MapInfoData &mapData, bool isTargetParams = false ) {
3962+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
3963+ " function only supported for host device codegen" );
3964+
39523965 // We wish to modify some of the methods in which arguments are
39533966 // passed based on their capture type by the target region, this can
39543967 // involve generating new loads and stores, which changes the
@@ -3960,8 +3973,7 @@ static void genMapInfos(llvm::IRBuilderBase &builder,
39603973 // kernel arg structure. It primarily becomes relevant in cases like
39613974 // bycopy, or byref range'd arrays. In the default case, we simply
39623975 // pass thee pointer byref as both basePointer and pointer.
3963- if (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice ())
3964- createAlteredByCaptureMap (mapData, moduleTranslation, builder);
3976+ createAlteredByCaptureMap (mapData, moduleTranslation, builder);
39653977
39663978 llvm::OpenMPIRBuilder *ompBuilder = moduleTranslation.getOpenMPBuilder ();
39673979
@@ -3995,6 +4007,8 @@ emitUserDefinedMapper(Operation *declMapperOp, llvm::IRBuilderBase &builder,
39954007static llvm::Expected<llvm::Function *>
39964008getOrCreateUserDefinedMapperFunc (Operation *op, llvm::IRBuilderBase &builder,
39974009 LLVM::ModuleTranslation &moduleTranslation) {
4010+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4011+ " function only supported for host device codegen" );
39984012 auto declMapperOp = cast<omp::DeclareMapperOp>(op);
39994013 std::string mapperFuncName =
40004014 moduleTranslation.getOpenMPBuilder ()->createPlatformSpecificName (
@@ -4011,6 +4025,8 @@ static llvm::Expected<llvm::Function *>
40114025emitUserDefinedMapper (Operation *op, llvm::IRBuilderBase &builder,
40124026 LLVM::ModuleTranslation &moduleTranslation,
40134027 llvm::StringRef mapperFuncName) {
4028+ assert (!moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4029+ " function only supported for host device codegen" );
40144030 auto declMapperOp = cast<omp::DeclareMapperOp>(op);
40154031 auto declMapperInfoOp = declMapperOp.getDeclareMapperInfo ();
40164032 DataLayout dl = DataLayout (declMapperOp->getParentOfType <ModuleOp>());
@@ -4500,6 +4516,8 @@ static void
45004516handleDeclareTargetMapVar (MapInfoData &mapData,
45014517 LLVM::ModuleTranslation &moduleTranslation,
45024518 llvm::IRBuilderBase &builder, llvm::Function *func) {
4519+ assert (moduleTranslation.getOpenMPBuilder ()->Config .isTargetDevice () &&
4520+ " function only supported for target device codegen" );
45034521 for (size_t i = 0 ; i < mapData.MapClause .size (); ++i) {
45044522 // In the case of declare target mapped variables, the basePointer is
45054523 // the reference pointer generated by the convertDeclareTargetAttr
@@ -4592,6 +4610,8 @@ createDeviceArgumentAccessor(MapInfoData &mapData, llvm::Argument &arg,
45924610 LLVM::ModuleTranslation &moduleTranslation,
45934611 llvm::IRBuilderBase::InsertPoint allocaIP,
45944612 llvm::IRBuilderBase::InsertPoint codeGenIP) {
4613+ assert (ompBuilder.Config .isTargetDevice () &&
4614+ " function only supported for target device codegen" );
45954615 builder.restoreIP (allocaIP);
45964616
45974617 omp::VariableCaptureKind capture = omp::VariableCaptureKind::ByRef;
0 commit comments