#pragma once
#include "data_flow.h"

#include <vector>
#include <set>
#include <algorithm>

#include "SgUtils.h"
#include "../CFGraph.h"
#include "../IR.h"

template <class NodeType>
class BackwardDataFlowAnalysis : public DataFlowAnalysis<NodeType>
{
    std::vector<SAPFOR::BasicBlock*> reorderSequence(const std::vector<SAPFOR::BasicBlock*>& blocks,
                                                     const std::set<SAPFOR::BasicBlock*> back_edge_sources);
public:
    void fit(const std::vector<SAPFOR::BasicBlock*>& blocks);
};

#include "backward_data_flow_impl.h"