#include "mlir/IR/Operation.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Matchers.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/FoldInterfaces.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/ErrorHandling.h"
#include <numeric>
#include <optional>
usingnamespacemlir;
Operation *Operation::create(const OperationState &state) { … }
Operation *Operation::create(Location location, OperationName name,
TypeRange resultTypes, ValueRange operands,
NamedAttrList &&attributes,
OpaqueProperties properties, BlockRange successors,
RegionRange regions) { … }
Operation *Operation::create(Location location, OperationName name,
TypeRange resultTypes, ValueRange operands,
NamedAttrList &&attributes,
OpaqueProperties properties, BlockRange successors,
unsigned numRegions) { … }
Operation *Operation::create(Location location, OperationName name,
TypeRange resultTypes, ValueRange operands,
DictionaryAttr attributes,
OpaqueProperties properties, BlockRange successors,
unsigned numRegions) { … }
Operation::Operation(Location location, OperationName name, unsigned numResults,
unsigned numSuccessors, unsigned numRegions,
int fullPropertiesStorageSize, DictionaryAttr attributes,
OpaqueProperties properties, bool hasOperandStorage)
: … { … }
Operation::~Operation() { … }
void Operation::destroy() { … }
bool Operation::isProperAncestor(Operation *other) { … }
void Operation::replaceUsesOfWith(Value from, Value to) { … }
void Operation::setOperands(ValueRange operands) { … }
void Operation::setOperands(unsigned start, unsigned length,
ValueRange operands) { … }
void Operation::insertOperands(unsigned index, ValueRange operands) { … }
InFlightDiagnostic Operation::emitError(const Twine &message) { … }
InFlightDiagnostic Operation::emitWarning(const Twine &message) { … }
InFlightDiagnostic Operation::emitRemark(const Twine &message) { … }
DictionaryAttr Operation::getAttrDictionary() { … }
void Operation::setAttrs(DictionaryAttr newAttrs) { … }
void Operation::setAttrs(ArrayRef<NamedAttribute> newAttrs) { … }
std::optional<Attribute> Operation::getInherentAttr(StringRef name) { … }
void Operation::setInherentAttr(StringAttr name, Attribute value) { … }
Attribute Operation::getPropertiesAsAttribute() { … }
LogicalResult Operation::setPropertiesFromAttribute(
Attribute attr, function_ref<InFlightDiagnostic()> emitError) { … }
void Operation::copyProperties(OpaqueProperties rhs) { … }
llvm::hash_code Operation::hashProperties() { … }
constexpr unsigned Operation::kInvalidOrderIdx;
constexpr unsigned Operation::kOrderStride;
bool Operation::isBeforeInBlock(Operation *other) { … }
void Operation::updateOrderIfNecessary() { … }
auto llvm::ilist_detail::SpecificNodeAccess<
typename llvm::ilist_detail::compute_node_options<
::mlir::Operation>::type>::getNodePtr(pointer n) -> node_type * { … }
auto llvm::ilist_detail::SpecificNodeAccess<
typename llvm::ilist_detail::compute_node_options<
::mlir::Operation>::type>::getNodePtr(const_pointer n)
-> const node_type * { … }
auto llvm::ilist_detail::SpecificNodeAccess<
typename llvm::ilist_detail::compute_node_options<
::mlir::Operation>::type>::getValuePtr(node_type *n) -> pointer { … }
auto llvm::ilist_detail::SpecificNodeAccess<
typename llvm::ilist_detail::compute_node_options<
::mlir::Operation>::type>::getValuePtr(const node_type *n)
-> const_pointer { … }
void llvm::ilist_traits<::mlir::Operation>::deleteNode(Operation *op) { … }
Block *llvm::ilist_traits<::mlir::Operation>::getContainingBlock() { … }
void llvm::ilist_traits<::mlir::Operation>::addNodeToList(Operation *op) { … }
void llvm::ilist_traits<::mlir::Operation>::removeNodeFromList(Operation *op) { … }
void llvm::ilist_traits<::mlir::Operation>::transferNodesFromList(
ilist_traits<Operation> &otherList, op_iterator first, op_iterator last) { … }
void Operation::erase() { … }
void Operation::remove() { … }
void Operation::moveBefore(Operation *existingOp) { … }
void Operation::moveBefore(Block *block,
llvm::iplist<Operation>::iterator iterator) { … }
void Operation::moveAfter(Operation *existingOp) { … }
void Operation::moveAfter(Block *block,
llvm::iplist<Operation>::iterator iterator) { … }
void Operation::dropAllReferences() { … }
void Operation::dropAllDefinedValueUses() { … }
void Operation::setSuccessor(Block *block, unsigned index) { … }
#ifndef NDEBUG
static void checkFoldResultTypes(Operation *op,
SmallVectorImpl<OpFoldResult> &results) {
if (results.empty())
return;
for (auto [ofr, opResult] : llvm::zip_equal(results, op->getResults())) {
if (auto value = dyn_cast<Value>(ofr)) {
if (value.getType() != opResult.getType()) {
op->emitOpError() << "folder produced a value of incorrect type: "
<< value.getType()
<< ", expected: " << opResult.getType();
assert(false && "incorrect fold result type");
}
}
}
}
#endif
LogicalResult Operation::fold(ArrayRef<Attribute> operands,
SmallVectorImpl<OpFoldResult> &results) { … }
LogicalResult Operation::fold(SmallVectorImpl<OpFoldResult> &results) { … }
InFlightDiagnostic Operation::emitOpError(const Twine &message) { … }
Operation::CloneOptions::CloneOptions()
: … { … }
Operation::CloneOptions::CloneOptions(bool cloneRegions, bool cloneOperands)
: … { … }
Operation::CloneOptions Operation::CloneOptions::all() { … }
Operation::CloneOptions &Operation::CloneOptions::cloneRegions(bool enable) { … }
Operation::CloneOptions &Operation::CloneOptions::cloneOperands(bool enable) { … }
Operation *Operation::cloneWithoutRegions(IRMapping &mapper) { … }
Operation *Operation::cloneWithoutRegions() { … }
Operation *Operation::clone(IRMapping &mapper, CloneOptions options) { … }
Operation *Operation::clone(CloneOptions options) { … }
ParseResult OpState::parse(OpAsmParser &parser, OperationState &result) { … }
void OpState::print(Operation *op, OpAsmPrinter &p, StringRef defaultDialect) { … }
void OpState::printOpName(Operation *op, OpAsmPrinter &p,
StringRef defaultDialect) { … }
ParseResult OpState::genericParseProperties(OpAsmParser &parser,
Attribute &result) { … }
void OpState::genericPrintProperties(OpAsmPrinter &p, Attribute properties,
ArrayRef<StringRef> elidedProps) { … }
InFlightDiagnostic OpState::emitError(const Twine &message) { … }
InFlightDiagnostic OpState::emitOpError(const Twine &message) { … }
InFlightDiagnostic OpState::emitWarning(const Twine &message) { … }
InFlightDiagnostic OpState::emitRemark(const Twine &message) { … }
LogicalResult
OpTrait::impl::foldCommutative(Operation *op, ArrayRef<Attribute> operands,
SmallVectorImpl<OpFoldResult> &results) { … }
OpFoldResult OpTrait::impl::foldIdempotent(Operation *op) { … }
OpFoldResult OpTrait::impl::foldInvolution(Operation *op) { … }
LogicalResult OpTrait::impl::verifyZeroOperands(Operation *op) { … }
LogicalResult OpTrait::impl::verifyOneOperand(Operation *op) { … }
LogicalResult OpTrait::impl::verifyNOperands(Operation *op,
unsigned numOperands) { … }
LogicalResult OpTrait::impl::verifyAtLeastNOperands(Operation *op,
unsigned numOperands) { … }
static Type getTensorOrVectorElementType(Type type) { … }
LogicalResult OpTrait::impl::verifyIsIdempotent(Operation *op) { … }
LogicalResult OpTrait::impl::verifyIsInvolution(Operation *op) { … }
LogicalResult
OpTrait::impl::verifyOperandsAreSignlessIntegerLike(Operation *op) { … }
LogicalResult OpTrait::impl::verifyOperandsAreFloatLike(Operation *op) { … }
LogicalResult OpTrait::impl::verifySameTypeOperands(Operation *op) { … }
LogicalResult OpTrait::impl::verifyZeroRegions(Operation *op) { … }
LogicalResult OpTrait::impl::verifyOneRegion(Operation *op) { … }
LogicalResult OpTrait::impl::verifyNRegions(Operation *op,
unsigned numRegions) { … }
LogicalResult OpTrait::impl::verifyAtLeastNRegions(Operation *op,
unsigned numRegions) { … }
LogicalResult OpTrait::impl::verifyZeroResults(Operation *op) { … }
LogicalResult OpTrait::impl::verifyOneResult(Operation *op) { … }
LogicalResult OpTrait::impl::verifyNResults(Operation *op,
unsigned numOperands) { … }
LogicalResult OpTrait::impl::verifyAtLeastNResults(Operation *op,
unsigned numOperands) { … }
LogicalResult OpTrait::impl::verifySameOperandsShape(Operation *op) { … }
LogicalResult OpTrait::impl::verifySameOperandsAndResultShape(Operation *op) { … }
LogicalResult OpTrait::impl::verifySameOperandsElementType(Operation *op) { … }
LogicalResult
OpTrait::impl::verifySameOperandsAndResultElementType(Operation *op) { … }
LogicalResult OpTrait::impl::verifySameOperandsAndResultType(Operation *op) { … }
LogicalResult OpTrait::impl::verifySameOperandsAndResultRank(Operation *op) { … }
LogicalResult OpTrait::impl::verifyIsTerminator(Operation *op) { … }
static LogicalResult verifyTerminatorSuccessors(Operation *op) { … }
LogicalResult OpTrait::impl::verifyZeroSuccessors(Operation *op) { … }
LogicalResult OpTrait::impl::verifyOneSuccessor(Operation *op) { … }
LogicalResult OpTrait::impl::verifyNSuccessors(Operation *op,
unsigned numSuccessors) { … }
LogicalResult OpTrait::impl::verifyAtLeastNSuccessors(Operation *op,
unsigned numSuccessors) { … }
LogicalResult OpTrait::impl::verifyResultsAreBoolLike(Operation *op) { … }
LogicalResult OpTrait::impl::verifyResultsAreFloatLike(Operation *op) { … }
LogicalResult
OpTrait::impl::verifyResultsAreSignlessIntegerLike(Operation *op) { … }
LogicalResult OpTrait::impl::verifyValueSizeAttr(Operation *op,
StringRef attrName,
StringRef valueGroupName,
size_t expectedCount) { … }
LogicalResult OpTrait::impl::verifyOperandSizeAttr(Operation *op,
StringRef attrName) { … }
LogicalResult OpTrait::impl::verifyResultSizeAttr(Operation *op,
StringRef attrName) { … }
LogicalResult OpTrait::impl::verifyNoRegionArguments(Operation *op) { … }
LogicalResult OpTrait::impl::verifyElementwise(Operation *op) { … }
LogicalResult OpTrait::impl::verifyIsIsolatedFromAbove(Operation *isolatedOp) { … }
bool OpTrait::hasElementwiseMappableTraits(Operation *op) { … }
void impl::ensureRegionTerminator(
Region ®ion, OpBuilder &builder, Location loc,
function_ref<Operation *(OpBuilder &, Location)> buildTerminatorOp) { … }
void impl::ensureRegionTerminator(
Region ®ion, Builder &builder, Location loc,
function_ref<Operation *(OpBuilder &, Location)> buildTerminatorOp) { … }