#include "mlir/Dialect/Async/Passes.h"
#include "mlir/Analysis/Liveness.h"
#include "mlir/Dialect/Async/IR/Async.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/SmallSet.h"
namespace mlir {
#define GEN_PASS_DEF_ASYNCRUNTIMEREFCOUNTING
#define GEN_PASS_DEF_ASYNCRUNTIMEPOLICYBASEDREFCOUNTING
#include "mlir/Dialect/Async/Passes.h.inc"
}
#define DEBUG_TYPE …
usingnamespacemlir;
usingnamespacemlir::async;
static LogicalResult dropRefIfNoUses(Value value, unsigned count = 1) { … }
static LogicalResult walkReferenceCountedValues(
Operation *op, llvm::function_ref<LogicalResult(Value)> addRefCounting) { … }
namespace {
class AsyncRuntimeRefCountingPass
: public impl::AsyncRuntimeRefCountingBase<AsyncRuntimeRefCountingPass> { … };
}
LogicalResult AsyncRuntimeRefCountingPass::addDropRefAfterLastUse(Value value) { … }
LogicalResult
AsyncRuntimeRefCountingPass::addAddRefBeforeFunctionCall(Value value) { … }
LogicalResult
AsyncRuntimeRefCountingPass::addDropRefInDivergentLivenessSuccessor(
Value value) { … }
LogicalResult
AsyncRuntimeRefCountingPass::addAutomaticRefCounting(Value value) { … }
void AsyncRuntimeRefCountingPass::runOnOperation() { … }
namespace {
class AsyncRuntimePolicyBasedRefCountingPass
: public impl::AsyncRuntimePolicyBasedRefCountingBase<
AsyncRuntimePolicyBasedRefCountingPass> { … };
}
LogicalResult
AsyncRuntimePolicyBasedRefCountingPass::addRefCounting(Value value) { … }
void AsyncRuntimePolicyBasedRefCountingPass::initializeDefaultPolicy() { … }
void AsyncRuntimePolicyBasedRefCountingPass::runOnOperation() { … }
std::unique_ptr<Pass> mlir::createAsyncRuntimeRefCountingPass() { … }
std::unique_ptr<Pass> mlir::createAsyncRuntimePolicyBasedRefCountingPass() { … }