#include <algorithm>
#include <string>
#include <vector>
#include "source/opcode.h"
#include "source/spirv_target_env.h"
#include "source/val/instruction.h"
#include "source/val/validate.h"
#include "source/val/validate_scopes.h"
#include "source/val/validation_state.h"
namespace spvtools {
namespace val {
namespace {
bool AreLayoutCompatibleStructs(ValidationState_t&, const Instruction*,
const Instruction*);
bool HaveLayoutCompatibleMembers(ValidationState_t&, const Instruction*,
const Instruction*);
bool HaveSameLayoutDecorations(ValidationState_t&, const Instruction*,
const Instruction*);
bool HasConflictingMemberOffsets(const std::set<Decoration>&,
const std::set<Decoration>&);
bool IsAllowedTypeOrArrayOfSame(ValidationState_t& _, const Instruction* type,
std::initializer_list<spv::Op> allowed) { … }
bool AreLayoutCompatibleStructs(ValidationState_t& _, const Instruction* type1,
const Instruction* type2) { … }
bool HaveLayoutCompatibleMembers(ValidationState_t& _, const Instruction* type1,
const Instruction* type2) { … }
bool HaveSameLayoutDecorations(ValidationState_t& _, const Instruction* type1,
const Instruction* type2) { … }
bool HasConflictingMemberOffsets(
const std::set<Decoration>& type1_decorations,
const std::set<Decoration>& type2_decorations) { … }
bool ContainsInvalidBool(ValidationState_t& _, const Instruction* storage,
bool skip_builtin) { … }
bool ContainsCooperativeMatrix(ValidationState_t& _,
const Instruction* storage) { … }
std::pair<spv::StorageClass, spv::StorageClass> GetStorageClass(
ValidationState_t& _, const Instruction* inst) { … }
int MemoryAccessNumWords(uint32_t mask) { … }
uint32_t GetMakeAvailableScope(const Instruction* inst, uint32_t mask,
uint32_t mask_index) { … }
uint32_t GetMakeVisibleScope(const Instruction* inst, uint32_t mask,
uint32_t mask_index) { … }
bool DoesStructContainRTA(const ValidationState_t& _, const Instruction* inst) { … }
spv_result_t CheckMemoryAccess(ValidationState_t& _, const Instruction* inst,
uint32_t index) { … }
spv_result_t ValidateVariable(ValidationState_t& _, const Instruction* inst) { … }
spv_result_t ValidateLoad(ValidationState_t& _, const Instruction* inst) { … }
spv_result_t ValidateStore(ValidationState_t& _, const Instruction* inst) { … }
spv_result_t ValidateCopyMemoryMemoryAccess(ValidationState_t& _,
const Instruction* inst) { … }
spv_result_t ValidateCopyMemory(ValidationState_t& _, const Instruction* inst) { … }
spv_result_t ValidateAccessChain(ValidationState_t& _,
const Instruction* inst) { … }
spv_result_t ValidateRawAccessChain(ValidationState_t& _,
const Instruction* inst) { … }
spv_result_t ValidatePtrAccessChain(ValidationState_t& _,
const Instruction* inst) { … }
spv_result_t ValidateArrayLength(ValidationState_t& state,
const Instruction* inst) { … }
spv_result_t ValidateCooperativeMatrixLengthNV(ValidationState_t& state,
const Instruction* inst) { … }
spv_result_t ValidateCooperativeMatrixLoadStoreNV(ValidationState_t& _,
const Instruction* inst) { … }
spv_result_t ValidateCooperativeMatrixLoadStoreKHR(ValidationState_t& _,
const Instruction* inst) { … }
spv_result_t ValidatePtrComparison(ValidationState_t& _,
const Instruction* inst) { … }
}
spv_result_t MemoryPass(ValidationState_t& _, const Instruction* inst) { … }
}
}