1 //===- AffineToStandard.h - Convert Affine to Standard dialect --*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef MLIR_CONVERSION_AFFINETOSTANDARD_AFFINETOSTANDARD_H 10 #define MLIR_CONVERSION_AFFINETOSTANDARD_AFFINETOSTANDARD_H 11 12 #include "mlir/Support/LLVM.h" 13 14 namespace mlir { 15 class AffineForOp; 16 class Location; 17 struct LogicalResult; 18 class OpBuilder; 19 class Pass; 20 class RewritePattern; 21 class Value; 22 class ValueRange; 23 24 class RewritePatternSet; 25 26 /// Collect a set of patterns to convert from the Affine dialect to the Standard 27 /// dialect, in particular convert structured affine control flow into CFG 28 /// branch-based control flow. 29 void populateAffineToStdConversionPatterns(RewritePatternSet &patterns); 30 31 /// Collect a set of patterns to convert vector-related Affine ops to the Vector 32 /// dialect. 33 void populateAffineToVectorConversionPatterns(RewritePatternSet &patterns); 34 35 /// Emit code that computes the lower bound of the given affine loop using 36 /// standard arithmetic operations. 37 Value lowerAffineLowerBound(AffineForOp op, OpBuilder &builder); 38 39 /// Emit code that computes the upper bound of the given affine loop using 40 /// standard arithmetic operations. 41 Value lowerAffineUpperBound(AffineForOp op, OpBuilder &builder); 42 43 /// Lowers affine control flow operations (ForStmt, IfStmt and AffineApplyOp) 44 /// to equivalent lower-level constructs (flow of basic blocks and arithmetic 45 /// primitives). 46 std::unique_ptr<Pass> createLowerAffinePass(); 47 48 } // namespace mlir 49 50 #endif // MLIR_CONVERSION_AFFINETOSTANDARD_AFFINETOSTANDARD_H 51