Package org.teavm.model.util

Examples of org.teavm.model.util.UsageExtractor


        writes = new int[variableCount];
    }

    public void analyze(Program program) {
        DefinitionExtractor defExtractor = new DefinitionExtractor();
        UsageExtractor useExtractor = new UsageExtractor();
        for (int i = 0; i < program.basicBlockCount(); ++i) {
            BasicBlock block = program.basicBlockAt(i);
            for (Instruction insn : block.getInstructions()) {
                insn.acceptVisitor(defExtractor);
                insn.acceptVisitor(useExtractor);
                for (Variable var : defExtractor.getDefinedVariables()) {
                    writes[var.getIndex()]++;
                }
                for (Variable var : useExtractor.getUsedVariables()) {
                    reads[var.getIndex()]++;
                }
            }
            for (Phi phi : block.getPhis()) {
                writes[phi.getReceiver().getIndex()] += phi.getIncomings().size();
View Full Code Here

TOP

Related Classes of org.teavm.model.util.UsageExtractor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.