33#include "llvm/ADT/SmallPtrSet.h"
61 bool threadingEnabled) {
74 unwrap(context)->allowUnregisteredDialects(allow);
78 return unwrap(context)->allowsUnregisteredDialects();
81 return static_cast<intptr_t>(
unwrap(context)->getAvailableDialects().size());
85 MlirDialectRegistry registry) {
92 return static_cast<intptr_t>(
unwrap(context)->getLoadedDialects().size());
106 return unwrap(context)->isOperationRegistered(
unwrap(name));
110 return unwrap(context)->enableMultithreading(enable);
114 unwrap(context)->loadAllAvailableDialects();
118 MlirLlvmThreadPool threadPool) {
123 return unwrap(context)->getNumThreads();
127 return wrap(&
unwrap(context)->getThreadPool());
131 unwrap(context)->beginTransientScope();
135 unwrap(context)->endTransientScope();
139 return unwrap(context)->isInTransientScope();
175 MlirOpPrintingFlags flags) {
196 MlirOpPrintingFlags flags) {
199 if (
auto result = llvm::dyn_cast<OpResult>(val)) {
202 op = llvm::cast<BlockArgument>(val).getOwner()->
getParentOp();
229 unwrap(flags)->elideLargeElementsAttrs(largeElementLimit);
234 unwrap(flags)->elideLargeResourceString(largeResourceLimit);
239 unwrap(flags)->enableDebugInfo(enable, prettyForm);
243 unwrap(flags)->printGenericOpForm();
247 unwrap(flags)->printNameLocAsPrefix();
251 unwrap(flags)->useLocalScope();
255 unwrap(flags)->assumeVerified();
259 unwrap(flags)->skipRegions();
275 unwrap(flags)->setDesiredBytecodeVersion(version);
299 unsigned startLine,
unsigned startCol,
300 unsigned endLine,
unsigned endCol) {
303 startLine, startCol, endLine, endCol)));
307 return wrap(llvm::dyn_cast<FileLineColRange>(
unwrap(location)).getFilename());
311 if (
auto loc = llvm::dyn_cast<FileLineColRange>(
unwrap(location)))
312 return loc.getStartLine();
317 if (
auto loc = llvm::dyn_cast<FileLineColRange>(
unwrap(location)))
318 return loc.getStartColumn();
323 if (
auto loc = llvm::dyn_cast<FileLineColRange>(
unwrap(location)))
324 return loc.getEndLine();
329 if (
auto loc = llvm::dyn_cast<FileLineColRange>(
unwrap(location)))
330 return loc.getEndColumn();
335 return wrap(FileLineColRange::getTypeID());
339 return isa<FileLineColRange>(
unwrap(location));
348 Location(llvm::dyn_cast<CallSiteLoc>(
unwrap(location)).getCallee()));
353 Location(llvm::dyn_cast<CallSiteLoc>(
unwrap(location)).getCaller()));
357 return wrap(CallSiteLoc::getTypeID());
361 return isa<CallSiteLoc>(
unwrap(location));
365 MlirLocation
const *locations,
366 MlirAttribute metadata) {
373 if (
auto locationsArrRef = llvm::dyn_cast<FusedLoc>(
unwrap(location)))
374 return locationsArrRef.getLocations().size();
379 MlirLocation *locationsCPtr) {
380 if (
auto locationsArrRef = llvm::dyn_cast<FusedLoc>(
unwrap(location))) {
381 for (
auto [i, location] : llvm::enumerate(locationsArrRef.getLocations()))
382 locationsCPtr[i] =
wrap(location);
387 return wrap(llvm::dyn_cast<FusedLoc>(
unwrap(location)).getMetadata());
393 return isa<FusedLoc>(
unwrap(location));
397 MlirLocation childLoc) {
406 return wrap((llvm::dyn_cast<NameLoc>(
unwrap(location)).getName()));
411 Location(llvm::dyn_cast<NameLoc>(
unwrap(location)).getChildLoc()));
417 return isa<NameLoc>(
unwrap(location));
425 return wrap(UnknownLoc::getTypeID());
429 return isa<UnknownLoc>(
unwrap(location));
443 unwrap(location).print(stream);
451 return wrap(ModuleOp::create(
unwrap(location)));
458 return MlirModule{
nullptr};
459 return MlirModule{owning.
release().getOperation()};
467 return MlirModule{
nullptr};
468 return MlirModule{owning.
release().getOperation()};
506 MlirOperationState state;
508 state.location = loc;
510 state.results =
nullptr;
512 state.operands =
nullptr;
514 state.regions =
nullptr;
515 state.nSuccessors = 0;
516 state.successors =
nullptr;
517 state.nAttributes = 0;
518 state.attributes =
nullptr;
519 state.enableResultTypeInference =
false;
523#define APPEND_ELEMS(type, sizeName, elemName) \
525 (type *)realloc(state->elemName, (state->sizeName + n) * sizeof(type)); \
526 memcpy(state->elemName + state->sizeName, elemName, n * sizeof(type)); \
527 state->sizeName += n;
530 MlirType
const *results) {
535 MlirValue
const *operands) {
539 MlirRegion
const *regions) {
543 MlirBlock
const *successors) {
552 state->enableResultTypeInference =
true;
564 <<
"type inference was requested for the operation " << state.
name
565 <<
", but the operation was not registered; ensure that the dialect "
566 "containing the operation is linked into MLIR and registered with "
571 auto *inferInterface = info->getInterface<InferTypeOpInterface>();
572 if (!inferInterface) {
574 <<
"type inference was requested for the operation " << state.
name
575 <<
", but the operation does not support type inference; result "
576 "types must be specified explicitly";
583 if (!properties && info->getOpPropertyByteSize() > 0 && !attributes.empty()) {
584 auto propAlloc = std::make_unique<char[]>(info->getOpPropertyByteSize());
585 properties =
PropertyRef(info->getOpPropertiesTypeID(), propAlloc.get());
589 <<
" failed properties conversion while building "
592 if (failed(info->setOpPropertiesFromAttribute(state.
name, properties,
596 if (succeeded(inferInterface->inferReturnTypes(
605 if (succeeded(inferInterface->inferReturnTypes(
622 unwrapList(state->nOperands, state->operands, operandStorage));
624 unwrapList(state->nSuccessors, state->successors, successorStorage));
627 for (
intptr_t i = 0; i < state->nAttributes; ++i)
629 unwrap(state->attributes[i].attribute));
631 for (
intptr_t i = 0; i < state->nRegions; ++i)
632 cppState.
addRegion(std::unique_ptr<Region>(
unwrap(state->regions[i])));
634 free(state->results);
635 free(state->operands);
636 free(state->successors);
637 free(state->regions);
638 free(state->attributes);
641 if (state->enableResultTypeInference) {
642 assert(cppState.
types.empty() &&
643 "result type inference enabled and result types provided");
700 MlirContext context) {
714 if (
auto info =
unwrap(op)->getRegisteredInfo())
715 return wrap(info->getTypeID());
720 return wrap(
unwrap(op)->getName().getIdentifier());
736 return wrap(&
unwrap(op)->getRegion(
static_cast<unsigned>(pos)));
764 return wrap(
unwrap(op)->getOperand(
static_cast<unsigned>(pos)));
768 return wrap(&
unwrap(op)->getOpOperand(
static_cast<unsigned>(pos)));
772 MlirValue newValue) {
773 unwrap(op)->setOperand(
static_cast<unsigned>(pos),
unwrap(newValue));
777 MlirValue
const *operands) {
787 return wrap(
unwrap(op)->getResult(
static_cast<unsigned>(pos)));
795 return wrap(
unwrap(op)->getSuccessor(
static_cast<unsigned>(pos)));
800 std::optional<Attribute> attr =
unwrap(op)->getInherentAttr(
unwrap(name));
801 return attr.has_value();
806 std::optional<Attribute> attr =
unwrap(op)->getInherentAttr(
unwrap(name));
807 if (attr.has_value())
814 MlirAttribute attr) {
815 unwrap(op)->setInherentAttr(
821 llvm::range_size(
unwrap(op)->getDiscardableAttrs()));
827 *std::next(
unwrap(op)->getDiscardableAttrs().begin(), pos);
838 MlirAttribute attr) {
844 return !!
unwrap(op)->removeDiscardableAttr(
unwrap(name));
849 unwrap(op)->setSuccessor(
unwrap(block),
static_cast<unsigned>(pos));
867 MlirAttribute attr) {
878 unwrap(op)->print(stream);
893 unwrap(op)->print(stream);
904 MlirOperation op, MlirBytecodeWriterConfig config,
939 llvm_unreachable(
"unknown result in WalkResult::unwrap");
961 MlirValue newValue) {
977 if (cppRegion->
empty())
978 return wrap(
static_cast<Block *
>(
nullptr));
988 auto &blockList =
unwrap(region)->getBlocks();
989 blockList.insert(std::next(blockList.begin(), pos),
unwrap(block));
1000 assert(
unwrap(reference)->getParent() ==
unwrap(region) &&
1001 "expected reference block to belong to the region");
1011 assert(
unwrap(reference)->getParent() ==
unwrap(region) &&
1012 "expected reference block to belong to the region");
1018 delete static_cast<Region *
>(region.ptr);
1030 MlirLocation
const *locs) {
1032 for (
intptr_t i = 0; i < nArgs; ++i)
1055 if (cppBlock->
empty())
1062 if (cppBlock->
empty())
1075 MlirOperation operation) {
1076 auto &opList =
unwrap(block)->getOperations();
1077 opList.insert(std::next(opList.begin(), pos),
unwrap(operation));
1081 MlirOperation reference,
1082 MlirOperation operation) {
1084 if (mlirOperationIsNull(reference)) {
1089 assert(
unwrap(reference)->getBlock() ==
unwrap(block) &&
1090 "expected reference operation to belong to the block");
1096 MlirOperation reference,
1097 MlirOperation operation) {
1098 if (mlirOperationIsNull(reference))
1101 assert(
unwrap(reference)->getBlock() ==
unwrap(block) &&
1102 "expected reference operation to belong to the block");
1111 b->getParent()->getBlocks().remove(
b);
1133 return wrap(
unwrap(block)->getArgument(
static_cast<unsigned>(pos)));
1139 unwrap(block)->print(stream);
1147 return wrap(
unwrap(block)->getSuccessor(
static_cast<unsigned>(pos)));
1152 return static_cast<intptr_t>(std::distance(
b->pred_begin(),
b->pred_end()));
1158 std::advance(it, pos);
1171 return llvm::isa<BlockArgument>(
unwrap(value));
1175 return llvm::isa<OpResult>(
unwrap(value));
1179 return wrap(llvm::dyn_cast<BlockArgument>(
unwrap(value)).getOwner());
1184 llvm::dyn_cast<BlockArgument>(
unwrap(value)).getArgNumber());
1188 if (
auto blockArg = llvm::dyn_cast<BlockArgument>(
unwrap(value)))
1189 blockArg.setType(
unwrap(type));
1193 if (
auto blockArg = llvm::dyn_cast<BlockArgument>(
unwrap(value)))
1194 blockArg.setLoc(
unwrap(loc));
1198 return wrap(llvm::dyn_cast<OpResult>(
unwrap(value)).getOwner());
1203 llvm::dyn_cast<OpResult>(
unwrap(value)).getResultNumber());
1219 unwrap(value).print(stream);
1236 return wrap(opOperand);
1245 MlirOperation *exceptions) {
1250 for (
intptr_t i = 0; i < numExceptions; ++i) {
1251 exceptionSet.insert(
unwrap(exceptions[i]));
1260 assert(filter &&
"expected non-null filter callback");
1262 [filter, userData](
OpOperand &operand) ->
bool {
1263 return filter(
wrap(&operand), userData);
1290 return unwrap(opOperand)->getOperandNumber();
1298 unwrap(opOperand)->getNextOperandUsingThisValue());
1303 return wrap(nextOpOperand);
1332 unwrap(type).print(stream);
1351 if (
auto typedAttr = llvm::dyn_cast<TypedAttr>(attr))
1352 return wrap(typedAttr.getType());
1371 unwrap(attr).print(stream);
1377 MlirAttribute attr) {
1414 if (!
unwrap(operation)->hasTrait<OpTrait::SymbolTable>())
1420 delete unwrap(symbolTable);
1429 MlirOperation operation) {
1434 MlirOperation operation) {
1440 MlirOperation from) {
1441 auto *cppFrom =
unwrap(from);
1442 auto *context = cppFrom->getContext();
1443 auto oldSymbolAttr = StringAttr::get(context,
unwrap(oldSymbol));
1444 auto newSymbolAttr = StringAttr::get(context,
unwrap(newSymbol));
1450 void (*callback)(MlirOperation,
bool,
1454 [&](
Operation *foundOpCpp,
bool isVisible) {
1455 callback(
wrap(foundOpCpp), isVisible,
1506 MlirOperation from) {
1511 MlirOperation from) {
1540 MlirIRMapping mapping) {
unsigned mlirOpOperandGetOperandNumber(MlirOpOperand opOperand)
Returns the operand number of an op operand.
MlirLocation mlirValueGetLocation(MlirValue v)
Gets the location of the value.
void mlirContextDestroy(MlirContext context)
Takes an MLIR context owned by the caller and destroys it.
void mlirOperationDump(MlirOperation op)
Prints an operation to stderr.
MlirAttribute mlirOperationGetDiscardableAttributeByName(MlirOperation op, MlirStringRef name)
MlirOperation mlirSymbolTableLookup(MlirSymbolTable symbolTable, MlirStringRef name)
Looks up a symbol with the given name in the given symbol table and returns the operation that corres...
MlirRegion mlirRegionCreate()
Creates a new empty region and transfers ownership to the caller.
void mlirOperationPrint(MlirOperation op, MlirStringCallback callback, void *userData)
Prints a location by sending chunks of the string representation and forwarding userData to callback`...
MlirBlock mlirIRMappingLookupOrNullBlock(MlirIRMapping mapping, MlirBlock from)
Looks up a mapped Block. Returns a null MlirBlock if no mapping exists.
MlirValue mlirIRMappingLookupOrDefaultValue(MlirIRMapping mapping, MlirValue from)
Looks up a mapped Value.
MlirContext mlirModuleGetContext(MlirModule module)
void mlirValuePrint(MlirValue value, MlirStringCallback callback, void *userData)
Prints a block by sending chunks of the string representation and forwarding userData to callback`.
MlirContext mlirLocationGetContext(MlirLocation location)
Gets the context that a location was created with.
MlirDialect mlirContextGetLoadedDialect(MlirContext context, MlirStringRef name)
Gets the dialect instance owned by the given context using the dialect namespace to identify it.
size_t mlirModuleHashValue(MlirModule mod)
intptr_t mlirBlockGetNumPredecessors(MlirBlock block)
bool mlirLocationIsAName(MlirLocation location)
Checks whether the given location is an Name.
MlirOperation mlirOpOperandGetOwner(MlirOpOperand opOperand)
Returns the owner operation of an op operand.
bool mlirDialectEqual(MlirDialect dialect1, MlirDialect dialect2)
Checks if two dialects that belong to the same context are equal.
MlirOperation mlirIRMappingLookupOrDefaultOperation(MlirIRMapping mapping, MlirOperation from)
Looks up a mapped Operation.
MlirRegion mlirRegionGetNextInOperation(MlirRegion region)
Returns the region immediately following the given region in its parent operation.
MlirLogicalResult mlirOperationWriteBytecodeWithConfig(MlirOperation op, MlirBytecodeWriterConfig config, MlirStringCallback callback, void *userData)
Same as mlirOperationWriteBytecode but with writer config and returns failure only if desired bytecod...
MlirIdentifier mlirOperationGetName(MlirOperation op)
void mlirIRMappingMapBlock(MlirIRMapping mapping, MlirBlock from, MlirBlock to)
Maps a Block in the mapping.
void mlirDialectRegistryDestroy(MlirDialectRegistry registry)
Takes a dialect registry owned by the caller and destroys it.
bool mlirIdentifierEqual(MlirIdentifier ident, MlirIdentifier other)
Checks whether two identifiers are the same.
void mlirOperationPrintWithFlags(MlirOperation op, MlirOpPrintingFlags flags, MlirStringCallback callback, void *userData)
Same as mlirOperationPrint but accepts flags controlling the printing behavior.
void mlirContextBeginTransientScope(MlirContext context)
Begins a transient scope on the context, freezing the base layer (loaded dialects,...
bool mlirValueIsABlockArgument(MlirValue value)
MlirTypeID mlirTypeGetTypeID(MlirType type)
Gets the type ID of the type.
void mlirValueReplaceAllUsesOfWith(MlirValue oldValue, MlirValue newValue)
Replace all uses of 'of' value with the 'with' value, updating anything in the IR that uses 'of' to u...
MlirValue mlirBlockAddArgument(MlirBlock block, MlirType type, MlirLocation loc)
Appends an argument of the specified type to the block.
intptr_t mlirOperationGetNumRegions(MlirOperation op)
MlirBlock mlirOperationGetBlock(MlirOperation op)
void mlirContextAppendDialectRegistry(MlirContext ctx, MlirDialectRegistry registry)
Append the contents of the given dialect registry to the registry associated with the context.
MlirIdentifier mlirIdentifierGet(MlirContext context, MlirStringRef str)
Gets an identifier with the given string value.
void mlirBlockArgumentSetType(MlirValue value, MlirType type)
MlirLocation mlirLocationFileLineColGet(MlirContext context, MlirStringRef filename, unsigned line, unsigned col)
Creates an File/Line/Column location owned by the given context.
intptr_t mlirContextGetNumLoadedDialects(MlirContext context)
Returns the number of dialects loaded by the context.
MlirNamedAttribute mlirNamedAttributeGet(MlirIdentifier name, MlirAttribute attr)
Associates an attribute with the name. Takes ownership of neither.
MlirStringRef mlirSymbolTableGetVisibilityAttributeName()
Returns the name of the attribute used to store symbol visibility.
void mlirOperationStateAddAttributes(MlirOperationState *state, intptr_t n, MlirNamedAttribute const *attributes)
MlirValue mlirOperationGetResult(MlirOperation op, intptr_t pos)
bool mlirLocationIsACallSite(MlirLocation location)
Checks whether the given location is an CallSite.
void mlirSymbolTableWalkSymbolTables(MlirOperation from, bool allSymUsesVisible, void(*callback)(MlirOperation, bool, void *userData), void *userData)
Walks all symbol table operations nested within, and including, op.
void mlirContextLoadAllAvailableDialects(MlirContext context)
Eagerly loads all available dialects registered with a context, making them available for use for IR ...
MlirModule mlirModuleCreateParseFromFile(MlirContext context, MlirStringRef fileName)
bool mlirOperationNameHasTrait(MlirStringRef opName, MlirTypeID traitTypeID, MlirContext context)
void mlirAttributePrint(MlirAttribute attr, MlirStringCallback callback, void *userData)
Prints a location by sending chunks of the string representation and forwarding userData to callback`...
MlirBlock mlirRegionGetFirstBlock(MlirRegion region)
Gets the first block in the region.
MlirIRMapping mlirIRMappingCreate(void)
Creates a new empty IRMapping.
MlirLogicalResult mlirSymbolTableReplaceAllSymbolUses(MlirStringRef oldSymbol, MlirStringRef newSymbol, MlirOperation from)
Attempt to replace all uses that are nested within the given operation of the given symbol 'oldSymbol...
MlirLocation mlirLocationFusedGet(MlirContext ctx, intptr_t nLocations, MlirLocation const *locations, MlirAttribute metadata)
Creates a fused location with an array of locations and metadata.
MlirAsmState mlirAsmStateCreateForValue(MlirValue value, MlirOpPrintingFlags flags)
intptr_t mlirOperationGetNumResults(MlirOperation op)
MlirOpOperand mlirValueGetFirstUse(MlirValue value)
Returns an op operand representing the first use of the value, or a null op operand if there are no u...
void mlirRegionInsertOwnedBlockAfter(MlirRegion region, MlirBlock reference, MlirBlock block)
Takes a block owned by the caller and inserts it after the (non-owned) reference block in the given r...
void mlirOperationDestroy(MlirOperation op)
void mlirValueReplaceAllUsesExcept(MlirValue oldValue, MlirValue newValue, intptr_t numExceptions, MlirOperation *exceptions)
Replace all uses of 'of' value with 'with' value, updating anything in the IR that uses 'of' to use '...
void mlirBlockAppendOwnedOperation(MlirBlock block, MlirOperation operation)
Takes an operation owned by the caller and appends it to the block.
MlirRegion mlirOperationGetFirstRegion(MlirOperation op)
Returns first region attached to the operation.
MlirAttribute mlirOperationGetInherentAttributeByName(MlirOperation op, MlirStringRef name)
MlirDialect mlirContextGetOrLoadDialect(MlirContext context, MlirStringRef name)
Gets the dialect instance owned by the given context using the dialect namespace to identify it,...
MlirContext mlirAttributeGetContext(MlirAttribute attribute)
MlirStringRef mlirSymbolTableGetSymbolAttributeName()
Returns the name of the attribute used to store symbol names compatible with symbol tables.
void mlirBlockInsertOwnedOperation(MlirBlock block, intptr_t pos, MlirOperation operation)
Takes an operation owned by the caller and inserts it as pos to the block.
MlirRegion mlirBlockGetParentRegion(MlirBlock block)
Returns the region that contains this block.
MlirType mlirValueGetType(MlirValue value)
void mlirOperationMoveAfter(MlirOperation op, MlirOperation other)
Moves the given operation immediately after the other operation in its parent block.
void mlirRegionAppendOwnedBlock(MlirRegion region, MlirBlock block)
Takes a block owned by the caller and appends it to the given region.
void mlirBlockPrint(MlirBlock block, MlirStringCallback callback, void *userData)
void mlirOperationSetDiscardableAttributeByName(MlirOperation op, MlirStringRef name, MlirAttribute attr)
MlirOpPrintingFlags mlirOpPrintingFlagsCreate()
bool mlirModuleEqual(MlirModule lhs, MlirModule rhs)
void mlirOpPrintingFlagsElideLargeElementsAttrs(MlirOpPrintingFlags flags, intptr_t largeElementLimit)
MlirBlock mlirBlockGetNextInRegion(MlirBlock block)
Returns the block immediately following the given block in its parent region.
void mlirOperationSetSuccessor(MlirOperation op, intptr_t pos, MlirBlock block)
MlirValue mlirOpOperandGetValue(MlirOpOperand opOperand)
Returns the value of an op operand.
#define APPEND_ELEMS(type, sizeName, elemName)
bool mlirContextIsRegisteredOperation(MlirContext context, MlirStringRef name)
Returns whether the given fully-qualified operation (i.e.
MlirOperation mlirOperationGetNextInBlock(MlirOperation op)
void mlirOpPrintingFlagsEnableDebugInfo(MlirOpPrintingFlags flags, bool enable, bool prettyForm)
MlirOperation mlirModuleGetOperation(MlirModule module)
static mlir::WalkResult unwrap(MlirWalkResult result)
void mlirOpPrintingFlagsElideLargeResourceString(MlirOpPrintingFlags flags, intptr_t largeResourceLimit)
void mlirRegionInsertOwnedBlockBefore(MlirRegion region, MlirBlock reference, MlirBlock block)
Takes a block owned by the caller and inserts it before the (non-owned) reference block in the given ...
MlirValue mlirBlockGetArgument(MlirBlock block, intptr_t pos)
Returns pos-th argument of the block.
unsigned mlirLocationFusedGetNumLocations(MlirLocation location)
Getter for number of locations fused together.
bool mlirIRMappingContainsBlock(MlirIRMapping mapping, MlirBlock block)
Returns true if the mapping contains a mapping for the given block.
MlirStringRef mlirDialectGetNamespace(MlirDialect dialect)
Returns the namespace of the given dialect.
void mlirOpPrintingFlagsUseLocalScope(MlirOpPrintingFlags flags)
MlirTypeID mlirOperationGetTypeID(MlirOperation op)
intptr_t mlirBlockArgumentGetArgNumber(MlirValue value)
void mlirOperationWalk(MlirOperation op, MlirOperationWalkCallback callback, void *userData, MlirWalkOrder walkOrder)
Walks operation op in walkOrder and calls callback on that operation.
MlirBlock mlirOperationGetSuccessor(MlirOperation op, intptr_t pos)
void mlirBlockInsertOwnedOperationBefore(MlirBlock block, MlirOperation reference, MlirOperation operation)
Takes an operation owned by the caller and inserts it before the (non-owned) reference operation in t...
bool mlirAttributeEqual(MlirAttribute a1, MlirAttribute a2)
MlirAsmState mlirAsmStateCreateForOperation(MlirOperation op, MlirOpPrintingFlags flags)
bool mlirOperationEqual(MlirOperation op, MlirOperation other)
void mlirOperationSetInherentAttributeByName(MlirOperation op, MlirStringRef name, MlirAttribute attr)
void mlirOpPrintingFlagsAssumeVerified(MlirOpPrintingFlags flags)
MlirOperation mlirOperationCloneWithMapping(MlirOperation op, MlirIRMapping mapping)
Clones the operation with the given mapping.
bool mlirValueEqual(MlirValue value1, MlirValue value2)
MlirContext mlirIdentifierGetContext(MlirIdentifier ident)
Returns the context associated with this identifier.
void mlirBytecodeWriterConfigDestroy(MlirBytecodeWriterConfig config)
MlirBlock mlirBlockGetSuccessor(MlirBlock block, intptr_t pos)
void mlirModuleDestroy(MlirModule module)
MlirBlock mlirIRMappingLookupOrDefaultBlock(MlirIRMapping mapping, MlirBlock from)
Looks up a mapped Block.
MlirModule mlirModuleCreateEmpty(MlirLocation location)
void mlirOpPrintingFlagsPrintGenericOpForm(MlirOpPrintingFlags flags)
MlirOperation mlirOperationGetParentOperation(MlirOperation op)
void mlirRegionTakeBody(MlirRegion target, MlirRegion source)
Moves the entire content of the source region to the target region.
MlirLlvmThreadPool mlirContextGetThreadPool(MlirContext context)
Gets the thread pool of the context when enabled multithreading, otherwise an assertion is raised.
MlirValue mlirBlockInsertArgument(MlirBlock block, intptr_t pos, MlirType type, MlirLocation loc)
Inserts an argument of the specified type at a specified index to the block.
void mlirValueSetType(MlirValue value, MlirType type)
intptr_t mlirOperationGetNumSuccessors(MlirOperation op)
MlirDialect mlirAttributeGetDialect(MlirAttribute attr)
void mlirLocationPrint(MlirLocation location, MlirStringCallback callback, void *userData)
void mlirOperationSetAttributeByName(MlirOperation op, MlirStringRef name, MlirAttribute attr)
void mlirBlockDestroy(MlirBlock block)
Takes a block owned by the caller and destroys it.
void mlirIRMappingDestroy(MlirIRMapping mapping)
Destroys the given IRMapping.
void mlirRegionInsertOwnedBlock(MlirRegion region, intptr_t pos, MlirBlock block)
Takes a block owned by the caller and inserts it at pos to the given region.
void mlirOperationSetOperand(MlirOperation op, intptr_t pos, MlirValue newValue)
intptr_t mlirBlockGetNumArguments(MlirBlock block)
Returns the number of arguments of the block.
MlirTypeID mlirLocationFileLineColRangeGetTypeID()
TypeID Getter for FileLineColRange.
void mlirContextEndTransientScope(MlirContext context)
Ends the transient scope and resets the context to the base state, pruning transient types,...
MlirOperation mlirOpResultGetOwner(MlirValue value)
void mlirBlockEraseArgument(MlirBlock block, unsigned index)
Erase the argument at 'index' and remove it from the argument list.
bool mlirOpOperandIsNull(MlirOpOperand opOperand)
Returns whether the op operand is null.
MlirDialect mlirTypeGetDialect(MlirType type)
Gets the dialect a type belongs to.
MlirModule mlirModuleCreateParse(MlirContext context, MlirStringRef module)
MlirContext mlirContextCreateWithRegistry(MlirDialectRegistry registry, bool threadingEnabled)
Creates an MLIR context, setting the multithreading setting explicitly and pre-loading the dialects f...
size_t mlirOperationHashValue(MlirOperation op)
void mlirContextSetAllowUnregisteredDialects(MlirContext context, bool allow)
Sets whether unregistered dialects are allowed in this context.
void mlirIRMappingClear(MlirIRMapping mapping)
Clears all mappings.
void mlirOperationStateAddResults(MlirOperationState *state, intptr_t n, MlirType const *results)
void mlirOperationMoveBefore(MlirOperation op, MlirOperation other)
Moves the given operation immediately before the other operation in its parent block.
static LogicalResult inferOperationTypes(OperationState &state)
MlirOperation mlirOperationClone(MlirOperation op)
bool mlirLocationIsAUnknown(MlirLocation location)
Checks whether the given location is an Unknown.
void mlirValuePrintAsOperand(MlirValue value, MlirAsmState state, MlirStringCallback callback, void *userData)
Prints a value as an operand (i.e., the ValueID).
MlirBlock mlirBlockArgumentGetOwner(MlirValue value)
void mlirBlockArgumentSetLocation(MlirValue value, MlirLocation loc)
MlirDialectRegistry mlirDialectRegistryCreate()
Creates a dialect registry and transfers its ownership to the caller.
MlirValue mlirOperationGetOperand(MlirOperation op, intptr_t pos)
bool mlirContextGetAllowUnregisteredDialects(MlirContext context)
Returns whether the context allows unregistered dialects.
MlirAttribute mlirLocationGetAttribute(MlirLocation location)
Returns the underlying location attribute of this location.
MlirModule mlirModuleFromOperation(MlirOperation op)
MlirTypeID mlirLocationNameGetTypeID()
TypeID Getter for Name.
MlirOpOperand mlirOperationGetOpOperand(MlirOperation op, intptr_t pos)
MlirLocation mlirOperationGetLocation(MlirOperation op)
bool mlirTypeEqual(MlirType t1, MlirType t2)
Checks if two types are equal.
bool mlirContextEqual(MlirContext ctx1, MlirContext ctx2)
Checks if two contexts are equal.
void mlirIRMappingEraseOperation(MlirIRMapping mapping, MlirOperation op)
Erases an operation mapping.
MlirAttribute mlirOperationGetAttributeByName(MlirOperation op, MlirStringRef name)
bool mlirOperationIsBeforeInBlock(MlirOperation op, MlirOperation other)
Given an operation 'other' that is within the same parent block, return whether the current operation...
MlirTypeID mlirAttributeGetTypeID(MlirAttribute attr)
MlirAttribute mlirSymbolTableInsert(MlirSymbolTable symbolTable, MlirOperation operation)
Inserts the given operation into the given symbol table.
bool mlirLocationIsAFileLineColRange(MlirLocation location)
Checks whether the given location is an FileLineColRange.
intptr_t mlirOperationGetNumDiscardableAttributes(MlirOperation op)
MlirSymbolTable mlirSymbolTableCreate(MlirOperation operation)
Creates a symbol table for the given operation.
void mlirOperationStateAddOwnedRegions(MlirOperationState *state, intptr_t n, MlirRegion const *regions)
void mlirOperationSetLocation(MlirOperation op, MlirLocation loc)
MlirValue mlirIRMappingLookupOrNullValue(MlirIRMapping mapping, MlirValue from)
Looks up a mapped Value. Returns a null MlirValue if no mapping exists.
MlirLocation mlirLocationUnknownGet(MlirContext context)
Creates a location with unknown position owned by the given context.
MlirLocation mlirLocationCallSiteGetCallee(MlirLocation location)
Getter for callee of CallSite.
static Operation * findParent(Operation *op, bool shouldUseLocalScope)
MlirOperation mlirBlockGetFirstOperation(MlirBlock block)
Returns the first operation in the block.
static OperationEquivalence::Flags unwrapEquivalenceFlags(uint32_t flags)
Translates the C equivalence flags to mlir::OperationEquivalence::Flags.
MlirType mlirAttributeGetType(MlirAttribute attribute)
bool mlirOperationRemoveDiscardableAttributeByName(MlirOperation op, MlirStringRef name)
void mlirRegionDestroy(MlirRegion region)
Takes a region owned by the caller and destroys it.
bool mlirOperationRemoveAttributeByName(MlirOperation op, MlirStringRef name)
bool mlirValueIsAOpResult(MlirValue value)
MLIR_CAPI_EXPORTED bool mlirOperationHasInherentAttributeByName(MlirOperation op, MlirStringRef name)
MlirContext mlirContextCreateWithThreading(bool threadingEnabled)
Creates an MLIR context with an explicit setting of the multithreading setting and transfers its owne...
MlirTypeID mlirLocationCallSiteGetTypeID()
TypeID Getter for CallSite.
MlirBlock mlirBlockGetPredecessor(MlirBlock block, intptr_t pos)
MlirOperation mlirBlockGetTerminator(MlirBlock block)
Returns the terminator operation in the block or null if no terminator.
bool mlirLocationEqual(MlirLocation l1, MlirLocation l2)
Checks if two locations are equal.
size_t mlirOperationStructuralHashValue(MlirOperation op, uint32_t flags)
MlirRegion mlirOperationGetRegion(MlirOperation op, intptr_t pos)
void mlirOperationReplaceUsesOfWith(MlirOperation op, MlirValue oldValue, MlirValue newValue)
Replace uses of 'of' value with the 'with' value inside the 'op' operation.
int mlirLocationFileLineColRangeGetEndColumn(MlirLocation location)
Getter for end_column of FileLineColRange.
MlirOperation mlirOperationCreate(MlirOperationState *state)
bool mlirIRMappingContainsOperation(MlirIRMapping mapping, MlirOperation op)
Returns true if the mapping contains a mapping for the given operation.
unsigned mlirContextGetNumThreads(MlirContext context)
Gets the number of threads of the thread pool of the context when multithreading is enabled.
bool mlirOperationIsStructurallyEquivalent(MlirOperation lhs, MlirOperation rhs, uint32_t flags)
void mlirBytecodeWriterConfigDesiredEmitVersion(MlirBytecodeWriterConfig flags, int64_t version)
int mlirLocationFileLineColRangeGetStartColumn(MlirLocation location)
Getter for start_column of FileLineColRange.
MlirAttribute mlirAttributeParseGet(MlirContext context, MlirStringRef attr)
void mlirLocationFusedGetLocations(MlirLocation location, MlirLocation *locationsCPtr)
Getter for locations of Fused.
void mlirOperationRemoveFromParent(MlirOperation op)
void mlirSymbolTableDestroy(MlirSymbolTable symbolTable)
Destroys the symbol table created with mlirSymbolTableCreate.
intptr_t mlirBlockGetNumSuccessors(MlirBlock block)
MlirContext mlirContextCreate()
Creates an MLIR context and transfers its ownership to the caller.
void mlirOperationPrintWithState(MlirOperation op, MlirAsmState state, MlirStringCallback callback, void *userData)
Same as mlirOperationPrint but accepts AsmState controlling the printing behavior as well as caching ...
bool mlirOperationVerify(MlirOperation op)
Verify the operation and return true if it passes, false if it fails.
void mlirBlockDetach(MlirBlock block)
Detach a block from the owning region and assume ownership.
void mlirIRMappingMapOperation(MlirIRMapping mapping, MlirOperation from, MlirOperation to)
Maps an Operation in the mapping.
bool mlirIRMappingContainsValue(MlirIRMapping mapping, MlirValue value)
Returns true if the mapping contains a mapping for the given value.
int mlirLocationFileLineColRangeGetEndLine(MlirLocation location)
Getter for end_line of FileLineColRange.
MlirNamedAttribute mlirOperationGetAttribute(MlirOperation op, intptr_t pos)
void mlirOpPrintingFlagsDestroy(MlirOpPrintingFlags flags)
MlirLocation mlirLocationCallSiteGet(MlirLocation callee, MlirLocation caller)
Creates a call site location with a callee and a caller.
void mlirIRMappingEraseValue(MlirIRMapping mapping, MlirValue value)
Erases a value mapping.
void mlirOperationWriteBytecode(MlirOperation op, MlirStringCallback callback, void *userData)
Same as mlirOperationPrint but writing the bytecode format.
void mlirValueDump(MlirValue value)
MlirTypeID mlirLocationUnknownGetTypeID()
TypeID Getter for Unknown.
void mlirBlockInsertOwnedOperationAfter(MlirBlock block, MlirOperation reference, MlirOperation operation)
Takes an operation owned by the caller and inserts it after the (non-owned) reference operation in th...
void mlirIRMappingEraseBlock(MlirIRMapping mapping, MlirBlock block)
Erases a block mapping.
intptr_t mlirContextGetNumRegisteredDialects(MlirContext context)
Returns the number of dialects registered with the given context.
MlirTypeID mlirLocationFusedGetTypeID()
TypeID Getter for Fused.
void mlirOperationSetOperands(MlirOperation op, intptr_t nOperands, MlirValue const *operands)
static MLIRContext::Threading toThreadingEnum(bool threadingEnabled)
MlirIdentifier mlirLocationFileLineColRangeGetFilename(MlirLocation location)
Getter for filename of FileLineColRange.
MlirContext mlirTypeGetContext(MlirType type)
Gets the context that a type was created with.
void mlirTypePrint(MlirType type, MlirStringCallback callback, void *userData)
MlirBlock mlirModuleGetBody(MlirModule module)
MlirContext mlirDialectGetContext(MlirDialect dialect)
Returns the context that owns the dialect.
bool mlirRegionEqual(MlirRegion region, MlirRegion other)
Checks whether two region handles point to the same region.
int mlirLocationFileLineColRangeGetStartLine(MlirLocation location)
Getter for start_line of FileLineColRange.
MlirOperation mlirOperationCreateParse(MlirContext context, MlirStringRef sourceStr, MlirStringRef sourceName)
MlirOperation mlirIRMappingLookupOrNullOperation(MlirIRMapping mapping, MlirOperation from)
Looks up a mapped Operation.
MlirLocation mlirLocationCallSiteGetCaller(MlirLocation location)
Getter for caller of CallSite.
bool mlirContextIsInTransientScope(MlirContext context)
Returns whether the context is currently in a transient scope.
void mlirAsmStateDestroy(MlirAsmState state)
Destroys printing flags created with mlirAsmStateCreate.
MlirContext mlirOperationGetContext(MlirOperation op)
intptr_t mlirOpResultGetResultNumber(MlirValue value)
MlirLocation mlirLocationNameGet(MlirContext context, MlirStringRef name, MlirLocation childLoc)
Creates a name location owned by the given context.
MlirLocation mlirLocationFileLineColRangeGet(MlirContext context, MlirStringRef filename, unsigned startLine, unsigned startCol, unsigned endLine, unsigned endCol)
Creates an File/Line/Column range location owned by the given context.
bool mlirBlockEqual(MlirBlock block, MlirBlock other)
Checks whether two blocks handles point to the same block.
bool mlirLocationIsAFused(MlirLocation location)
Checks whether the given location is an Fused.
MlirAttribute mlirLocationFusedGetMetadata(MlirLocation location)
Getter for metadata of Fused.
void mlirSymbolTableErase(MlirSymbolTable symbolTable, MlirOperation operation)
Removes the given operation from the symbol table and erases it.
MlirLocation mlirLocationNameGetChildLoc(MlirLocation location)
Getter for childLoc of Name.
MlirNamedAttribute mlirOperationGetDiscardableAttribute(MlirOperation op, intptr_t pos)
void mlirOperationStateEnableResultTypeInference(MlirOperationState *state)
void mlirOperationStateAddSuccessors(MlirOperationState *state, intptr_t n, MlirBlock const *successors)
MlirBytecodeWriterConfig mlirBytecodeWriterConfigCreate()
void mlirAttributeDump(MlirAttribute attr)
Prints the attribute to the standard error stream.
void mlirOpPrintingFlagsPrintNameLocAsPrefix(MlirOpPrintingFlags flags)
MlirIdentifier mlirLocationNameGetName(MlirLocation location)
Getter for name of Name.
MlirStringRef mlirIdentifierStr(MlirIdentifier ident)
Gets the string value of the identifier.
void mlirOpPrintingFlagsSkipRegions(MlirOpPrintingFlags flags)
void mlirOperationStateAddOperands(MlirOperationState *state, intptr_t n, MlirValue const *operands)
MlirOperationState mlirOperationStateGet(MlirStringRef name, MlirLocation loc)
MlirLocation mlirLocationFromAttribute(MlirAttribute attribute)
Creates a location from a location attribute.
MlirOperation mlirBlockGetParentOperation(MlirBlock block)
Returns the closest surrounding operation that contains this block.
MlirOpOperand mlirOpOperandGetNextUse(MlirOpOperand opOperand)
Returns an op operand representing the next use of the value, or a null op operand if there is no nex...
void mlirValueReplaceUsesWithIf(MlirValue of, MlirValue with, MlirOpOperandReplaceFilterCallback filter, void *userData)
Replace uses of 'of' value with 'with' value, but only for the uses for which the filter callback ret...
intptr_t mlirOperationGetNumOperands(MlirOperation op)
void mlirIRMappingMapValue(MlirIRMapping mapping, MlirValue from, MlirValue to)
Maps a Value in the mapping.
void mlirContextSetThreadPool(MlirContext context, MlirLlvmThreadPool threadPool)
Sets the thread pool of the context explicitly, enabling multithreading in the process.
MlirType mlirTypeParseGet(MlirContext context, MlirStringRef type)
Parses a type. The type is owned by the context.
MlirBlock mlirBlockCreate(intptr_t nArgs, MlirType const *args, MlirLocation const *locs)
Creates a new empty block with the given argument types and transfers ownership to the caller.
void mlirContextEnableMultithreading(MlirContext context, bool enable)
Set threading mode (must be set to false to mlir-print-ir-after-all).
void mlirTypeDump(MlirType type)
intptr_t mlirOperationGetNumAttributes(MlirOperation op)
MlirContext mlirValueGetContext(MlirValue v)
Gets the context that a value was created with.
static llvm::ArrayRef< CppTy > unwrapList(size_t size, CTy *first, llvm::SmallVectorImpl< CppTy > &storage)
This class provides management for the lifetime of the state used when printing the IR.
Attributes are known-constant values of operations.
MLIRContext * getContext() const
Return the context this attribute belongs to.
Block represents an ordered list of Operations.
OpListType::iterator iterator
OpListType & getOperations()
PredecessorIterator pred_iterator
This class contains the configuration used for the bytecode writer.
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
static FileLineColLoc get(StringAttr filename, unsigned line, unsigned column)
This is a utility class for mapping one set of IR entities to another.
Location objects represent source locations information in MLIR.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
MLIRContext is the top-level object for a collection of MLIR operations.
DictionaryAttr getDictionary(MLIRContext *context) const
Return a dictionary attribute for the underlying dictionary.
void reserve(size_type N)
NamedAttribute represents a combination of a name and an Attribute value.
StringAttr getName() const
Return the name of the attribute.
Attribute getValue() const
Return the value of the attribute.
This class represents an operand of an operation.
Set of flags used to control the behavior of the various IR print methods (e.g.
This class provides the API for ops that are known to be isolated from above.
This class provides the API for ops that are known to be terminators.
StringRef getStringRef() const
Return the name of this operation. This always succeeds.
bool hasTrait() const
Returns true if the operation was registered with a particular trait, e.g.
std::optional< RegisteredOperationName > getRegisteredInfo() const
If this operation is registered, returns the registered information, std::nullopt otherwise.
Operation is the basic unit of execution within MLIR.
Region & getRegion(unsigned index)
Returns the region held by this operation at position 'index'.
bool hasTrait()
Returns true if the operation was registered with a particular trait, e.g.
unsigned getNumRegions()
Returns the number of regions held by this operation.
Operation * getParentOp()
Returns the closest surrounding operation that contains this operation or nullptr if this is a top-le...
static Operation * create(Location location, OperationName name, TypeRange resultTypes, ValueRange operands, NamedAttrList &&attributes, PropertyRef properties, BlockRange successors, unsigned numRegions)
Create a new Operation with the specific fields.
This class acts as an owning reference to an op, and will automatically destroy the held op on destru...
OpTy release()
Release the referenced op.
Type-safe wrapper around a void* for passing properties, including the properties structs of operatio...
This class contains a list of basic blocks and a link to the parent operation it is attached to.
unsigned getRegionNumber()
Return the number of this region in the parent operation.
Operation * getParentOp()
Return the parent operation this region is attached to.
BlockListType & getBlocks()
BlockListType::iterator iterator
This class allows for representing and managing the symbol table used by operations with the 'SymbolT...
static StringRef getSymbolAttrName()
Return the name of the attribute used for symbol names.
static LogicalResult replaceAllSymbolUses(StringAttr oldSymbol, StringAttr newSymbol, Operation *from)
Attempt to replace all uses of the given symbol 'oldSymbol' with the provided symbol 'newSymbol' that...
static StringRef getVisibilityAttrName()
Return the name of the attribute used for symbol visibility.
static void walkSymbolTables(Operation *op, bool allSymUsesVisible, function_ref< void(Operation *, bool)> callback)
Walks all symbol table operations nested within, and including, op.
OperandType * getOperand() const
Returns the current operands.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
bool use_empty() const
Returns true if this value has no uses.
void replaceAllUsesExcept(Value newValue, const SmallPtrSetImpl< Operation * > &exceptions)
Replace all uses of 'this' value with 'newValue', updating anything in the IR that uses 'this' to use...
void printAsOperand(raw_ostream &os, AsmState &state) const
Print this value as if it were an operand.
Location getLoc() const
Return the location of this value.
use_iterator use_begin() const
A utility result that is used to signal how to proceed with an ongoing walk:
static WalkResult advance()
static WalkResult interrupt()
A simple raw ostream subclass that forwards write_impl calls to the user-supplied callback together w...
MlirDiagnostic wrap(mlir::Diagnostic &diagnostic)
mlir::Diagnostic & unwrap(MlirDiagnostic diagnostic)
MlirWalkResult(* MlirOperationWalkCallback)(MlirOperation, void *userData)
Operation walker type.
MlirWalkOrder
Traversal order for operation walk.
bool(* MlirOpOperandReplaceFilterCallback)(MlirOpOperand opOperand, void *userData)
Callback deciding whether a particular use should be replaced.
MlirWalkResult
Operation walk result.
@ MlirWalkResultInterrupt
static bool mlirBlockIsNull(MlirBlock block)
Checks whether a block is null.
static bool mlirLocationIsNull(MlirLocation location)
Checks if the location is null.
#define MLIR_CAPI_EXPORTED
void(* MlirStringCallback)(MlirStringRef, void *)
A callback for returning string references.
Include the generated interface declarations.
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
Attribute parseAttribute(llvm::StringRef attrStr, MLIRContext *context, Type type={}, size_t *numRead=nullptr, bool isKnownNullTerminated=false)
This parses a single MLIR attribute to an MLIR context if it was valid.
LogicalResult parseSourceString(llvm::StringRef sourceStr, Block *block, const ParserConfig &config, StringRef sourceName="", LocationAttr *sourceFileLoc=nullptr)
This parses the IR string and appends parsed operations to the given block.
Operation * clone(OpBuilder &b, Operation *op, TypeRange newResultTypes, ValueRange newOperands)
LogicalResult parseSourceFile(const llvm::SourceMgr &sourceMgr, Block *block, const ParserConfig &config, LocationAttr *sourceFileLoc=nullptr)
This parses the file specified by the indicated SourceMgr and appends parsed operations to the given ...
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
Type parseType(llvm::StringRef typeStr, MLIRContext *context, size_t *numRead=nullptr, bool isKnownNullTerminated=false)
This parses a single MLIR type to an MLIR context if it was valid.
LogicalResult writeBytecodeToFile(Operation *op, raw_ostream &os, const BytecodeWriterConfig &config={})
Write the bytecode for the given operation to the provided output stream.
LogicalResult verify(Operation *op, bool verifyRecursively=true)
Perform (potentially expensive) checks of invariants, used to detect compiler bugs,...
A logical result value, essentially a boolean with named states.
A pointer to a sized fragment of a string, not necessarily null-terminated.
const char * data
Pointer to the first symbol.
size_t length
Length of the fragment.
static llvm::hash_code ignoreHashValue(Value)
Helper that can be used with computeHash above to ignore operation operands/result mapping.
static bool isEquivalentTo(Operation *lhs, Operation *rhs, function_ref< LogicalResult(Value, Value)> checkEquivalent, function_ref< void(Value, Value)> markEquivalent=nullptr, Flags flags=Flags::None, function_ref< LogicalResult(ValueRange, ValueRange)> checkCommutativeEquivalent=nullptr)
Compare two operations (including their regions) and return if they are equivalent.
static llvm::hash_code directHashValue(Value v)
Helper that can be used with computeHash to compute the hash value of operands/results directly.
static llvm::hash_code computeHash(Operation *op, function_ref< llvm::hash_code(Value)> hashOperands=[](Value v) { return hash_value(v);}, function_ref< llvm::hash_code(Value)> hashResults=[](Value v) { return hash_value(v);}, Flags flags=Flags::None)
Compute a hash for the given operation.
This represents an operation in an abstracted form, suitable for use with the builder APIs.
SmallVector< Value, 4 > operands
void addOperands(ValueRange newOperands)
void addAttribute(StringRef name, Attribute attr)
Add an attribute with the specified name.
void addSuccessors(Block *successor)
Adds a successor to the operation sate. successor must not be null.
void addTypes(ArrayRef< Type > newTypes)
MLIRContext * getContext() const
Get the context held by this operation state.
SmallVector< std::unique_ptr< Region >, 1 > regions
Regions that the op will hold.
PropertyRef getRawProperties()
SmallVector< Type, 4 > types
Types of the results of this operation.
Region * addRegion()
Create a region that should be attached to the operation.