spv_parsed_instruction_t cleanup
authorDavid Neto <dneto@google.com>
Fri, 20 Nov 2015 19:21:10 +0000 (14:21 -0500)
committerDavid Neto <dneto@google.com>
Mon, 23 Nov 2015 14:52:38 +0000 (09:52 -0500)
commit7bff3eb6f9abb1c126029d456b152429902dc1d8
treefb7086ab1307d2a33aab257b36331f19af43e102
parent01c8d7a8fb7a6ec052a98beee0f6be71fa7ec07c
spv_parsed_instruction_t cleanup

Add members:
 - words: a pointer to an array of words in the instruction,
   in host native endianness.
 - num_words: sizes the words member

Remove member:
 - offset

This simplifies clients of spvBinaryParse, because they don't
have to handle endianness translation.

Also, it makes the binary parse API more composable, allowing
for easy chaining of binary parse clients.  A binary parse client
is handed the array of words directly instead of having to reference
some external array of all the words in the SPIR-V binary.  It also
allows a binary parse client to mutate the instruction stream before
handing off to a downstream consumer.

TODO(dneto): Still need to write the unit tests for spvBinaryParse

Fixes: https://github.com/KhronosGroup/SPIRV-Tools/issues/1
include/libspirv/libspirv.h
source/binary.cpp
source/disassemble.cpp
source/endian.cpp
source/endian.h