/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   DominatorsTreeAnalysisProvider.h
 * Author: pgess
 *
 * Created on May 13, 2016, 11:39 AM
 */

#ifndef DOMINATORSTREEANALYSISPROVIDER_H
#define DOMINATORSTREEANALYSISPROVIDER_H

#include "clasplayer.h"
#include <boost/smart_ptr/scoped_ptr.hpp>

namespace xreate{
    class DominatorTree;
    
    class DominatorsTreeAnalysisProvider: public IAnalysisData {
    public:
        typedef std::pair<ScopePacked, ScopePacked> DominatedRange;
        typedef std::map<ScopePacked, DominatedRange> Dominators;
        
        DominatorsTreeAnalysisProvider();
        virtual ~DominatorsTreeAnalysisProvider();

        void run(const ClaspLayer* engine);
        void print(std::ostringstream& output) const;
        
        const Dominators& getForwardDominators() const;
        const Dominators& getPostDominators() const;
        
    private:
        boost::scoped_ptr<DominatorTree> treeForwardDominators;
        boost::scoped_ptr<DominatorTree> treePostDominators;
    };
}

#endif /* DOMINATORSTREEANALYSISPROVIDER_H */

