Conversion to LLVM Dialect: integrate TypeConverter into LLVMLowering
authorAlex Zinenko <zinenko@google.com>
Thu, 9 May 2019 12:40:54 +0000 (05:40 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sat, 11 May 2019 02:25:36 +0000 (19:25 -0700)
commitdbb9608de8f9da217e65ea960e8b7e909ef4c673
tree60f539bba0f56218d2e0ea31e8e443f26ea39349
parent45c87e4d3b2b585f3c444c5956fef341f9196d2f
Conversion to LLVM Dialect: integrate TypeConverter into LLVMLowering

    Historically, the conversion from standard and built-in types to the LLVM IR
    dialect types was performed by a dedicated class, TypeConverter.  This class
    served to contain references to the LLVM IR dialect and to the LLVM IR Module
    to allow querying the data layout.  Recently, the LLVMLowering class was
    introduced to make the conversion to the LLVM IR dialect extensible to other
    source dialects.  This class also includes the references to the LLVM IR
    dialect and module.  TypeConverter was extended with basic support for
    dialect-specific type conversion through callbacks.  This is not sufficient in
    cases where dialect-specific types appear inside other types, such as function
    or container types.

    Integrate TypeConverter into LLVMLowering.  Whenever a subtype needs to be
    converted during standard type conversion (e.g. an argument or a result of a
    FunctionType), the conversion will call to the virtual function
    `LLVMLowering::convertType`, which can be extended to support dialect-specific
    types.

    Provide a new LLVMOpConversion class that serves as a base class for all
    conversions to the LLVM IR dialect and gives them access to LLVMLowering for
    the purpose of type conversion.  Update Linalg to LLVM IR lowering to use this
    class.

--

PiperOrigin-RevId: 247407314
mlir/include/mlir/LLVMIR/LLVMLowering.h
mlir/include/mlir/LLVMIR/Transforms.h
mlir/lib/LLVMIR/Transforms/ConvertToLLVMDialect.cpp
mlir/lib/Linalg/Transforms/LowerToLLVMDialect.cpp