llvm/mlir/lib/IR/OperationSupport.cpp

//===- OperationSupport.cpp -----------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This file contains out-of-line implementations of the support types that
// Operation and related classes build on top of.
//
//===----------------------------------------------------------------------===//

#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/OpDefinition.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/Support/SHA1.h"
#include <numeric>
#include <optional>

usingnamespacemlir;

//===----------------------------------------------------------------------===//
// NamedAttrList
//===----------------------------------------------------------------------===//

NamedAttrList::NamedAttrList(ArrayRef<NamedAttribute> attributes) {}

NamedAttrList::NamedAttrList(DictionaryAttr attributes)
    :{}

NamedAttrList::NamedAttrList(const_iterator inStart, const_iterator inEnd) {}

ArrayRef<NamedAttribute> NamedAttrList::getAttrs() const {}

std::optional<NamedAttribute> NamedAttrList::findDuplicate() const {}

DictionaryAttr NamedAttrList::getDictionary(MLIRContext *context) const {}

/// Add an attribute with the specified name.
void NamedAttrList::append(StringRef name, Attribute attr) {}

/// Replaces the attributes with new list of attributes.
void NamedAttrList::assign(const_iterator inStart, const_iterator inEnd) {}

void NamedAttrList::push_back(NamedAttribute newAttribute) {}

/// Return the specified attribute if present, null otherwise.
Attribute NamedAttrList::get(StringRef name) const {}
Attribute NamedAttrList::get(StringAttr name) const {}

/// Return the specified named attribute if present, std::nullopt otherwise.
std::optional<NamedAttribute> NamedAttrList::getNamed(StringRef name) const {}
std::optional<NamedAttribute> NamedAttrList::getNamed(StringAttr name) const {}

/// If the an attribute exists with the specified name, change it to the new
/// value.  Otherwise, add a new attribute with the specified name/value.
Attribute NamedAttrList::set(StringAttr name, Attribute value) {}

Attribute NamedAttrList::set(StringRef name, Attribute value) {}

Attribute
NamedAttrList::eraseImpl(SmallVectorImpl<NamedAttribute>::iterator it) {}

Attribute NamedAttrList::erase(StringAttr name) {}

Attribute NamedAttrList::erase(StringRef name) {}

NamedAttrList &
NamedAttrList::operator=(const SmallVectorImpl<NamedAttribute> &rhs) {}

operator ArrayRef()

//===----------------------------------------------------------------------===//
// OperationState
//===----------------------------------------------------------------------===//

OperationState::OperationState(Location location, StringRef name)
    :{}

OperationState::OperationState(Location location, OperationName name)
    :{}

OperationState::OperationState(Location location, OperationName name,
                               ValueRange operands, TypeRange types,
                               ArrayRef<NamedAttribute> attributes,
                               BlockRange successors,
                               MutableArrayRef<std::unique_ptr<Region>> regions)
    :{}
OperationState::OperationState(Location location, StringRef name,
                               ValueRange operands, TypeRange types,
                               ArrayRef<NamedAttribute> attributes,
                               BlockRange successors,
                               MutableArrayRef<std::unique_ptr<Region>> regions)
    :{}

OperationState::~OperationState() {}

LogicalResult OperationState::setProperties(
    Operation *op, function_ref<InFlightDiagnostic()> emitError) const {}

void OperationState::addOperands(ValueRange newOperands) {}

void OperationState::addSuccessors(BlockRange newSuccessors) {}

Region *OperationState::addRegion() {}

void OperationState::addRegion(std::unique_ptr<Region> &&region) {}

void OperationState::addRegions(
    MutableArrayRef<std::unique_ptr<Region>> regions) {}

//===----------------------------------------------------------------------===//
// OperandStorage
//===----------------------------------------------------------------------===//

detail::OperandStorage::OperandStorage(Operation *owner,
                                       OpOperand *trailingOperands,
                                       ValueRange values)
    :{}

detail::OperandStorage::~OperandStorage() {}

/// Replace the operands contained in the storage with the ones provided in
/// 'values'.
void detail::OperandStorage::setOperands(Operation *owner, ValueRange values) {}

/// Replace the operands beginning at 'start' and ending at 'start' + 'length'
/// with the ones provided in 'operands'. 'operands' may be smaller or larger
/// than the range pointed to by 'start'+'length'.
void detail::OperandStorage::setOperands(Operation *owner, unsigned start,
                                         unsigned length, ValueRange operands) {}

/// Erase an operand held by the storage.
void detail::OperandStorage::eraseOperands(unsigned start, unsigned length) {}

void detail::OperandStorage::eraseOperands(const BitVector &eraseIndices) {}

/// Resize the storage to the given size. Returns the array containing the new
/// operands.
MutableArrayRef<OpOperand> detail::OperandStorage::resize(Operation *owner,
                                                          unsigned newSize) {}

//===----------------------------------------------------------------------===//
// Operation Value-Iterators
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
// OperandRange

unsigned OperandRange::getBeginOperandIndex() const {}

OperandRangeRange OperandRange::split(DenseI32ArrayAttr segmentSizes) const {}

//===----------------------------------------------------------------------===//
// OperandRangeRange

OperandRangeRange::OperandRangeRange(OperandRange operands,
                                     Attribute operandSegments)
    :{}

OperandRange OperandRangeRange::join() const {}

OperandRange OperandRangeRange::dereference(const OwnerT &object,
                                            ptrdiff_t index) {}

//===----------------------------------------------------------------------===//
// MutableOperandRange

