Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/CodeGen/CGOpenMPRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ void CGOpenMPRuntime::registerEntryForDeclaration(const Decl *D,

CGOpenMPRuntime::CGOpenMPRuntime(CodeGenModule &CGM)
: CGM(CGM), DefaultOpenMPPSource(nullptr), NumTargetRegions(0),
NumTargetGlobals(0), HasTargetInfoLoaded(false),
TargetRegionsDescriptor(nullptr) {
NumTargetGlobals(0), HasTargetDataRegions(false),
HasTargetInfoLoaded(false), TargetRegionsDescriptor(nullptr) {
IdentTy = llvm::StructType::create(
"ident_t", CGM.Int32Ty /* reserved_1 */, CGM.Int32Ty /* flags */,
CGM.Int32Ty /* reserved_2 */, CGM.Int32Ty /* reserved_3 */,
Expand Down
11 changes: 10 additions & 1 deletion lib/CodeGen/CGOpenMPRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ class CGOpenMPRuntime {
// Number of globals processed so far that are to be mapped into a target
unsigned NumTargetGlobals;

// True if target data region was processed
bool HasTargetDataRegions;

// Name of the current function whose target regions are being identified
std::string CurTargetParentFunctionName;

Expand Down Expand Up @@ -284,10 +287,16 @@ class CGOpenMPRuntime {
// entry point
bool isValidOtherTargetFunction(StringRef name);

// Register target data region
void setHasTargetDataRegions(bool val) {
HasTargetDataRegions = val;
}

// Return true if the current module requires a the target descriptor to be
// registered
bool requiresTargetDescriptorRegistry(){
return NumTargetRegions != 0 || !TargetGlobalInitializers.empty();
return NumTargetRegions != 0 || !TargetGlobalInitializers.empty() ||
HasTargetDataRegions;
}

// Register global initializer for OpenMP Target offloading
Expand Down
1 change: 1 addition & 0 deletions lib/CodeGen/CGStmtOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6864,6 +6864,7 @@ void CodeGenFunction::EmitOMPTargetDataDirective(
EmitFinalOMPClause(*(*I), S);

CGM.OpenMPSupport.endOpenMPRegion();
CGM.getOpenMPRuntime().setHasTargetDataRegions(true);
}

// Generate the instructions for '#pragma omp target update' directive.
Expand Down