/* Copyright (c) 2024 LunarG, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "instruction.h" #include "generated/spirv_grammar_helper.h" namespace gpu { namespace spirv { void Instruction::UpdateDebugInfo() { … } void Instruction::SetResultTypeIndex() { … } Instruction::Instruction(spirv_iterator it, uint32_t position) : … { … } Instruction::Instruction(uint32_t length, spv::Op opcode) : … { … } void Instruction::Fill(const std::vector<uint32_t>& words) { … } void Instruction::AppendWord(uint32_t word) { … } void Instruction::ToBinary(std::vector<uint32_t>& out) { … } void Instruction::ReplaceResultId(uint32_t new_result_id) { … } void Instruction::ReplaceOperandId(uint32_t old_word, uint32_t new_word) { … } // The main challenge with linking to functions from 2 modules is the IDs overlap. // TODO - Use the new generated operand to find the IDs. void Instruction::ReplaceLinkedId(vvl::unordered_map<uint32_t, uint32_t>& id_swap_map) { … } // All post SPIR-V processing we do is just needing to inspect single instructions without knowledge of the rest of the module. // We turn the saved vector of uint32_t into the Instruction class to make it easier to use void GenerateInstructions(const vvl::span<const uint32_t>& spirv, std::vector<Instruction>& instructions) { … } } // namespace spirv } // namespace gpu