llvm/mlir/lib/Dialect/ControlFlow/Transforms/BufferizableOpInterfaceImpl.cpp

//===- BufferizableOpInterfaceImpl.cpp - Impl. of BufferizableOpInterface -===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "mlir/Dialect/ControlFlow/Transforms/BufferizableOpInterfaceImpl.h"

#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/Operation.h"

usingnamespacemlir;
usingnamespacemlir::bufferization;

namespace mlir {
namespace cf {
namespace {

template <typename ConcreteModel, typename ConcreteOp>
struct BranchLikeOpInterface
    : public BranchOpBufferizableOpInterfaceExternalModel<ConcreteModel,
                                                          ConcreteOp> {};

/// Bufferization of cf.br.
struct BranchOpInterface
    : public BranchLikeOpInterface<BranchOpInterface, cf::BranchOp> {};

/// Bufferization of cf.cond_br.
struct CondBranchOpInterface
    : public BranchLikeOpInterface<CondBranchOpInterface, cf::CondBranchOp> {};

} // namespace
} // namespace cf
} // namespace mlir

void mlir::cf::registerBufferizableOpInterfaceExternalModels(
    DialectRegistry &registry) {}