//===- Region.cpp - MLIR Region Class -------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "mlir/IR/Region.h" #include "mlir/IR/IRMapping.h" #include "mlir/IR/Operation.h" usingnamespacemlir; Region::Region(Operation *container) : … { … } Region::~Region() { … } /// Return the context this region is inserted in. The region must have a valid /// parent container. MLIRContext *Region::getContext() { … } /// Return a location for this region. This is the location attached to the /// parent container. The region must have a valid parent container. Location Region::getLoc() { … } auto Region::getArgumentTypes() -> ValueTypeRange<BlockArgListType> { … } iterator_range<Region::args_iterator> Region::addArguments(TypeRange types, ArrayRef<Location> locs) { … } Region *Region::getParentRegion() { … } bool Region::isProperAncestor(Region *other) { … } /// Return the number of this region in the parent operation. unsigned Region::getRegionNumber() { … } /// Clone the internal blocks from this region into `dest`. Any /// cloned blocks are appended to the back of dest. void Region::cloneInto(Region *dest, IRMapping &mapper) { … } /// Clone this region into 'dest' before the given position in 'dest'. void Region::cloneInto(Region *dest, Region::iterator destPos, IRMapping &mapper) { … } /// Returns 'block' if 'block' lies in this region, or otherwise finds the /// ancestor of 'block' that lies in this region. Returns nullptr if the latter /// fails. Block *Region::findAncestorBlockInRegion(Block &block) { … } /// Returns 'op' if 'op' lies in this region, or otherwise finds the /// ancestor of 'op' that lies in this region. Returns nullptr if the /// latter fails. Operation *Region::findAncestorOpInRegion(Operation &op) { … } void Region::dropAllReferences() { … } Region *llvm::ilist_traits<::mlir::Block>::getParentRegion() { … } /// This is a trait method invoked when a basic block is added to a region. /// We keep the region pointer up to date. void llvm::ilist_traits<::mlir::Block>::addNodeToList(Block *block) { … } /// This is a trait method invoked when an operation is removed from a /// region. We keep the region pointer up to date. void llvm::ilist_traits<::mlir::Block>::removeNodeFromList(Block *block) { … } /// This is a trait method invoked when an operation is moved from one block /// to another. We keep the block pointer up to date. void llvm::ilist_traits<::mlir::Block>::transferNodesFromList( ilist_traits<Block> &otherList, block_iterator first, block_iterator last) { … } //===----------------------------------------------------------------------===// // Region::OpIterator //===----------------------------------------------------------------------===// Region::OpIterator::OpIterator(Region *region, bool end) : … { … } Region::OpIterator &Region::OpIterator::operator++() { … } void Region::OpIterator::skipOverBlocksWithNoOps() { … } //===----------------------------------------------------------------------===// // RegionRange //===----------------------------------------------------------------------===// RegionRange::RegionRange(MutableArrayRef<Region> regions) : … { … } RegionRange::RegionRange(ArrayRef<std::unique_ptr<Region>> regions) : … { … } RegionRange::RegionRange(ArrayRef<Region *> regions) : … { … } /// See `llvm::detail::indexed_accessor_range_base` for details. RegionRange::OwnerT RegionRange::offset_base(const OwnerT &owner, ptrdiff_t index) { … } /// See `llvm::detail::indexed_accessor_range_base` for details. Region *RegionRange::dereference_iterator(const OwnerT &owner, ptrdiff_t index) { … }