#include "source/binary.h"
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iterator>
#include <limits>
#include <string>
#include <unordered_map>
#include <vector>
#include "source/assembly_grammar.h"
#include "source/diagnostic.h"
#include "source/ext_inst.h"
#include "source/latest_version_spirv_header.h"
#include "source/opcode.h"
#include "source/operand.h"
#include "source/spirv_constant.h"
#include "source/spirv_endian.h"
#include "source/util/string_utils.h"
spv_result_t spvBinaryHeaderGet(const spv_const_binary binary,
const spv_endianness_t endian,
spv_header_t* pHeader) { … }
std::string spvDecodeLiteralStringOperand(const spv_parsed_instruction_t& inst,
const uint16_t operand_index) { … }
namespace {
class Parser { … };
spv_result_t Parser::parse(const uint32_t* words, size_t num_words,
spv_diagnostic* diagnostic_arg) { … }
spv_result_t Parser::parseModule() { … }
spv_result_t Parser::parseInstruction() { … }
spv_result_t Parser::parseOperand(size_t inst_offset,
spv_parsed_instruction_t* inst,
const spv_operand_type_t type,
std::vector<uint32_t>* words,
std::vector<spv_parsed_operand_t>* operands,
spv_operand_pattern_t* expected_operands) { … }
spv_result_t Parser::setNumericTypeInfoForType(
spv_parsed_operand_t* parsed_operand, uint32_t type_id) { … }
void Parser::recordNumberType(size_t inst_offset,
const spv_parsed_instruction_t* inst) { … }
}
spv_result_t spvBinaryParse(const spv_const_context context, void* user_data,
const uint32_t* code, const size_t num_words,
spv_parsed_header_fn_t parsed_header,
spv_parsed_instruction_fn_t parsed_instruction,
spv_diagnostic* diagnostic) { … }
void spvBinaryDestroy(spv_binary binary) { … }
size_t spv_strnlen_s(const char* str, size_t strsz) { … }