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

// Copyright (c) 2017 The Khronos Group Inc.
// Copyright (c) 2017 Valve Corporation
// Copyright (c) 2017 LunarG Inc.
// Copyright (c) 2018-2021 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/aggressive_dead_code_elim_pass.h"

#include <memory>
#include <stack>

#include "source/cfa.h"
#include "source/opt/eliminate_dead_functions_util.h"
#include "source/opt/ir_builder.h"
#include "source/opt/reflect.h"
#include "source/spirv_constant.h"
#include "source/util/string_utils.h"

namespace spvtools {
namespace opt {
namespace {

constexpr uint32_t kTypePointerStorageClassInIdx =;
constexpr uint32_t kEntryPointFunctionIdInIdx =;
constexpr uint32_t kSelectionMergeMergeBlockIdInIdx =;
constexpr uint32_t kLoopMergeContinueBlockIdInIdx =;
constexpr uint32_t kCopyMemoryTargetAddrInIdx =;
constexpr uint32_t kCopyMemorySourceAddrInIdx =;
constexpr uint32_t kLoadSourceAddrInIdx =;
constexpr uint32_t kDebugDeclareOperandVariableIndex =;
constexpr uint32_t kGlobalVariableVariableIndex =;

// Sorting functor to present annotation instructions in an easy-to-process
// order. The functor orders by opcode first and falls back on unique id
// ordering if both instructions have the same opcode.
//
// Desired priority:
// spv::Op::OpGroupDecorate
// spv::Op::OpGroupMemberDecorate
// spv::Op::OpDecorate
// spv::Op::OpMemberDecorate
// spv::Op::OpDecorateId
// spv::Op::OpDecorateStringGOOGLE
// spv::Op::OpDecorationGroup
struct DecorationLess {};

}  // namespace

bool AggressiveDCEPass::IsVarOfStorage(uint32_t varId,
                                       spv::StorageClass storageClass) {}

bool AggressiveDCEPass::IsLocalVar(uint32_t varId, Function* func) {}

void AggressiveDCEPass::AddStores(Function* func, uint32_t ptrId) {}

bool AggressiveDCEPass::AllExtensionsSupported() const {}

bool AggressiveDCEPass::IsTargetDead(Instruction* inst) {}

void AggressiveDCEPass::ProcessLoad(Function* func, uint32_t varId) {}

void AggressiveDCEPass::AddBranch(uint32_t labelId, BasicBlock* bp) {}

void AggressiveDCEPass::AddBreaksAndContinuesToWorklist(
    Instruction* mergeInst) {}

bool AggressiveDCEPass::AggressiveDCE(Function* func) {}

bool AggressiveDCEPass::KillDeadInstructions(
    const Function* func, std::list<BasicBlock*>& structured_order) {}

void AggressiveDCEPass::ProcessWorkList(Function* func) {}

void AggressiveDCEPass::AddDebugScopeToWorkList(const Instruction* inst) {}

void AggressiveDCEPass::AddDebugInstructionsToWorkList(
    const Instruction* inst) {}

void AggressiveDCEPass::AddDecorationsToWorkList(const Instruction* inst) {}

void AggressiveDCEPass::MarkLoadedVariablesAsLive(Function* func,
                                                  Instruction* inst) {}

std::vector<uint32_t> AggressiveDCEPass::GetLoadedVariables(Instruction* inst) {}

uint32_t AggressiveDCEPass::GetLoadedVariableFromNonFunctionCalls(
    Instruction* inst) {}

std::vector<uint32_t> AggressiveDCEPass::GetLoadedVariablesFromFunctionCall(
    const Instruction* inst) {}

uint32_t AggressiveDCEPass::GetVariableId(uint32_t ptr_id) {}

void AggressiveDCEPass::MarkBlockAsLive(Instruction* inst) {}
void AggressiveDCEPass::MarkLoopConstructAsLiveIfLoopHeader(
    BasicBlock* basic_block) {}

void AggressiveDCEPass::AddOperandsToWorkList(const Instruction* inst) {}

void AggressiveDCEPass::InitializeWorkList(
    Function* func, std::list<BasicBlock*>& structured_order) {}

void AggressiveDCEPass::InitializeModuleScopeLiveInstructions() {}

Pass::Status AggressiveDCEPass::ProcessImpl() {}

bool AggressiveDCEPass::EliminateDeadFunctions() {}

bool AggressiveDCEPass::ProcessGlobalValues() {}

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

void AggressiveDCEPass::InitExtensions() {}

Instruction* AggressiveDCEPass::GetHeaderBranch(BasicBlock* blk) {}

BasicBlock* AggressiveDCEPass::GetHeaderBlock(BasicBlock* blk) const {}

Instruction* AggressiveDCEPass::GetMergeInstruction(Instruction* inst) {}

Instruction* AggressiveDCEPass::GetBranchForNextHeader(BasicBlock* blk) {}

void AggressiveDCEPass::MarkFunctionParameterAsLive(const Function* func) {}

bool AggressiveDCEPass::BlockIsInConstruct(BasicBlock* header_block,
                                           BasicBlock* bb) {}

bool AggressiveDCEPass::IsEntryPointWithNoCalls(Function* func) {}

bool AggressiveDCEPass::IsEntryPoint(Function* func) {}

bool AggressiveDCEPass::HasCall(Function* func) {}

void AggressiveDCEPass::MarkFirstBlockAsLive(Function* func) {}

void AggressiveDCEPass::AddUnreachable(BasicBlock*& block) {}

}  // namespace opt
}  // namespace spvtools