Make VariableOp instructions be in the first block in the function.
authorHanhan Wang <hanchung@google.com>
Wed, 13 Nov 2019 02:58:36 +0000 (18:58 -0800)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Wed, 13 Nov 2019 02:59:15 +0000 (18:59 -0800)
commit85d7fb3324a6442e865c87ea766992ab096f8859
tree6881e629ceaa3acf9c97a62d3454489dad302973
parent2be53603e9296e86ae6ef529c37053e198560f60
Make VariableOp instructions be in the first block in the function.

Since VariableOp is serialized during processBlock, we add two more fields,
`functionHeader` and `functionBody`, to collect instructions for a function.
After all the blocks have been processed, we append them to the `functions`.

Also, fix a bug in processGlobalVariableOp. The global variables should be
encoded into `typesGlobalValues`.

PiperOrigin-RevId: 280105366
mlir/lib/Dialect/SPIRV/Serialization/Serializer.cpp
mlir/test/Dialect/SPIRV/Serialization/constant.mlir
mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp