#include "mlir-c/Interfaces.h"
#include "mlir/CAPI/IR.h"
#include "mlir/CAPI/Interfaces.h"
#include "mlir/CAPI/Support.h"
#include "mlir/CAPI/Wrap.h"
#include "mlir/IR/ValueRange.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "llvm/ADT/ScopeExit.h"
#include <optional>
usingnamespacemlir;
namespace {
std::optional<RegisteredOperationName>
getRegisteredOperationName(MlirContext context, MlirStringRef opName) { … }
std::optional<Location> maybeGetLocation(MlirLocation location) { … }
SmallVector<Value> unwrapOperands(intptr_t nOperands, MlirValue *operands) { … }
DictionaryAttr unwrapAttributes(MlirAttribute attributes) { … }
SmallVector<std::unique_ptr<Region>> unwrapRegions(intptr_t nRegions,
MlirRegion *regions) { … }
}
bool mlirOperationImplementsInterface(MlirOperation operation,
MlirTypeID interfaceTypeID) { … }
bool mlirOperationImplementsInterfaceStatic(MlirStringRef operationName,
MlirContext context,
MlirTypeID interfaceTypeID) { … }
MlirTypeID mlirInferTypeOpInterfaceTypeID() { … }
MlirLogicalResult mlirInferTypeOpInterfaceInferReturnTypes(
MlirStringRef opName, MlirContext context, MlirLocation location,
intptr_t nOperands, MlirValue *operands, MlirAttribute attributes,
void *properties, intptr_t nRegions, MlirRegion *regions,
MlirTypesCallback callback, void *userData) { … }
MlirTypeID mlirInferShapedTypeOpInterfaceTypeID() { … }
MlirLogicalResult mlirInferShapedTypeOpInterfaceInferReturnTypes(
MlirStringRef opName, MlirContext context, MlirLocation location,
intptr_t nOperands, MlirValue *operands, MlirAttribute attributes,
void *properties, intptr_t nRegions, MlirRegion *regions,
MlirShapedTypeComponentsCallback callback, void *userData) { … }