Move info table related structs into table.h.
authorLei Zhang <antiagainst@google.com>
Wed, 11 Nov 2015 17:40:25 +0000 (12:40 -0500)
committerDavid Neto <dneto@google.com>
Thu, 12 Nov 2015 14:42:58 +0000 (09:42 -0500)
include/libspirv/libspirv.h
source/assembly_grammar.h
source/binary.h
source/ext_inst.cpp
source/ext_inst.h
source/opcode.h
source/operand.h
source/table.h
source/text.cpp

index 18d4d80..0244624 100644 (file)
@@ -321,74 +321,16 @@ typedef struct spv_header_t {
   const uint32_t* instructions;  // NOTE: Unfixed pointer to instruciton stream
 } spv_header_t;
 
-typedef struct spv_opcode_desc_t {
-  const char* name;
-  const SpvOp opcode;
-  const spv_capability_mask_t
-      capabilities;  // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
-  // operandTypes[0..numTypes-1] describe logical operands for the instruction.
-  // The operand types include result id and result-type id, followed by
-  // the types of arguments.
-  uint16_t numTypes;
-  spv_operand_type_t operandTypes[16];  // TODO: Smaller/larger?
-  const bool hasResult;  // Does the instruction have a result ID operand?
-  const bool hasType;    // Does the instruction have a type ID operand?
-  // The operand class for each logical argument.  This does *not* include
-  // the result Id or type ID.  The list is terminated by SPV_OPERAND_TYPE_NONE.
-  const OperandClass operandClass[16];
-} spv_opcode_desc_t;
-
-typedef struct spv_opcode_table_t {
-  const uint32_t count;
-  const spv_opcode_desc_t* entries;
-} spv_opcode_table_t;
-
-typedef struct spv_operand_desc_t {
-  const char* name;
-  const uint32_t value;
-  const spv_capability_mask_t
-      capabilities;  // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
-  const spv_operand_type_t operandTypes[16];  // TODO: Smaller/larger?
-} spv_operand_desc_t;
-
-typedef struct spv_operand_desc_group_t {
-  const spv_operand_type_t type;
-  const uint32_t count;
-  const spv_operand_desc_t* entries;
-} spv_operand_desc_group_t;
-
-typedef struct spv_operand_table_t {
-  const uint32_t count;
-  const spv_operand_desc_group_t* types;
-} spv_operand_table_t;
-
-typedef struct spv_ext_inst_desc_t {
-  const char* name;
-  const uint32_t ext_inst;
-  const spv_operand_type_t operandTypes[16];  // TODO: Smaller/larger?
-} spv_ext_inst_desc_t;
-
-typedef struct spv_ext_inst_group_t {
-  const spv_ext_inst_type_t type;
-  const uint32_t count;
-  const spv_ext_inst_desc_t* entries;
-} spv_ext_inst_group_t;
-
-typedef struct spv_ext_inst_table_t {
-  const uint32_t count;
-  const spv_ext_inst_group_t* groups;
-} spv_ext_inst_table_t;
+typedef struct spv_const_binary_t {
+  const uint32_t* code;
+  const size_t wordCount;
+} spv_const_binary_t;
 
 typedef struct spv_binary_t {
   uint32_t* code;
   size_t wordCount;
 } spv_binary_t;
 
