19#include "llvm/ADT/StringExtras.h"
20#include "llvm/ADT/Twine.h"
21#include "llvm/ADT/TypeSwitch.h"
25#define GEN_PASS_DEF_ACCEMITREMARKSPRIVATE
26#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc"
30#define DEBUG_TYPE "acc-emit-remarks-private"
35template <
typename OpTy>
41 for (
Value operand : operands) {
42 auto op = cast<OpTy>(operand.getDefiningOp());
44 (op.getImplicit() ? implicitNames : explicitNames)
45 .push_back(varName.empty() ?
"<unknown>" : varName);
48 if (!implicitNames.empty())
51 [clause, names = std::move(implicitNames)]() {
52 return (Twine(
"Generating implicit ") + clause +
"(" +
53 llvm::join(names,
",") +
")")
58 if (!explicitNames.empty())
61 [clause, names = std::move(explicitNames)]() {
62 return (Twine(
"Generating ") + clause +
"(" + llvm::join(names,
",") +
69template <
typename OpTy>
71 reportPrivatization<acc::FirstprivateOp>(
72 accOp, accOp.getFirstprivateOperands(), accSupport,
"firstprivate");
73 reportPrivatization<acc::PrivateOp>(accOp, accOp.getPrivateOperands(),
74 accSupport,
"private");
77class ACCEmitRemarksPrivate
80 using ACCEmitRemarksPrivateBase<
81 ACCEmitRemarksPrivate>::ACCEmitRemarksPrivateBase;
84 ACCEmitRemarksPrivateBase<ACCEmitRemarksPrivate>::getDependentDialects(
89 void runOnOperation()
override {
90 func::FuncOp
func = getOperation();
92 auto cachedAnalysis = getCachedParentAnalysis<acc::OpenACCSupport>();
94 ? cachedAnalysis->get()
95 : getAnalysis<acc::OpenACCSupport>();
99 [&](
auto constructOp) {
100 emitRemarksForACCOp(constructOp, accSupport);
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
Operation is the basic unit of execution within MLIR.
This class provides an abstraction over the different types of ranges over Values.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
remark::detail::InFlightRemark emitRemark(Operation *op, std::function< std::string()> messageFn, llvm::StringRef category="openacc")
Emit an OpenACC remark with lazy message generation.
std::string getVariableName(Value v, VariableNameConfig config={})
Get the variable name for a given value.
#define ACC_COMPUTE_CONSTRUCT_AND_LOOP_OPS
void registerAllExtensions(DialectRegistry ®istry)
Register the standard OpenACC models for GPU, LLVM and MemRef IR.
Include the generated interface declarations.
llvm::TypeSwitch< T, ResultT > TypeSwitch