Move info table related structs into table.h.

This commit is contained in:
Lei Zhang 2015-11-11 12:40:25 -05:00 committed by David Neto
parent 04736e7878
commit 7a222e4abf
9 changed files with 77 additions and 70 deletions

View 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;

View File

@ -29,6 +29,7 @@
#include <libspirv/libspirv.h>
#include "operand.h"
#include "table.h"
namespace libspirv {

View 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" {

View File

@ -1,4 +1,4 @@
#include <libspirv/libspirv.h>
#include "ext_inst.h"
#include <string.h>

View 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
///

View File

@ -29,6 +29,7 @@
#include "instruction.h"
#include <libspirv/libspirv.h>
#include "table.h"
// Functions

View File

@ -30,6 +30,7 @@
#include <deque>
#include <libspirv/libspirv.h>
#include "table.h"
/// @brief A sequence of operand types.
///

View File

@ -29,6 +29,72 @@
#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

View 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"