#include "source/val/validation_state.h"
#include <cassert>
#include <stack>
#include <utility>
#include "source/opcode.h"
#include "source/spirv_constant.h"
#include "source/spirv_target_env.h"
#include "source/util/make_unique.h"
#include "source/val/basic_block.h"
#include "source/val/construct.h"
#include "source/val/function.h"
#include "spirv-tools/libspirv.h"
namespace spvtools {
namespace val {
namespace {
ModuleLayoutSection InstructionLayoutSection(
ModuleLayoutSection current_section, spv::Op op) { … }
bool IsInstructionInLayoutSection(ModuleLayoutSection layout, spv::Op op) { … }
spv_result_t CountInstructions(void* user_data,
const spv_parsed_instruction_t* inst) { … }
spv_result_t setHeader(void* user_data, spv_endianness_t, uint32_t,
uint32_t version, uint32_t generator, uint32_t id_bound,
uint32_t) { … }
void UpdateFeaturesBasedOnSpirvVersion(ValidationState_t::Feature* features,
uint32_t version) { … }
}
ValidationState_t::ValidationState_t(const spv_const_context ctx,
const spv_const_validator_options opt,
const uint32_t* words,
const size_t num_words,
const uint32_t max_warnings)
: … { … }
void ValidationState_t::preallocateStorage() { … }
spv_result_t ValidationState_t::ForwardDeclareId(uint32_t id) { … }
spv_result_t ValidationState_t::RemoveIfForwardDeclared(uint32_t id) { … }
spv_result_t ValidationState_t::RegisterForwardPointer(uint32_t id) { … }
bool ValidationState_t::IsForwardPointer(uint32_t id) const { … }
void ValidationState_t::AssignNameToId(uint32_t id, std::string name) { … }
std::string ValidationState_t::getIdName(uint32_t id) const { … }
size_t ValidationState_t::unresolved_forward_id_count() const { … }
std::vector<uint32_t> ValidationState_t::UnresolvedForwardIds() const { … }
bool ValidationState_t::IsDefinedId(uint32_t id) const { … }
const Instruction* ValidationState_t::FindDef(uint32_t id) const { … }
Instruction* ValidationState_t::FindDef(uint32_t id) { … }
ModuleLayoutSection ValidationState_t::current_layout_section() const { … }
void ValidationState_t::ProgressToNextLayoutSectionOrder() { … }
bool ValidationState_t::IsOpcodeInPreviousLayoutSection(spv::Op op) { … }
bool ValidationState_t::IsOpcodeInCurrentLayoutSection(spv::Op op) { … }
DiagnosticStream ValidationState_t::diag(spv_result_t error_code,
const Instruction* inst) { … }
std::vector<Function>& ValidationState_t::functions() { … }
Function& ValidationState_t::current_function() { … }
const Function& ValidationState_t::current_function() const { … }
const Function* ValidationState_t::function(uint32_t id) const { … }
Function* ValidationState_t::function(uint32_t id) { … }
bool ValidationState_t::in_function_body() const { … }
bool ValidationState_t::in_block() const { … }
void ValidationState_t::RegisterCapability(spv::Capability cap) { … }
void ValidationState_t::RegisterExtension(Extension ext) { … }
bool ValidationState_t::HasAnyOfCapabilities(
const CapabilitySet& capabilities) const { … }
bool ValidationState_t::HasAnyOfExtensions(
const ExtensionSet& extensions) const { … }
void ValidationState_t::set_addressing_model(spv::AddressingModel am) { … }
spv::AddressingModel ValidationState_t::addressing_model() const { … }
void ValidationState_t::set_memory_model(spv::MemoryModel mm) { … }
spv::MemoryModel ValidationState_t::memory_model() const { … }
void ValidationState_t::set_samplerimage_variable_address_mode(
uint32_t bit_width) { … }
uint32_t ValidationState_t::samplerimage_variable_address_mode() const { … }
spv_result_t ValidationState_t::RegisterFunction(
uint32_t id, uint32_t ret_type_id,
spv::FunctionControlMask function_control, uint32_t function_type_id) { … }
spv_result_t ValidationState_t::RegisterFunctionEnd() { … }
Instruction* ValidationState_t::AddOrderedInstruction(
const spv_parsed_instruction_t* inst) { … }
void ValidationState_t::RegisterDebugInstruction(const Instruction* inst) { … }
void ValidationState_t::RegisterInstruction(Instruction* inst) { … }
std::vector<Instruction*> ValidationState_t::getSampledImageConsumers(
uint32_t sampled_image_id) const { … }
void ValidationState_t::RegisterSampledImageConsumer(uint32_t sampled_image_id,
Instruction* consumer) { … }
void ValidationState_t::RegisterQCOMImageProcessingTextureConsumer(
uint32_t texture_id, const Instruction* consumer0,
const Instruction* consumer1) { … }
void ValidationState_t::RegisterStorageClassConsumer(
spv::StorageClass storage_class, Instruction* consumer) { … }
uint32_t ValidationState_t::getIdBound() const { … }
void ValidationState_t::setIdBound(const uint32_t bound) { … }
bool ValidationState_t::RegisterUniqueTypeDeclaration(const Instruction* inst) { … }
uint32_t ValidationState_t::GetTypeId(uint32_t id) const { … }
spv::Op ValidationState_t::GetIdOpcode(uint32_t id) const { … }
uint32_t ValidationState_t::GetComponentType(uint32_t id) const { … }
uint32_t ValidationState_t::GetDimension(uint32_t id) const { … }
uint32_t ValidationState_t::GetBitWidth(uint32_t id) const { … }
bool ValidationState_t::IsVoidType(uint32_t id) const { … }
bool ValidationState_t::IsFloatScalarType(uint32_t id) const { … }
bool ValidationState_t::IsFloatVectorType(uint32_t id) const { … }
bool ValidationState_t::IsFloat16Vector2Or4Type(uint32_t id) const { … }
bool ValidationState_t::IsFloatScalarOrVectorType(uint32_t id) const { … }
bool ValidationState_t::IsIntScalarType(uint32_t id) const { … }
bool ValidationState_t::IsIntArrayType(uint32_t id) const { … }
bool ValidationState_t::IsIntVectorType(uint32_t id) const { … }
bool ValidationState_t::IsIntScalarOrVectorType(uint32_t id) const { … }
bool ValidationState_t::IsUnsignedIntScalarType(uint32_t id) const { … }
bool ValidationState_t::IsUnsignedIntVectorType(uint32_t id) const { … }
bool ValidationState_t::IsUnsignedIntScalarOrVectorType(uint32_t id) const { … }
bool ValidationState_t::IsSignedIntScalarType(uint32_t id) const { … }
bool ValidationState_t::IsSignedIntVectorType(uint32_t id) const { … }
bool ValidationState_t::IsBoolScalarType(uint32_t id) const { … }
bool ValidationState_t::IsBoolVectorType(uint32_t id) const { … }
bool ValidationState_t::IsBoolScalarOrVectorType(uint32_t id) const { … }
bool ValidationState_t::IsFloatMatrixType(uint32_t id) const { … }
bool ValidationState_t::GetMatrixTypeInfo(uint32_t id, uint32_t* num_rows,
uint32_t* num_cols,
uint32_t* column_type,
uint32_t* component_type) const { … }
bool ValidationState_t::GetStructMemberTypes(
uint32_t struct_type_id, std::vector<uint32_t>* member_types) const { … }
bool ValidationState_t::IsPointerType(uint32_t id) const { … }
bool ValidationState_t::GetPointerTypeInfo(
uint32_t id, uint32_t* data_type, spv::StorageClass* storage_class) const { … }
bool ValidationState_t::IsAccelerationStructureType(uint32_t id) const { … }
bool ValidationState_t::IsCooperativeMatrixType(uint32_t id) const { … }
bool ValidationState_t::IsCooperativeMatrixNVType(uint32_t id) const { … }
bool ValidationState_t::IsCooperativeMatrixKHRType(uint32_t id) const { … }
bool ValidationState_t::IsCooperativeMatrixAType(uint32_t id) const { … }
bool ValidationState_t::IsCooperativeMatrixBType(uint32_t id) const { … }
bool ValidationState_t::IsCooperativeMatrixAccType(uint32_t id) const { … }
bool ValidationState_t::IsFloatCooperativeMatrixType(uint32_t id) const { … }
bool ValidationState_t::IsIntCooperativeMatrixType(uint32_t id) const { … }
bool ValidationState_t::IsUnsignedIntCooperativeMatrixType(uint32_t id) const { … }
bool ValidationState_t::IsUnsigned64BitHandle(uint32_t id) const { … }
spv_result_t ValidationState_t::CooperativeMatrixShapesMatch(
const Instruction* inst, uint32_t m1, uint32_t m2) { … }
uint32_t ValidationState_t::GetOperandTypeId(const Instruction* inst,
size_t operand_index) const { … }
bool ValidationState_t::EvalConstantValUint64(uint32_t id,
uint64_t* val) const { … }
bool ValidationState_t::EvalConstantValInt64(uint32_t id, int64_t* val) const { … }
std::tuple<bool, bool, uint32_t> ValidationState_t::EvalInt32IfConst(
uint32_t id) const { … }
void ValidationState_t::ComputeFunctionToEntryPointMapping() { … }
void ValidationState_t::ComputeRecursiveEntryPoints() { … }
const std::vector<uint32_t>& ValidationState_t::FunctionEntryPoints(
uint32_t func) const { … }
std::set<uint32_t> ValidationState_t::EntryPointReferences(uint32_t id) const { … }
std::string ValidationState_t::Disassemble(const Instruction& inst) const { … }
std::string ValidationState_t::Disassemble(const uint32_t* words,
uint16_t num_words) const { … }
bool ValidationState_t::LogicallyMatch(const Instruction* lhs,
const Instruction* rhs,
bool check_decorations) { … }
const Instruction* ValidationState_t::TracePointer(
const Instruction* inst) const { … }
bool ValidationState_t::ContainsType(
uint32_t id, const std::function<bool(const Instruction*)>& f,
bool traverse_all_types) const { … }
bool ValidationState_t::ContainsSizedIntOrFloatType(uint32_t id, spv::Op type,
uint32_t width) const { … }
bool ValidationState_t::ContainsLimitedUseIntOrFloatType(uint32_t id) const { … }
bool ValidationState_t::ContainsRuntimeArray(uint32_t id) const { … }
bool ValidationState_t::ContainsUntypedPointer(uint32_t id) const { … }
bool ValidationState_t::IsValidStorageClass(
spv::StorageClass storage_class) const { … }
#define VUID_WRAP(vuid) …
std::string ValidationState_t::VkErrorID(uint32_t id,
const char* ) const { … }
}
}