#include "source/opt/dead_branch_elim_pass.h"
#include <list>
#include <memory>
#include <vector>
#include "source/cfa.h"
#include "source/opt/ir_context.h"
#include "source/opt/struct_cfg_analysis.h"
#include "source/util/make_unique.h"
namespace spvtools {
namespace opt {
namespace {
constexpr uint32_t kBranchCondTrueLabIdInIdx = …;
constexpr uint32_t kBranchCondFalseLabIdInIdx = …;
}
bool DeadBranchElimPass::GetConstCondition(uint32_t condId, bool* condVal) { … }
bool DeadBranchElimPass::GetConstInteger(uint32_t selId, uint32_t* selVal) { … }
void DeadBranchElimPass::AddBranch(uint32_t labelId, BasicBlock* bp) { … }
BasicBlock* DeadBranchElimPass::GetParentBlock(uint32_t id) { … }
bool DeadBranchElimPass::MarkLiveBlocks(
Function* func, std::unordered_set<BasicBlock*>* live_blocks) { … }
bool DeadBranchElimPass::SimplifyBranch(BasicBlock* block,
uint32_t live_lab_id) { … }
void DeadBranchElimPass::MarkUnreachableStructuredTargets(
const std::unordered_set<BasicBlock*>& live_blocks,
std::unordered_set<BasicBlock*>* unreachable_merges,
std::unordered_map<BasicBlock*, BasicBlock*>* unreachable_continues) { … }
bool DeadBranchElimPass::FixPhiNodesInLiveBlocks(
Function* func, const std::unordered_set<BasicBlock*>& live_blocks,
const std::unordered_map<BasicBlock*, BasicBlock*>& unreachable_continues) { … }
bool DeadBranchElimPass::EraseDeadBlocks(
Function* func, const std::unordered_set<BasicBlock*>& live_blocks,
const std::unordered_set<BasicBlock*>& unreachable_merges,
const std::unordered_map<BasicBlock*, BasicBlock*>& unreachable_continues) { … }
bool DeadBranchElimPass::EliminateDeadBranches(Function* func) { … }
void DeadBranchElimPass::FixBlockOrder() { … }
Pass::Status DeadBranchElimPass::Process() { … }
Instruction* DeadBranchElimPass::FindFirstExitFromSelectionMerge(
uint32_t start_block_id, uint32_t merge_block_id, uint32_t loop_merge_id,
uint32_t loop_continue_id, uint32_t switch_merge_id) { … }
void DeadBranchElimPass::AddBlocksWithBackEdge(
uint32_t cont_id, uint32_t header_id, uint32_t merge_id,
std::unordered_set<BasicBlock*>* blocks_with_back_edges) { … }
bool DeadBranchElimPass::SwitchHasNestedBreak(uint32_t switch_header_id) { … }
}
}