#include "source/opt/loop_fusion.h"
#include <algorithm>
#include <vector>
#include "source/opt/ir_context.h"
#include "source/opt/loop_dependence.h"
#include "source/opt/loop_descriptor.h"
namespace spvtools {
namespace opt {
namespace {
void CollectChildren(Loop* loop, std::vector<const Loop*>* loops) { … }
std::set<Instruction*> GetLocationsAccessed(
const std::map<Instruction*, std::vector<Instruction*>>& stores,
const std::map<Instruction*, std::vector<Instruction*>>& loads) { … }
void GetDependences(std::vector<DistanceVector>* dependences,
LoopDependenceAnalysis* analysis,
const std::vector<Instruction*>& sources,
const std::vector<Instruction*>& destinations,
size_t num_entries) { … }
void AddInstructionsInBlock(std::vector<Instruction*>* instructions,
BasicBlock* block) { … }
}
bool LoopFusion::UsedInContinueOrConditionBlock(Instruction* phi_instruction,
Loop* loop) { … }
void LoopFusion::RemoveIfNotUsedContinueOrConditionBlock(
std::vector<Instruction*>* instructions, Loop* loop) { … }
bool LoopFusion::AreCompatible() { … }
bool LoopFusion::ContainsBarriersOrFunctionCalls(Loop* loop) { … }
bool LoopFusion::CheckInit() { … }
bool LoopFusion::CheckCondition() { … }
bool LoopFusion::CheckStep() { … }
std::map<Instruction*, std::vector<Instruction*>> LoopFusion::LocationToMemOps(
const std::vector<Instruction*>& mem_ops) { … }
std::pair<std::vector<Instruction*>, std::vector<Instruction*>>
LoopFusion::GetLoadsAndStoresInLoop(Loop* loop) { … }
bool LoopFusion::IsUsedInLoop(Instruction* instruction, Loop* loop) { … }
bool LoopFusion::IsLegal() { … }
void ReplacePhiParentWith(Instruction* inst, uint32_t orig_block,
uint32_t new_block) { … }
void LoopFusion::Fuse() { … }
}
}