diff options
author | ergawy <kareem.ergawy@gmail.com> | 2020-10-13 09:52:20 -0400 |
---|---|---|
committer | Lei Zhang <antiagainst@google.com> | 2020-10-13 10:18:21 -0400 |
commit | bddaa7a84868cf91d35b896ff773a269bae640df (patch) | |
tree | ec9111957d1c0ca8b4ba825f330477dd12f4506d /llvm/lib/BinaryFormat/Wasm.cpp | |
parent | 08e4e08d7192c5523751e75030689ebb4a279445 (diff) | |
download | llvm-bddaa7a84868cf91d35b896ff773a269bae640df.zip llvm-bddaa7a84868cf91d35b896ff773a269bae640df.tar.gz llvm-bddaa7a84868cf91d35b896ff773a269bae640df.tar.bz2 |
[MLIR][SPIRV] Support identified and recursive structs.
This PR adds support for identified and recursive structs.
This includes: parsing, printing, serializing, and
deserializing such structs.
The following C struct:
```C
struct A {
A* next;
};
```
which is translated to the following MLIR code as:
```mlir
!spv.struct<A, (!spv.ptr<!spv.struct<A>, Generic>)>
```
would be represented in the SPIR-V module as:
```spirv
OpName %A "A"
OpTypeForwardPointer %APtr Generic
%A = OpTypeStruct %APtr
%APtr = OpTypePointer Generic %A
```
In particular the following changes are included:
- SPIR-V structs can now be either identified or literal
(i.e. non-identified).
- All structs now have their members surrounded by a ()-pair.
- For recursive references,
(1) an OpTypeForwardPointer instruction is emitted before
the OpTypeStruct instruction defining the recursive struct
(2) an OpTypePointer instruction is emitted after the
OpTypeStruct instruction which actually defines the recursive
pointer to struct type.
Reviewed By: antiagainst, rriddle, ftynse
Differential Revision: https://reviews.llvm.org/D87206
Diffstat (limited to 'llvm/lib/BinaryFormat/Wasm.cpp')
0 files changed, 0 insertions, 0 deletions