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());
163 MlirOpPrintingFlags flags) {
184 MlirOpPrintingFlags flags) {
187 if (
auto result = llvm::dyn_cast<OpResult>(val)) {
190 op = llvm::cast<BlockArgument>(val).getOwner()->
getParentOp();
217 unwrap(flags)->elideLargeElementsAttrs(largeElementLimit);
222 unwrap(flags)->elideLargeResourceString(largeResourceLimit);
227 unwrap(flags)->enableDebugInfo(enable, prettyForm);
231 unwrap(flags)->printGenericOpForm();
235 unwrap(flags)->printNameLocAsPrefix();
239 unwrap(flags)->useLocalScope();
243 unwrap(flags)->assumeVerified();
247 unwrap(flags)->skipRegions();
263 unwrap(flags)->setDesiredBytecodeVersion(version);
287 unsigned startLine,
unsigned startCol,
288 unsigned endLine,
unsigned endCol) {
291 startLine, startCol, endLine, endCol)));
295 return wrap(llvm::dyn_cast<FileLineColRange>(
unwrap(location)).getFilename());
299 if (
auto loc = llvm::dyn_cast<FileLineColRange>(
unwrap(location)))
300 return loc.getStartLine();
305 if (
auto loc = llvm::dyn_cast<FileLineColRange>(
unwrap(location)))
306 return loc.getStartColumn();
311 if (
auto loc = llvm::dyn_cast<FileLineColRange>(
unwrap(location)))
312 return loc.getEndLine();
317 if (
auto loc = llvm::dyn_cast<FileLineColRange>(
unwrap(location)))
318 return loc.getEndColumn();
323 return wrap(FileLineColRange::getTypeID());
327 return isa<FileLineColRange>(
unwrap(location));
336 Location(llvm::dyn_cast<CallSiteLoc>(
unwrap(location)).getCallee()));
341 Location(llvm::dyn_cast<CallSiteLoc>(
unwrap(location)).getCaller()));
345 return wrap(CallSiteLoc::getTypeID());
349 return isa<CallSiteLoc>(
unwrap(location));
353 MlirLocation
const *locations,
354 MlirAttribute metadata) {
361 if (
auto locationsArrRef = llvm::dyn_cast<FusedLoc>(
unwrap(location)))
362 return locationsArrRef.getLocations().size();
367 MlirLocation *locationsCPtr) {
368 if (
auto locationsArrRef = llvm::dyn_cast<FusedLoc>(
unwrap(location))) {
369 for (
auto [i, location] : llvm::enumerate(locationsArrRef.getLocations()))
370 locationsCPtr[i] =
wrap(location);
375 return wrap(llvm::dyn_cast<FusedLoc>(
unwrap(location)).getMetadata());
381 return isa<FusedLoc>(
unwrap(location));
385 MlirLocation childLoc) {
394 return wrap((llvm::dyn_cast<NameLoc>(
unwrap(location)).getName()));
399 Location(llvm::dyn_cast<NameLoc>(
unwrap(location)).getChildLoc()));
405 return isa<NameLoc>(
unwrap(location));
413 return wrap(UnknownLoc::getTypeID());
417 return isa<UnknownLoc>(
unwrap(location));
431 unwrap(location).print(stream);
439 return wrap(ModuleOp::create(
unwrap(location)));
446 return MlirModule{
nullptr};
447 return MlirModule{owning.
release().getOperation()};
455 return MlirModule{
nullptr};
456 return MlirModule{owning.
release().getOperation()};
494 MlirOperationState state;
496 state.location = loc;
498 state.results =
nullptr;
500 state.operands =
nullptr;
502 state.regions =
nullptr;
503 state.nSuccessors = 0;
504 state.successors =
nullptr;
505 state.nAttributes = 0;
506 state.attributes =
nullptr;
507 state.enableResultTypeInference =
false;
511#define APPEND_ELEMS(type, sizeName, elemName) \
513 (type *)realloc(state->elemName, (state->sizeName + n) * sizeof(type)); \
514 memcpy(state->elemName + state->sizeName, elemName, n * sizeof(type)); \
515 state->sizeName += n;
518 MlirType
const *results) {
523 MlirValue
const *operands) {
527 MlirRegion
const *regions) {
531 MlirBlock
const *successors) {
540 state->enableResultTypeInference =
true;
552 <<
"type inference was requested for the operation " << state.
name
553 <<
", but the operation was not registered; ensure that the dialect "
554 "containing the operation is linked into MLIR and registered with "
559 auto *inferInterface = info->getInterface<InferTypeOpInterface>();
560 if (!inferInterface) {
562 <<
"type inference was requested for the operation " << state.
name
563 <<
", but the operation does not support type inference; result "
564 "types must be specified explicitly";
571 if (!properties && info->getOpPropertyByteSize() > 0 && !attributes.empty()) {
572 auto propAlloc = std::make_unique<char[]>(info->getOpPropertyByteSize());
573 properties =
PropertyRef(info->getOpPropertiesTypeID(), propAlloc.get());
577 <<
" failed properties conversion while building "
580 if (failed(info->setOpPropertiesFromAttribute(state.
name, properties,
584 if (succeeded(inferInterface->inferReturnTypes(
593 if (succeeded(inferInterface->inferReturnTypes(
610 unwrapList(state->nOperands, state->operands, operandStorage));
612 unwrapList(state->nSuccessors, state->successors, successorStorage));
615 for (
intptr_t i = 0; i < state->nAttributes; ++i)
617 unwrap(state->attributes[i].attribute));
619 for (
intptr_t i = 0; i < state->nRegions; ++i)
620 cppState.
addRegion(std::unique_ptr<Region>(
unwrap(state->regions[i])));
622 free(state->results);
623 free(state->operands);
624 free(state->successors);
625 free(state->regions);
626 free(state->attributes);
629 if (state->enableResultTypeInference) {
630 assert(cppState.
types.empty() &&
631 "result type inference enabled and result types provided");
688 MlirContext context) {
702 if (
auto info =
unwrap(op)->getRegisteredInfo())
703 return wrap(info->getTypeID());
708 return wrap(
unwrap(op)->getName().getIdentifier());
724 return wrap(&
unwrap(op)->getRegion(
static_cast<unsigned>(pos)));
752 return wrap(
unwrap(op)->getOperand(
static_cast<unsigned>(pos)));
756 return wrap(&
unwrap(op)->getOpOperand(
static_cast<unsigned>(pos)));
760 MlirValue newValue) {
761 unwrap(op)->setOperand(
static_cast<unsigned>(pos),
unwrap(newValue));
765 MlirValue
const *operands) {
775 return wrap(
unwrap(op)->getResult(
static_cast<unsigned>(pos)));
783 return wrap(
unwrap(op)->getSuccessor(
static_cast<unsigned>(pos)));
788 std::optional<Attribute> attr =
unwrap(op)->getInherentAttr(
unwrap(name));
789 return attr.has_value();
794 std::optional<Attribute> attr =
unwrap(op)->getInherentAttr(
unwrap(name));
795 if (attr.has_value())
802 MlirAttribute attr) {
803 unwrap(op)->setInherentAttr(
809 llvm::range_size(
unwrap(op)->getDiscardableAttrs()));
815 *std::next(
unwrap(op)->getDiscardableAttrs().begin(), pos);
826 MlirAttribute attr) {
832 return !!
unwrap(op)->removeDiscardableAttr(
unwrap(name));
837 unwrap(op)->setSuccessor(
unwrap(block),
static_cast<unsigned>(pos));
855 MlirAttribute attr) {
866 unwrap(op)->print(stream);
881 unwrap(op)->print(stream);
892 MlirOperation op, MlirBytecodeWriterConfig config,
927 llvm_unreachable(
"unknown result in WalkResult::unwrap");
949 MlirValue newValue) {
965 if (cppRegion->
empty())
966 return wrap(
static_cast<Block *
>(
nullptr));
976 auto &blockList =
unwrap(region)->getBlocks();
977 blockList.insert(std::next(blockList.begin(), pos),
unwrap(block));
988 assert(
unwrap(reference)->getParent() ==
unwrap(region) &&
989 "expected reference block to belong to the region");
999 assert(
unwrap(reference)->getParent() ==
unwrap(region) &&
1000 "expected reference block to belong to the region");
1006 delete static_cast<Region *
>(region.ptr);
1018 MlirLocation
const *locs) {
1020 for (
intptr_t i = 0; i < nArgs; ++i)
1043 if (cppBlock->
empty())
1050 if (cppBlock->
empty())
1063 MlirOperation operation) {
1064 auto &opList =
unwrap(block)->getOperations();
1065 opList.insert(std::next(opList.begin(), pos),
unwrap(operation));
1069 MlirOperation reference,
1070 MlirOperation operation) {
1072 if (mlirOperationIsNull(reference)) {
1077 assert(
unwrap(reference)->getBlock() ==
unwrap(block) &&
1078 "expected reference operation to belong to the block");
1084 MlirOperation reference,
1085 MlirOperation operation) {
1086 if (mlirOperationIsNull(reference))
1089 assert(
unwrap(reference)->getBlock() ==
unwrap(block) &&
1090 "expected reference operation to belong to the block");
1099 b->getParent()->getBlocks().remove(
b);
1121 return wrap(
unwrap(block)->getArgument(
static_cast<unsigned>(pos)));
1127 unwrap(block)->print(stream);
1135 return wrap(
unwrap(block)->getSuccessor(
static_cast<unsigned>(pos)));
1140 return static_cast<intptr_t>(std::distance(
b->pred_begin(),
b->pred_end()));
1146 std::advance(it, pos);
1159 return llvm::isa<BlockArgument>(
unwrap(value));
1163 return llvm::isa<OpResult>(
unwrap(value));
1167 return wrap(llvm::dyn_cast<BlockArgument>(
unwrap(value)).getOwner());
1172 llvm::dyn_cast<BlockArgument>(
unwrap(value)).getArgNumber());
1176 if (
auto blockArg = llvm::dyn_cast<BlockArgument>(
unwrap(value)))
1177 blockArg.setType(
unwrap(type));
1181 if (
auto blockArg = llvm::dyn_cast<BlockArgument>(
unwrap(value)))
1182 blockArg.setLoc(
unwrap(loc));
1186 return wrap(llvm::dyn_cast<OpResult>(
unwrap(value)).getOwner());
1191 llvm::dyn_cast<OpResult>(
unwrap(value)).getResultNumber());
1207 unwrap(value).print(stream);
1224 return wrap(opOperand);
1233 MlirOperation *exceptions) {
1238 for (
intptr_t i = 0; i < numExceptions; ++i) {
1239 exceptionSet.insert(
unwrap(exceptions[i]));
1248 assert(filter &&
"expected non-null filter callback");
1250 [filter, userData](
OpOperand &operand) ->
bool {
1251 return filter(
wrap(&operand), userData);
1278 return unwrap(opOperand)->getOperandNumber();
1286 unwrap(opOperand)->getNextOperandUsingThisValue());
1291 return wrap(nextOpOperand);
1320 unwrap(type).print(stream);
1339 if (
auto typedAttr = llvm::dyn_cast<TypedAttr>(attr))
1340 return wrap(typedAttr.getType());
1359 unwrap(attr).print(stream);
1365 MlirAttribute attr) {
1402 if (!
unwrap(operation)->hasTrait<OpTrait::SymbolTable>())
1408 delete unwrap(symbolTable);
1417 MlirOperation operation) {
1422 MlirOperation operation) {
1428 MlirOperation from) {
1429 auto *cppFrom =
unwrap(from);
1430 auto *context = cppFrom->getContext();
1431 auto oldSymbolAttr = StringAttr::get(context,
unwrap(oldSymbol));
1432 auto newSymbolAttr = StringAttr::get(context,
unwrap(newSymbol));
1438 void (*callback)(MlirOperation,
bool,
1442 [&](
Operation *foundOpCpp,
bool isVisible) {
1443 callback(
wrap(foundOpCpp), isVisible,
1494 MlirOperation from) {
1499 MlirOperation from) {
1528 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.
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.
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.
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.