package accrue.analysis.ctldep;

import polyglot.ast.ProcedureDecl;
import polyglot.types.SemanticException;
import accrue.AccrueExtensionInfo;
import accrue.analysis.AnalysisTopics;
import accrue.analysis.interprocanalysis.AnalysisFactory;
import accrue.analysis.interprocanalysis.AnalysisUnit;
import accrue.analysis.interprocanalysis.AnalysisUtil;
import accrue.analysis.interprocanalysis.WorkQueue;

public class CtlDepAnalysisFactory extends AnalysisFactory<CDAbsVal> {

    public CtlDepAnalysisFactory(AccrueExtensionInfo extInfo) {
        super(extInfo);
    }

    public static final String ANALYSIS_NAME = "accrue.analysis.ctldep";

    /**
     * The set of EdgeIdentifiers the current node is control dependent on.
     */
    public static final String BRANCH_SOURCES = ANALYSIS_NAME
            + ".BRANCH_SOURCES";
    /**
     * The set of EdgeIdentifiers to nodes that are control dependent on the current node.
     */
    public static final String BRANCH_TARGETS = ANALYSIS_NAME
            + ".BRANCH_TARGETS";

    @Override
    public String analysisName() {
        return ANALYSIS_NAME;
    }

    @Override
    public String analysisReportName() {
        return AnalysisTopics.CTLDEP;
    }

    @Override
    public AnalysisUtil<CDAbsVal> analysisUtil(WorkQueue<CDAbsVal> wq,
            AnalysisUnit aunit) {
        return new CtlDepAnalysisUtil(wq, aunit, extInfo);
    }

    @Override
    public CDAbsVal startItem(AnalysisUtil<CDAbsVal> autil,
            ProcedureDecl startProc) throws SemanticException {
        return CDAbsVal.STARTPROC;
    }
}
