-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I left the `TODO[OpenMP]:` comments in `CIRGenExpr.cpp` as it is necessary to remove assertions to test and ithat specific issue needs to be addressed quickly in a different patch on captured variables.
- Loading branch information
Showing
11 changed files
with
173 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
//===--- CIRGenStmtOpenMP.cpp - Interface to OpenMP Runtimes --------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This provides a class for OpenMP runtime MLIR code generation. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "CIRGenOpenMPRuntime.h" | ||
#include "CIRGenFunction.h" | ||
#include "CIRGenModule.h" | ||
|
||
using namespace cir; | ||
using namespace clang; | ||
|
||
CIRGenOpenMPRuntime::CIRGenOpenMPRuntime(CIRGenModule &CGM) : CGM(CGM) {} | ||
|
||
Address CIRGenOpenMPRuntime::getAddressOfLocalVariable(CIRGenFunction &CGF, | ||
const VarDecl *VD) { | ||
// TODO[OpenMP]: Implement this method. | ||
return Address::invalid(); | ||
} | ||
|
||
void CIRGenOpenMPRuntime::checkAndEmitLastprivateConditional( | ||
CIRGenFunction &CGF, const Expr *LHS) { | ||
// TODO[OpenMP]: Implement this method. | ||
return; | ||
} | ||
|
||
void CIRGenOpenMPRuntime::registerTargetGlobalVariable( | ||
const clang::VarDecl *VD, mlir::cir::GlobalOp globalOp) { | ||
// TODO[OpenMP]: Implement this method. | ||
return; | ||
} | ||
|
||
void CIRGenOpenMPRuntime::emitDeferredTargetDecls() const { | ||
// TODO[OpenMP]: Implement this method. | ||
return; | ||
} | ||
|
||
void CIRGenOpenMPRuntime::emitFunctionProlog(CIRGenFunction &CGF, | ||
const clang::Decl *D) { | ||
// TODO[OpenMP]: Implement this method. | ||
return; | ||
} | ||
|
||
bool CIRGenOpenMPRuntime::emitTargetGlobal(clang::GlobalDecl &GD) { | ||
// TODO[OpenMP]: Implement this method. | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
//===--- CIRGenOpenMPRuntime.h - Interface to OpenMP Runtimes -------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This provides a class for OpenMP runtime MLIR code generation. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENOPENMPRUNTIME_H | ||
#define LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENOPENMPRUNTIME_H | ||
|
||
#include "CIRGenValue.h" | ||
#include "clang/CIR/Dialect/IR/CIRDialect.h" | ||
|
||
namespace clang { | ||
class Decl; | ||
class Expr; | ||
class GlobalDecl; | ||
class VarDecl; | ||
} // namespace clang | ||
|
||
namespace cir { | ||
class CIRGenModule; | ||
class CIRGenFunction; | ||
|
||
class CIRGenOpenMPRuntime { | ||
public: | ||
explicit CIRGenOpenMPRuntime(CIRGenModule &CGM); | ||
virtual ~CIRGenOpenMPRuntime() {} | ||
|
||
/// Gets the OpenMP-specific address of the local variable. | ||
virtual Address getAddressOfLocalVariable(CIRGenFunction &CGF, | ||
const clang::VarDecl *VD); | ||
|
||
/// Checks if the provided \p LVal is lastprivate conditional and emits the | ||
/// code to update the value of the original variable. | ||
/// \code | ||
/// lastprivate(conditional: a) | ||
/// ... | ||
/// <type> a; | ||
/// lp_a = ...; | ||
/// #pragma omp critical(a) | ||
/// if (last_iv_a <= iv) { | ||
/// last_iv_a = iv; | ||
/// global_a = lp_a; | ||
/// } | ||
/// \endcode | ||
virtual void checkAndEmitLastprivateConditional(CIRGenFunction &CGF, | ||
const clang::Expr *LHS); | ||
|
||
/// Checks if the provided global decl \a GD is a declare target variable and | ||
/// registers it when emitting code for the host. | ||
virtual void registerTargetGlobalVariable(const clang::VarDecl *VD, | ||
mlir::cir::GlobalOp globalOp); | ||
|
||
/// Emit deferred declare target variables marked for deferred emission. | ||
void emitDeferredTargetDecls() const; | ||
|
||
/// Emits OpenMP-specific function prolog. | ||
/// Required for device constructs. | ||
virtual void emitFunctionProlog(CIRGenFunction &CGF, const clang::Decl *D); | ||
|
||
/// Emit the global \a GD if it is meaningful for the target. Returns | ||
/// if it was emitted successfully. | ||
/// \param GD Global to scan. | ||
virtual bool emitTargetGlobal(clang::GlobalDecl &D); | ||
|
||
protected: | ||
CIRGenModule &CGM; | ||
}; | ||
} // namespace cir | ||
|
||
#endif // LLVM_CLANG_LIB_CIR_CODEGEN_CIRGENOPENMPRUNTIME_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters