[MLIR][SPIRVToLLVM] Conversion of SPIR-V variable op
authorGeorge Mitenkov <georgemitenk0v@gmail.com>
Fri, 24 Jul 2020 12:01:08 +0000 (15:01 +0300)
committerGeorge Mitenkov <georgemitenk0v@gmail.com>
Fri, 24 Jul 2020 12:49:55 +0000 (15:49 +0300)
commit5c98631391fa1c7315a687da853a776955d1531e
tree624c95ffcb3a5b8e946758dcec6a68732872dc1c
parent0bbaacc8cae0373d4500c4e3f6f128d21f9033b7
[MLIR][SPIRVToLLVM] Conversion of SPIR-V variable op

The patch introduces the conversion pattern for function-level
`spv.Variable`. It is modelled as `llvm.alloca` op. If initialized, then
additional store instruction is used. Note that there is no initialization
for arrays and structs since constants of these types are not supported in
LLVM dialect yet. Also, at the moment initialisation is only possible via
`spv.constant` (since `spv.GlobalVariable` conversion is not implemented
yet).

The input code has some scoping is not taken into account and will be
addressed in a different patch.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D84224
mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir [new file with mode: 0644]