-typedef struct spv_const_binary_t {
-  const uint32_t* code;
-  const size_t wordCount;
-} spv_const_binary_t;
-
 typedef struct spv_text_t {
   const char* str;
   size_t length;
@@ -408,12 +350,6 @@ typedef struct spv_diagnostic_t {
 
 // Type Definitions
 
-typedef const spv_opcode_desc_t* spv_opcode_desc;
-typedef const spv_opcode_table_t* spv_opcode_table;
-typedef const spv_operand_desc_t* spv_operand_desc;
-typedef const spv_operand_table_t* spv_operand_table;
-typedef const spv_ext_inst_desc_t* spv_ext_inst_desc;
-typedef const spv_ext_inst_table_t* spv_ext_inst_table;
 typedef spv_const_binary_t* spv_const_binary;
 typedef spv_binary_t* spv_binary;
 typedef spv_text_t* spv_text;
index 197d8f7..739413a 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <libspirv/libspirv.h>
 #include "operand.h"
+#include "table.h"
 
 namespace libspirv {
 
index 889716f..73af460 100644 (file)
@@ -28,7 +28,7 @@
 #define LIBSPIRV_BINARY_H_
 
 #include "libspirv/libspirv.h"
-
+#include "table.h"
 
 // TODO(dneto): Move spvBinaryParse and related type definitions to libspirv.h
 extern "C" {
index 6d018a5..4c1d16d 100644 (file)
@@ -1,4 +1,4 @@
-#include <libspirv/libspirv.h>
+#include "ext_inst.h"
 
 #include <string.h>
 
index d1beb9e..12eb57d 100644 (file)
@@ -28,6 +28,7 @@
 #define LIBSPIRV_EXT_INST_H_
 
 #include <libspirv/libspirv.h>
+#include "table.h"
 
 /// @brief Get the type from the extended instruction library string
 ///
index d9689e1..0ad338a 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "instruction.h"
 #include <libspirv/libspirv.h>
+#include "table.h"
 
 // Functions
 
index 8562c7b..8dcb585 100644 (file)
@@ -30,6 +30,7 @@
 #include <deque>
 
 #include <libspirv/libspirv.h>
+#include "table.h"
 
 /// @brief A sequence of operand types.
 ///
index c31e113..f29717f 100644 (file)
 
 #include <libspirv/libspirv.h>
 
+typedef struct spv_opcode_desc_t {
+  const char* name;
+  const SpvOp opcode;
+  const spv_capability_mask_t
+      capabilities;  // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
+  // operandTypes[0..numTypes-1] describe logical operands for the instruction.
+  // The operand types include result id and result-type id, followed by
+  // the types of arguments.
+  uint16_t numTypes;
+  spv_operand_type_t operandTypes[16];  // TODO: Smaller/larger?
+  const bool hasResult;  // Does the instruction have a result ID operand?
+  const bool hasType;    // Does the instruction have a type ID operand?
+  // The operand class for each logical argument.  This does *not* include
+  // the result Id or type ID.  The list is terminated by SPV_OPERAND_TYPE_NONE.
+  const OperandClass operandClass[16];
+} spv_opcode_desc_t;
+
+typedef struct spv_operand_desc_t {
+  const char* name;
+  const uint32_t value;
+  const spv_capability_mask_t
+      capabilities;  // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
+  const spv_operand_type_t operandTypes[16];  // TODO: Smaller/larger?
+} spv_operand_desc_t;
+
+typedef struct spv_operand_desc_group_t {
+  const spv_operand_type_t type;
+  const uint32_t count;
+  const spv_operand_desc_t* entries;
+} spv_operand_desc_group_t;
+
+typedef struct spv_ext_inst_desc_t {
+  const char* name;
+  const uint32_t ext_inst;
+  const spv_operand_type_t operandTypes[16];  // TODO: Smaller/larger?
+} spv_ext_inst_desc_t;
+
+typedef struct spv_ext_inst_group_t {
+  const spv_ext_inst_type_t type;
+  const uint32_t count;
+  const spv_ext_inst_desc_t* entries;
+} spv_ext_inst_group_t;
+
+typedef struct spv_opcode_table_t {
+  const uint32_t count;
+  const spv_opcode_desc_t* entries;
+} spv_opcode_table_t;
+
+typedef struct spv_operand_table_t {
+  const uint32_t count;
+  const spv_operand_desc_group_t* types;
+} spv_operand_table_t;
+
+typedef struct spv_ext_inst_table_t {
+  const uint32_t count;
+  const spv_ext_inst_group_t* groups;
+} spv_ext_inst_table_t;
+
+typedef const spv_opcode_desc_t* spv_opcode_desc;
+typedef const spv_operand_desc_t* spv_operand_desc;
+typedef const spv_ext_inst_desc_t* spv_ext_inst_desc;
+
+typedef const spv_opcode_table_t* spv_opcode_table;
+typedef const spv_operand_table_t* spv_operand_table;
+typedef const spv_ext_inst_table_t* spv_ext_inst_table;
+
 /// @brief Populate the Opcode table
 ///
 /// @param[out] pOpcodeTable table to be populated
index ed70309..fa6e6eb 100644 (file)
@@ -46,6 +46,7 @@
 #include "instruction.h"
 #include "opcode.h"
 #include "operand.h"
+#include "table.h"
 #include "text_handler.h"
 #include "util/bitutils.h"