18#include "llvm/ADT/StringExtras.h"
19#include "llvm/ADT/Twine.h"
20#include "llvm/ADT/TypeSwitch.h"
24#define GEN_PASS_DEF_ACCEMITREMARKSPRIVATE
25#include "mlir/Dialect/OpenACC/Transforms/Passes.h.inc"
29#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;
83 void runOnOperation()
override {
84 func::FuncOp
func = getOperation();
86 auto cachedAnalysis = getCachedParentAnalysis<acc::OpenACCSupport>();
88 ? cachedAnalysis->get()
89 : getAnalysis<acc::OpenACCSupport>();
93 [&](
auto constructOp) {
94 emitRemarksForACCOp(constructOp, accSupport);
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)
Get the variable name for a given value.
#define ACC_COMPUTE_CONSTRUCT_AND_LOOP_OPS
Include the generated interface declarations.
llvm::TypeSwitch< T, ResultT > TypeSwitch