chromium/third_party/glslang/src/SPIRV/disassemble.cpp

//
// Copyright (C) 2014-2015 LunarG, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
//    Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//
//    Redistributions in binary form must reproduce the above
//    copyright notice, this list of conditions and the following
//    disclaimer in the documentation and/or other materials provided
//    with the distribution.
//
//    Neither the name of 3Dlabs Inc. Ltd. nor the names of its
//    contributors may be used to endorse or promote products derived
//    from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

//
// Disassembler for SPIR-V.
//

#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iomanip>
#include <stack>
#include <sstream>
#include <cstring>
#include <utility>

#include "disassemble.h"
#include "doc.h"

namespace spv {
    extern "C" {
        // Include C-based headers that don't have a namespace
        #include "GLSL.std.450.h"
        #include "GLSL.ext.AMD.h"
        #include "GLSL.ext.NV.h"
        #include "GLSL.ext.ARM.h"
        #include "NonSemanticShaderDebugInfo100.h"
        #include "GLSL.ext.QCOM.h"
    }
}
const char* GlslStd450DebugNames[spv::GLSLstd450Count];

namespace spv {

static const char* GLSLextAMDGetDebugNames(const char*, unsigned);
static const char* GLSLextNVGetDebugNames(const char*, unsigned);
static const char* NonSemanticShaderDebugInfo100GetDebugNames(unsigned);

static void Kill(std::ostream& out, const char* message)
{}

// used to identify the extended instruction library imported when printing
enum ExtInstSet {};

// Container class for a single instance of a SPIR-V stream, with methods for disassembly.
class SpirvStream {};

void SpirvStream::validate()
{}

// Loop over all the instructions, in order, processing each.
// Boiler plate for each is handled here directly, the rest is dispatched.
void SpirvStream::processInstructions()
{}

void SpirvStream::outputIndent()
{}

void SpirvStream::formatId(Id id, std::stringstream& idStream)
{}

void SpirvStream::outputResultId(Id id)
{}

void SpirvStream::outputTypeId(Id id)
{}

void SpirvStream::outputId(Id id)
{}

void SpirvStream::outputMask(OperandClass operandClass, unsigned mask)
{}

void SpirvStream::disassembleImmediates(int numOperands)
{}

void SpirvStream::disassembleIds(int numOperands)
{}

// decode string from words at current position (non-consuming)
std::pair<int, std::string> SpirvStream::decodeString()
{}

// return the number of operands consumed by the string
int SpirvStream::disassembleString()
{}

void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode, int numOperands)
{}

static void GLSLstd450GetDebugNames(const char** names)
{}

static const char* GLSLextAMDGetDebugNames(const char* name, unsigned entrypoint)
{}

static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
{}

static const char* NonSemanticShaderDebugInfo100GetDebugNames(unsigned entrypoint)
{}

void Disassemble(std::ostream& out, const std::vector<unsigned int>& stream)
{}

}; // end namespace spv