Search in sources :

Example 1 with DFACallgraphBuilder

use of com.jopdesign.dfa.framework.DFACallgraphBuilder in project jop by jop-devel.

the class PhaseExecutor method buildCallGraph.

public void buildCallGraph(boolean useDFA) {
    if (useDFA) {
        // build the callgraph using DFA results
        DFACallgraphBuilder builder = new DFACallgraphBuilder(jcopter.getDfaTool(), appInfo.getCallstringLength());
        builder.setSkipNatives(true);
        appInfo.buildCallGraph(builder);
    } else {
        DefaultCallgraphBuilder builder = new DefaultCallgraphBuilder();
        builder.setSkipNatives(true);
        // rebuild without using the existing callgraph, because the callstrings are not updated by SimpleInliner
        builder.setUseCallgraph(false);
        appInfo.buildCallGraph(builder);
        // reduce the callgraph old-school
        reduceCallGraph();
    }
}
Also used : DFACallgraphBuilder(com.jopdesign.dfa.framework.DFACallgraphBuilder) DefaultCallgraphBuilder(com.jopdesign.common.code.DefaultCallgraphBuilder)

Example 2 with DFACallgraphBuilder

use of com.jopdesign.dfa.framework.DFACallgraphBuilder in project jop by jop-devel.

the class WCETTool method initialize.

public void initialize(boolean loadLinkInfo, boolean initDFA) throws BadConfigurationException {
    if (projectConfig.saveResults()) {
        this.resultRecord = projectConfig.getResultFile();
        if (!projectConfig.appendResults()) {
            // TODO remove existing file if we do not append?
            //resultRecord.delete();
            recordMetric("problem", this.getProjectName());
            if (projectConfig.addPerformanceResults()) {
                recordMetric("date", new Date());
            }
        }
    }
    if (loadLinkInfo) {
        linkerInfo = new LinkerInfo(this);
        try {
            linkerInfo.loadLinkInfo();
        } catch (IOException e) {
            throw new BadConfigurationException("Could not load link infos", e);
        } catch (ClassNotFoundException e) {
            throw new BadConfigurationException("Could not load link infos", e);
        }
    }
    /* run dataflow analysis */
    if (doDataflowAnalysis() && initDFA) {
        topLevelLogger.info("Starting DFA analysis");
        dataflowAnalysis();
        topLevelLogger.info("DFA analysis finished");
    }
    if (!appInfo.hasCallGraph()) {
        DefaultCallgraphBuilder callGraphBuilder;
        /* build callgraph for the whole program */
        if (doDataflowAnalysis()) {
            // build the callgraph using DFA results
            callGraphBuilder = new DFACallgraphBuilder(getDfaTool(), appInfo.getCallstringLength());
        } else {
            callGraphBuilder = new DefaultCallgraphBuilder();
        }
        // we do not want natives in the callgraph
        callGraphBuilder.setSkipNatives(true);
        appInfo.buildCallGraph(callGraphBuilder);
    }
    /* build callgraph for target method */
    rebuildCallGraph();
    if (projectConfig.doPreprocess()) {
        WCETPreprocess.preprocess(appInfo);
    }
    dumpCallGraph("callgraph");
}
Also used : DFACallgraphBuilder(com.jopdesign.dfa.framework.DFACallgraphBuilder) DefaultCallgraphBuilder(com.jopdesign.common.code.DefaultCallgraphBuilder) LinkerInfo(com.jopdesign.wcet.jop.LinkerInfo) BadConfigurationException(com.jopdesign.common.config.Config.BadConfigurationException) IOException(java.io.IOException) Date(java.util.Date)

Aggregations

DefaultCallgraphBuilder (com.jopdesign.common.code.DefaultCallgraphBuilder)2 DFACallgraphBuilder (com.jopdesign.dfa.framework.DFACallgraphBuilder)2 BadConfigurationException (com.jopdesign.common.config.Config.BadConfigurationException)1 LinkerInfo (com.jopdesign.wcet.jop.LinkerInfo)1 IOException (java.io.IOException)1 Date (java.util.Date)1