//===- DecomposeCallGraphTypes.cpp - CG type decomposition ----------------===// // // 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/Dialect/Func/Transforms/DecomposeCallGraphTypes.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/IR/BuiltinOps.h" usingnamespacemlir; usingnamespacemlir::func; //===----------------------------------------------------------------------===// // ValueDecomposer //===----------------------------------------------------------------------===// void ValueDecomposer::decomposeValue(OpBuilder &builder, Location loc, Type type, Value value, SmallVectorImpl<Value> &results) { … } //===----------------------------------------------------------------------===// // DecomposeCallGraphTypesOpConversionPattern //===----------------------------------------------------------------------===// namespace { /// Base OpConversionPattern class to make a ValueDecomposer available to /// inherited patterns. template <typename SourceOp> class DecomposeCallGraphTypesOpConversionPattern : public OpConversionPattern<SourceOp> { … }; } // namespace //===----------------------------------------------------------------------===// // DecomposeCallGraphTypesForFuncArgs //===----------------------------------------------------------------------===// namespace { /// Expand function arguments according to the provided TypeConverter and /// ValueDecomposer. struct DecomposeCallGraphTypesForFuncArgs : public DecomposeCallGraphTypesOpConversionPattern<func::FuncOp> { … }; } // namespace //===----------------------------------------------------------------------===// // DecomposeCallGraphTypesForReturnOp //===----------------------------------------------------------------------===// namespace { /// Expand return operands according to the provided TypeConverter and /// ValueDecomposer. struct DecomposeCallGraphTypesForReturnOp : public DecomposeCallGraphTypesOpConversionPattern<ReturnOp> { … }; } // namespace //===----------------------------------------------------------------------===// // DecomposeCallGraphTypesForCallOp //===----------------------------------------------------------------------===// namespace { /// Expand call op operands and results according to the provided TypeConverter /// and ValueDecomposer. struct DecomposeCallGraphTypesForCallOp : public DecomposeCallGraphTypesOpConversionPattern<CallOp> { … }; } // namespace void mlir::populateDecomposeCallGraphTypesPatterns( MLIRContext *context, const TypeConverter &typeConverter, ValueDecomposer &decomposer, RewritePatternSet &patterns) { … }