llvm-project/mlir/lib
Alex Zinenko 6d37a255e2 Generic dialect conversion pass exercised by LLVM IR lowering
This commit introduces a generic dialect conversion/lowering/legalization pass
and illustrates it on StandardOps->LLVMIR conversion.

It partially reuses the PatternRewriter infrastructure and adds the following
functionality:
- an actual pass;
- non-default pattern constructors;
- one-to-many rewrites;
- rewriting terminators with successors;
- not applying patterns iteratively (unlike the existing greedy rewrite driver);
- ability to change function signature;
- ability to change basic block argument types.

The latter two things required, given the existing API, to create new functions
in the same module.  Eventually, this should converge with the rest of
PatternRewriter.  However, we may want to keep two pass versions: "heavy" with
function/block argument conversion and "light" that only touches operations.

This pass creates new functions within a module as a means to change function
signature, then creates new blocks with converted argument types in the new
function.  Then, it traverses the CFG in DFS-preorder to make sure defs are
converted before uses in the dominated blocks.  The generic pass has a minimal
interface with two hooks: one to fill in the set of patterns, and another one
to convert types for functions and blocks.  The patterns are defined as
separate classes that can be table-generated in the future.

The LLVM IR lowering pass partially inherits from the existing LLVM IR
translator, in particular for type conversion.  It defines a conversion pattern
template, instantiated for different operations, and is a good candidate for
tablegen.  The lowering does not yet support loads and stores and is not
connected to the translator as it would have broken the existing flows.  Future
patches will add missing support before switching the translator in a single
patch.

PiperOrigin-RevId: 230951202
2019-03-29 15:37:23 -07:00
..
Analysis Update dma-generate: update for multiple load/store op's per memref 2019-03-29 15:35:38 -07:00
Dialect Migrate VectorOrTensorType/MemRefType shape api to use int64_t instead of int. 2019-03-29 15:33:20 -07:00
EDSC Add support for Return in EDSCs 2019-03-29 15:31:50 -07:00
ExecutionEngine Use a unique_ptr instead of manual deletion for PIMPL idiom (NFC) 2019-03-29 15:37:07 -07:00
IR Add order bit to instructions to lazily track dominance queries. This improves the performance of dominance queries, which are used quite often within the compiler(especially within the verifier). 2019-03-29 15:35:23 -07:00
LLVMIR Generic dialect conversion pass exercised by LLVM IR lowering 2019-03-29 15:37:23 -07:00
Parser Migrate VectorOrTensorType/MemRefType shape api to use int64_t instead of int. 2019-03-29 15:33:20 -07:00
StandardOps Introduce a new operation hook point for implementing simple local 2019-03-29 15:34:35 -07:00
SuperVectorOps Migrate VectorOrTensorType/MemRefType shape api to use int64_t instead of int. 2019-03-29 15:33:20 -07:00
Support Extract openInputFile() into Support/FileUtilities 2019-03-29 15:09:11 -07:00
TableGen Pull TableGen op argument definitions into their own files 2019-03-29 15:36:52 -07:00
Target/LLVMIR Migrate VectorOrTensorType/MemRefType shape api to use int64_t instead of int. 2019-03-29 15:33:20 -07:00
Transforms Generic dialect conversion pass exercised by LLVM IR lowering 2019-03-29 15:37:23 -07:00
Translation Separate translators into "from MLIR" and "to MLIR". 2019-03-29 14:06:33 -07:00