/// Construct a new mutable range from the given operand, operand start index,
/// and range length.
MutableOperandRange::MutableOperandRange(
    Operation *owner, unsigned start, unsigned length,
    ArrayRef<OperandSegment> operandSegments)
    :{}
MutableOperandRange::MutableOperandRange(Operation *owner)
    :{}

/// Construct a new mutable range for the given OpOperand.
MutableOperandRange::MutableOperandRange(OpOperand &opOperand)
    :{}

/// Slice this range into a sub range, with the additional operand segment.
MutableOperandRange
MutableOperandRange::slice(unsigned subStart, unsigned subLen,
                           std::optional<OperandSegment> segment) const {}

/// Append the given values to the range.
void MutableOperandRange::append(ValueRange values) {}

/// Assign this range to the given values.
void MutableOperandRange::assign(ValueRange values) {}

/// Assign the range to the given value.
void MutableOperandRange::assign(Value value) {}

/// Erase the operands within the given sub-range.
void MutableOperandRange::erase(unsigned subStart, unsigned subLen) {}

/// Clear this range and erase all of the operands.
void MutableOperandRange::clear() {}

/// Explicit conversion to an OperandRange.
OperandRange MutableOperandRange::getAsOperandRange() const {}

/// Allow implicit conversion to an OperandRange.
operator OperandRange()

operator MutableArrayRef()

MutableOperandRangeRange
MutableOperandRange::split(NamedAttribute segmentSizes) const {}

/// Update the length of this range to the one provided.
void MutableOperandRange::updateLength(unsigned newLength) {}

OpOperand &MutableOperandRange::operator[](unsigned index) const {}

MutableArrayRef<OpOperand>::iterator MutableOperandRange::begin() const {}

MutableArrayRef<OpOperand>::iterator MutableOperandRange::end() const {}

//===----------------------------------------------------------------------===//
// MutableOperandRangeRange

MutableOperandRangeRange::MutableOperandRangeRange(
    const MutableOperandRange &operands, NamedAttribute operandSegmentAttr)
    :{}

MutableOperandRange MutableOperandRangeRange::join() const {}

operator OperandRangeRange()

MutableOperandRange MutableOperandRangeRange::dereference(const OwnerT &object,
                                                          ptrdiff_t index) {}

//===----------------------------------------------------------------------===//
// ResultRange

ResultRange::ResultRange(OpResult result)
    :{}

ResultRange::use_range ResultRange::getUses() const {}
ResultRange::use_iterator ResultRange::use_begin() const {}
ResultRange::use_iterator ResultRange::use_end() const {}
ResultRange::user_range ResultRange::getUsers() {}
ResultRange::user_iterator ResultRange::user_begin() {}
ResultRange::user_iterator ResultRange::user_end() {}

ResultRange::UseIterator::UseIterator(ResultRange results, bool end)
    :{}

ResultRange::UseIterator &ResultRange::UseIterator::operator++() {}

void ResultRange::UseIterator::skipOverResultsWithNoUsers() {}

void ResultRange::replaceAllUsesWith(Operation *op) {}

void ResultRange::replaceUsesWithIf(
    Operation *op, function_ref<bool(OpOperand &)> shouldReplace) {}

//===----------------------------------------------------------------------===//
// ValueRange

ValueRange::ValueRange(ArrayRef<Value> values)
    :{}
ValueRange::ValueRange(OperandRange values)
    :{}
ValueRange::ValueRange(ResultRange values)
    :{}

/// See `llvm::detail::indexed_accessor_range_base` for details.
ValueRange::OwnerT ValueRange::offset_base(const OwnerT &owner,
                                           ptrdiff_t index) {}
/// See `llvm::detail::indexed_accessor_range_base` for details.
Value ValueRange::dereference_iterator(const OwnerT &owner, ptrdiff_t index) {}

//===----------------------------------------------------------------------===//
// Operation Equivalency
//===----------------------------------------------------------------------===//

llvm::hash_code OperationEquivalence::computeHash(
    Operation *op, function_ref<llvm::hash_code(Value)> hashOperands,
    function_ref<llvm::hash_code(Value)> hashResults, Flags flags) {}

/*static*/ bool OperationEquivalence::isRegionEquivalentTo(
    Region *lhs, Region *rhs,
    function_ref<LogicalResult(Value, Value)> checkEquivalent,
    function_ref<void(Value, Value)> markEquivalent,
    OperationEquivalence::Flags flags,
    function_ref<LogicalResult(ValueRange, ValueRange)>
        checkCommutativeEquivalent) {}

// Value equivalence cache to be used with `isRegionEquivalentTo` and
// `isEquivalentTo`.
struct ValueEquivalenceCache {};

/*static*/ bool
OperationEquivalence::isRegionEquivalentTo(Region *lhs, Region *rhs,
                                           OperationEquivalence::Flags flags) {}

/*static*/ bool OperationEquivalence::isEquivalentTo(
    Operation *lhs, Operation *rhs,
    function_ref<LogicalResult(Value, Value)> checkEquivalent,
    function_ref<void(Value, Value)> markEquivalent, Flags flags,
    function_ref<LogicalResult(ValueRange, ValueRange)>
        checkCommutativeEquivalent) {}

/*static*/ bool OperationEquivalence::isEquivalentTo(Operation *lhs,
                                                     Operation *rhs,
                                                     Flags flags) {}

//===----------------------------------------------------------------------===//
// OperationFingerPrint
//===----------------------------------------------------------------------===//

template <typename T>
static void addDataToHash(llvm::SHA1 &hasher, const T &data) {}

OperationFingerPrint::OperationFingerPrint(Operation *topOp,
                                           bool includeNested) {}