2020-08-05 14:36:16 +02:00
|
|
|
//===- IR.cpp - C Interface for Core MLIR APIs ----------------------------===//
|
|
|
|
|
//
|
|
|
|
|
// 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-c/IR.h"
|
|
|
|
|
|
2020-08-18 10:26:30 +02:00
|
|
|
#include "mlir/CAPI/IR.h"
|
2020-08-05 14:36:16 +02:00
|
|
|
#include "mlir/IR/Attributes.h"
|
2020-08-18 20:01:19 +00:00
|
|
|
#include "mlir/IR/Dialect.h"
|
2020-08-05 14:36:16 +02:00
|
|
|
#include "mlir/IR/Module.h"
|
|
|
|
|
#include "mlir/IR/Operation.h"
|
|
|
|
|
#include "mlir/IR/Types.h"
|
|
|
|
|
#include "mlir/Parser.h"
|
2020-08-11 18:25:09 +02:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2020-08-05 14:36:16 +02:00
|
|
|
|
|
|
|
|
using namespace mlir;
|
|
|
|
|
|
2020-08-11 18:25:09 +02:00
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Printing helper. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
/// A simple raw ostream subclass that forwards write_impl calls to the
|
|
|
|
|
/// user-supplied callback together with opaque user-supplied data.
|
|
|
|
|
class CallbackOstream : public llvm::raw_ostream {
|
|
|
|
|
public:
|
|
|
|
|
CallbackOstream(std::function<void(const char *, intptr_t, void *)> callback,
|
|
|
|
|
void *opaqueData)
|
|
|
|
|
: callback(callback), opaqueData(opaqueData), pos(0u) {}
|
|
|
|
|
|
|
|
|
|
void write_impl(const char *ptr, size_t size) override {
|
|
|
|
|
callback(ptr, size, opaqueData);
|
|
|
|
|
pos += size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint64_t current_pos() const override { return pos; }
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::function<void(const char *, intptr_t, void *)> callback;
|
|
|
|
|
void *opaqueData;
|
|
|
|
|
uint64_t pos;
|
|
|
|
|
};
|
|
|
|
|
} // end namespace
|
|
|
|
|
|
2020-08-05 14:36:16 +02:00
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Context API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
MlirContext mlirContextCreate() {
|
2020-08-18 20:01:19 +00:00
|
|
|
auto *context = new MLIRContext(/*loadAllDialects=*/false);
|
2020-08-05 14:36:16 +02:00
|
|
|
return wrap(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mlirContextDestroy(MlirContext context) { delete unwrap(context); }
|
|
|
|
|
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Location API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
MlirLocation mlirLocationFileLineColGet(MlirContext context,
|
|
|
|
|
const char *filename, unsigned line,
|
|
|
|
|
unsigned col) {
|
|
|
|
|
return wrap(FileLineColLoc::get(filename, line, col, unwrap(context)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MlirLocation mlirLocationUnknownGet(MlirContext context) {
|
|
|
|
|
return wrap(UnknownLoc::get(unwrap(context)));
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-19 18:38:56 +02:00
|
|
|
void mlirLocationPrint(MlirLocation location, MlirStringCallback callback,
|
2020-08-11 18:25:09 +02:00
|
|
|
void *userData) {
|
|
|
|
|
CallbackOstream stream(callback, userData);
|
|
|
|
|
unwrap(location).print(stream);
|
|
|
|
|
stream.flush();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-05 14:36:16 +02:00
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Module API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
MlirModule mlirModuleCreateEmpty(MlirLocation location) {
|
|
|
|
|
return wrap(ModuleOp::create(unwrap(location)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MlirModule mlirModuleCreateParse(MlirContext context, const char *module) {
|
|
|
|
|
OwningModuleRef owning = parseSourceString(module, unwrap(context));
|
2020-08-16 20:53:45 -07:00
|
|
|
if (!owning)
|
|
|
|
|
return MlirModule{nullptr};
|
2020-08-05 14:36:16 +02:00
|
|
|
return MlirModule{owning.release().getOperation()};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mlirModuleDestroy(MlirModule module) {
|
|
|
|
|
// Transfer ownership to an OwningModuleRef so that its destructor is called.
|
|
|
|
|
OwningModuleRef(unwrap(module));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MlirOperation mlirModuleGetOperation(MlirModule module) {
|
|
|
|
|
return wrap(unwrap(module).getOperation());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Operation state API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
MlirOperationState mlirOperationStateGet(const char *name, MlirLocation loc) {
|
|
|
|
|
MlirOperationState state;
|
|
|
|
|
state.name = name;
|
|
|
|
|
state.location = loc;
|
|
|
|
|
state.nResults = 0;
|
|
|
|
|
state.results = nullptr;
|
|
|
|
|
state.nOperands = 0;
|
|
|
|
|
state.operands = nullptr;
|
|
|
|
|
state.nRegions = 0;
|
|
|
|
|
state.regions = nullptr;
|
|
|
|
|
state.nSuccessors = 0;
|
|
|
|
|
state.successors = nullptr;
|
|
|
|
|
state.nAttributes = 0;
|
|
|
|
|
state.attributes = nullptr;
|
|
|
|
|
return state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define APPEND_ELEMS(type, sizeName, elemName) \
|
|
|
|
|
state->elemName = \
|
|
|
|
|
(type *)realloc(state->elemName, (state->sizeName + n) * sizeof(type)); \
|
|
|
|
|
memcpy(state->elemName + state->sizeName, elemName, n * sizeof(type)); \
|
|
|
|
|
state->sizeName += n;
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
void mlirOperationStateAddResults(MlirOperationState *state, intptr_t n,
|
2020-08-05 14:36:16 +02:00
|
|
|
MlirType *results) {
|
|
|
|
|
APPEND_ELEMS(MlirType, nResults, results);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
void mlirOperationStateAddOperands(MlirOperationState *state, intptr_t n,
|
2020-08-05 14:36:16 +02:00
|
|
|
MlirValue *operands) {
|
|
|
|
|
APPEND_ELEMS(MlirValue, nOperands, operands);
|
|
|
|
|
}
|
2020-08-11 18:34:32 +02:00
|
|
|
void mlirOperationStateAddOwnedRegions(MlirOperationState *state, intptr_t n,
|
2020-08-05 14:36:16 +02:00
|
|
|
MlirRegion *regions) {
|
|
|
|
|
APPEND_ELEMS(MlirRegion, nRegions, regions);
|
|
|
|
|
}
|
2020-08-11 18:34:32 +02:00
|
|
|
void mlirOperationStateAddSuccessors(MlirOperationState *state, intptr_t n,
|
2020-08-05 14:36:16 +02:00
|
|
|
MlirBlock *successors) {
|
|
|
|
|
APPEND_ELEMS(MlirBlock, nSuccessors, successors);
|
|
|
|
|
}
|
2020-08-11 18:34:32 +02:00
|
|
|
void mlirOperationStateAddAttributes(MlirOperationState *state, intptr_t n,
|
2020-08-05 14:36:16 +02:00
|
|
|
MlirNamedAttribute *attributes) {
|
|
|
|
|
APPEND_ELEMS(MlirNamedAttribute, nAttributes, attributes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Operation API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
MlirOperation mlirOperationCreate(const MlirOperationState *state) {
|
|
|
|
|
assert(state);
|
|
|
|
|
OperationState cppState(unwrap(state->location), state->name);
|
|
|
|
|
SmallVector<Type, 4> resultStorage;
|
|
|
|
|
SmallVector<Value, 8> operandStorage;
|
|
|
|
|
SmallVector<Block *, 2> successorStorage;
|
|
|
|
|
cppState.addTypes(unwrapList(state->nResults, state->results, resultStorage));
|
|
|
|
|
cppState.addOperands(
|
|
|
|
|
unwrapList(state->nOperands, state->operands, operandStorage));
|
|
|
|
|
cppState.addSuccessors(
|
|
|
|
|
unwrapList(state->nSuccessors, state->successors, successorStorage));
|
|
|
|
|
|
|
|
|
|
cppState.attributes.reserve(state->nAttributes);
|
2020-08-11 18:34:32 +02:00
|
|
|
for (intptr_t i = 0; i < state->nAttributes; ++i)
|
2020-08-05 14:36:16 +02:00
|
|
|
cppState.addAttribute(state->attributes[i].name,
|
|
|
|
|
unwrap(state->attributes[i].attribute));
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
for (intptr_t i = 0; i < state->nRegions; ++i)
|
2020-08-05 14:36:16 +02:00
|
|
|
cppState.addRegion(std::unique_ptr<Region>(unwrap(state->regions[i])));
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
MlirOperation result = wrap(Operation::create(cppState));
|
2020-08-10 10:32:24 +02:00
|
|
|
free(state->results);
|
|
|
|
|
free(state->operands);
|
|
|
|
|
free(state->successors);
|
2020-08-11 18:34:32 +02:00
|
|
|
free(state->regions);
|
2020-08-10 10:32:24 +02:00
|
|
|
free(state->attributes);
|
2020-08-11 18:34:32 +02:00
|
|
|
return result;
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mlirOperationDestroy(MlirOperation op) { unwrap(op)->erase(); }
|
|
|
|
|
|
|
|
|
|
int mlirOperationIsNull(MlirOperation op) { return unwrap(op) == nullptr; }
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
intptr_t mlirOperationGetNumRegions(MlirOperation op) {
|
|
|
|
|
return static_cast<intptr_t>(unwrap(op)->getNumRegions());
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
MlirRegion mlirOperationGetRegion(MlirOperation op, intptr_t pos) {
|
|
|
|
|
return wrap(&unwrap(op)->getRegion(static_cast<unsigned>(pos)));
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MlirOperation mlirOperationGetNextInBlock(MlirOperation op) {
|
|
|
|
|
return wrap(unwrap(op)->getNextNode());
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
intptr_t mlirOperationGetNumOperands(MlirOperation op) {
|
|
|
|
|
return static_cast<intptr_t>(unwrap(op)->getNumOperands());
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
MlirValue mlirOperationGetOperand(MlirOperation op, intptr_t pos) {
|
|
|
|
|
return wrap(unwrap(op)->getOperand(static_cast<unsigned>(pos)));
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
intptr_t mlirOperationGetNumResults(MlirOperation op) {
|
|
|
|
|
return static_cast<intptr_t>(unwrap(op)->getNumResults());
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
MlirValue mlirOperationGetResult(MlirOperation op, intptr_t pos) {
|
|
|
|
|
return wrap(unwrap(op)->getResult(static_cast<unsigned>(pos)));
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
intptr_t mlirOperationGetNumSuccessors(MlirOperation op) {
|
|
|
|
|
return static_cast<intptr_t>(unwrap(op)->getNumSuccessors());
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
MlirBlock mlirOperationGetSuccessor(MlirOperation op, intptr_t pos) {
|
|
|
|
|
return wrap(unwrap(op)->getSuccessor(static_cast<unsigned>(pos)));
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
intptr_t mlirOperationGetNumAttributes(MlirOperation op) {
|
|
|
|
|
return static_cast<intptr_t>(unwrap(op)->getAttrs().size());
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
MlirNamedAttribute mlirOperationGetAttribute(MlirOperation op, intptr_t pos) {
|
2020-08-05 14:36:16 +02:00
|
|
|
NamedAttribute attr = unwrap(op)->getAttrs()[pos];
|
|
|
|
|
return MlirNamedAttribute{attr.first.c_str(), wrap(attr.second)};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MlirAttribute mlirOperationGetAttributeByName(MlirOperation op,
|
|
|
|
|
const char *name) {
|
|
|
|
|
return wrap(unwrap(op)->getAttr(name));
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-19 18:38:56 +02:00
|
|
|
void mlirOperationPrint(MlirOperation op, MlirStringCallback callback,
|
2020-08-11 18:25:09 +02:00
|
|
|
void *userData) {
|
|
|
|
|
CallbackOstream stream(callback, userData);
|
|
|
|
|
unwrap(op)->print(stream);
|
|
|
|
|
stream.flush();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-05 14:36:16 +02:00
|
|
|
void mlirOperationDump(MlirOperation op) { return unwrap(op)->dump(); }
|
|
|
|
|
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Region API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
MlirRegion mlirRegionCreate() { return wrap(new Region); }
|
|
|
|
|
|
|
|
|
|
MlirBlock mlirRegionGetFirstBlock(MlirRegion region) {
|
|
|
|
|
Region *cppRegion = unwrap(region);
|
|
|
|
|
if (cppRegion->empty())
|
|
|
|
|
return wrap(static_cast<Block *>(nullptr));
|
|
|
|
|
return wrap(&cppRegion->front());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mlirRegionAppendOwnedBlock(MlirRegion region, MlirBlock block) {
|
|
|
|
|
unwrap(region)->push_back(unwrap(block));
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
void mlirRegionInsertOwnedBlock(MlirRegion region, intptr_t pos,
|
2020-08-05 14:36:16 +02:00
|
|
|
MlirBlock block) {
|
|
|
|
|
auto &blockList = unwrap(region)->getBlocks();
|
|
|
|
|
blockList.insert(std::next(blockList.begin(), pos), unwrap(block));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mlirRegionDestroy(MlirRegion region) {
|
|
|
|
|
delete static_cast<Region *>(region.ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int mlirRegionIsNull(MlirRegion region) { return unwrap(region) == nullptr; }
|
|
|
|
|
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Block API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType *args) {
|
2020-08-05 14:36:16 +02:00
|
|
|
Block *b = new Block;
|
2020-08-11 18:34:32 +02:00
|
|
|
for (intptr_t i = 0; i < nArgs; ++i)
|
2020-08-05 14:36:16 +02:00
|
|
|
b->addArgument(unwrap(args[i]));
|
|
|
|
|
return wrap(b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MlirBlock mlirBlockGetNextInRegion(MlirBlock block) {
|
|
|
|
|
return wrap(unwrap(block)->getNextNode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MlirOperation mlirBlockGetFirstOperation(MlirBlock block) {
|
|
|
|
|
Block *cppBlock = unwrap(block);
|
|
|
|
|
if (cppBlock->empty())
|
|
|
|
|
return wrap(static_cast<Operation *>(nullptr));
|
|
|
|
|
return wrap(&cppBlock->front());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mlirBlockAppendOwnedOperation(MlirBlock block, MlirOperation operation) {
|
|
|
|
|
unwrap(block)->push_back(unwrap(operation));
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
void mlirBlockInsertOwnedOperation(MlirBlock block, intptr_t pos,
|
2020-08-05 14:36:16 +02:00
|
|
|
MlirOperation operation) {
|
|
|
|
|
auto &opList = unwrap(block)->getOperations();
|
|
|
|
|
opList.insert(std::next(opList.begin(), pos), unwrap(operation));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mlirBlockDestroy(MlirBlock block) { delete unwrap(block); }
|
|
|
|
|
|
|
|
|
|
int mlirBlockIsNull(MlirBlock block) { return unwrap(block) == nullptr; }
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
intptr_t mlirBlockGetNumArguments(MlirBlock block) {
|
|
|
|
|
return static_cast<intptr_t>(unwrap(block)->getNumArguments());
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-11 18:34:32 +02:00
|
|
|
MlirValue mlirBlockGetArgument(MlirBlock block, intptr_t pos) {
|
|
|
|
|
return wrap(unwrap(block)->getArgument(static_cast<unsigned>(pos)));
|
2020-08-05 14:36:16 +02:00
|
|
|
}
|
|
|
|
|
|
2020-08-19 18:38:56 +02:00
|
|
|
void mlirBlockPrint(MlirBlock block, MlirStringCallback callback,
|
2020-08-11 18:25:09 +02:00
|
|
|
void *userData) {
|
|
|
|
|
CallbackOstream stream(callback, userData);
|
|
|
|
|
unwrap(block)->print(stream);
|
|
|
|
|
stream.flush();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-05 14:36:16 +02:00
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Value API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
MlirType mlirValueGetType(MlirValue value) {
|
|
|
|
|
return wrap(unwrap(value).getType());
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-19 18:38:56 +02:00
|
|
|
void mlirValuePrint(MlirValue value, MlirStringCallback callback,
|
2020-08-11 18:25:09 +02:00
|
|
|
void *userData) {
|
|
|
|
|
CallbackOstream stream(callback, userData);
|
|
|
|
|
unwrap(value).print(stream);
|
|
|
|
|
stream.flush();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-05 14:36:16 +02:00
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Type API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
MlirType mlirTypeParseGet(MlirContext context, const char *type) {
|
|
|
|
|
return wrap(mlir::parseType(type, unwrap(context)));
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-18 10:26:30 +02:00
|
|
|
int mlirTypeEqual(MlirType t1, MlirType t2) { return unwrap(t1) == unwrap(t2); }
|
|
|
|
|
|
2020-08-19 18:38:56 +02:00
|
|
|
void mlirTypePrint(MlirType type, MlirStringCallback callback, void *userData) {
|
2020-08-11 18:25:09 +02:00
|
|
|
CallbackOstream stream(callback, userData);
|
|
|
|
|
unwrap(type).print(stream);
|
|
|
|
|
stream.flush();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-05 14:36:16 +02:00
|
|
|
void mlirTypeDump(MlirType type) { unwrap(type).dump(); }
|
|
|
|
|
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
/* Attribute API. */
|
|
|
|
|
/* ========================================================================== */
|
|
|
|
|
|
|
|
|
|
MlirAttribute mlirAttributeParseGet(MlirContext context, const char *attr) {
|
|
|
|
|
return wrap(mlir::parseAttribute(attr, unwrap(context)));
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-19 18:38:56 +02:00
|
|
|
int mlirAttributeEqual(MlirAttribute a1, MlirAttribute a2) {
|
|
|
|
|
return unwrap(a1) == unwrap(a2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mlirAttributePrint(MlirAttribute attr, MlirStringCallback callback,
|
2020-08-11 18:25:09 +02:00
|
|
|
void *userData) {
|
|
|
|
|
CallbackOstream stream(callback, userData);
|
|
|
|
|
unwrap(attr).print(stream);
|
|
|
|
|
stream.flush();
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-05 14:36:16 +02:00
|
|
|
void mlirAttributeDump(MlirAttribute attr) { unwrap(attr).dump(); }
|
|
|
|
|
|
|
|
|
|
MlirNamedAttribute mlirNamedAttributeGet(const char *name, MlirAttribute attr) {
|
|
|
|
|
return MlirNamedAttribute{name, attr};
|
|
|
|
|
}
|