#ifndef SOURCE_CFA_H_
#define SOURCE_CFA_H_
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <functional>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
namespace spvtools {
template <class BB>
class CFA { … };
template <class BB>
bool CFA<BB>::FindInWorkList(const std::vector<block_info>& work_list,
uint32_t id) { … }
template <class BB>
void CFA<BB>::DepthFirstTraversal(const BB* entry,
get_blocks_func successor_func,
std::function<void(cbb_ptr)> preorder,
std::function<void(cbb_ptr)> postorder,
std::function<bool(cbb_ptr)> terminal) { … }
template <class BB>
void CFA<BB>::DepthFirstTraversal(
const BB* entry, get_blocks_func successor_func,
std::function<void(cbb_ptr)> preorder,
std::function<void(cbb_ptr)> postorder,
std::function<void(cbb_ptr, cbb_ptr)> backedge,
std::function<bool(cbb_ptr)> terminal) { … }
template <class BB>
std::vector<std::pair<BB*, BB*>> CFA<BB>::CalculateDominators(
const std::vector<cbb_ptr>& postorder, get_blocks_func predecessor_func) { … }
template <class BB>
std::vector<BB*> CFA<BB>::TraversalRoots(const std::vector<BB*>& blocks,
get_blocks_func succ_func,
get_blocks_func pred_func) { … }
template <class BB>
void CFA<BB>::ComputeAugmentedCFG(
std::vector<BB*>& ordered_blocks, BB* pseudo_entry_block,
BB* pseudo_exit_block,
std::unordered_map<const BB*, std::vector<BB*>>* augmented_successors_map,
std::unordered_map<const BB*, std::vector<BB*>>* augmented_predecessors_map,
get_blocks_func succ_func, get_blocks_func pred_func) { … }
}
#endif