chromium/third_party/spirv-tools/src/source/opt/opextinst_forward_ref_fixup_pass.cpp

// Copyright (c) 2024 Google LLC
//
// 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 "source/opt/opextinst_forward_ref_fixup_pass.h"

#include <string>
#include <unordered_set>

#include "source/extensions.h"
#include "source/opt/ir_context.h"
#include "source/opt/module.h"
#include "type_manager.h"

namespace spvtools {
namespace opt {
namespace {

// Returns true if the instruction |inst| has a forward reference to another
// debug instruction.
// |debug_ids| contains the list of IDs belonging to debug instructions.
// |seen_ids| contains the list of IDs already seen.
bool HasForwardReference(const Instruction& inst,
                         const std::unordered_set<uint32_t>& debug_ids,
                         const std::unordered_set<uint32_t>& seen_ids) {}

// Replace |inst| opcode with OpExtInstWithForwardRefsKHR or OpExtInst
// if required to comply with forward references.
bool ReplaceOpcodeIfRequired(Instruction& inst, bool hasForwardReferences) {}

// Returns all the result IDs of the instructions in |range|.
std::unordered_set<uint32_t> gatherResultIds(
    const IteratorRange<Module::inst_iterator>& range) {}

}  // namespace

Pass::Status OpExtInstWithForwardReferenceFixupPass::Process() {}

}  // namespace opt
}  // namespace spvtools