Package org.teavm.model.util

Examples of org.teavm.model.util.DefinitionExtractor


        }
        arguments = null;
    }

    private void estimatePhis() {
        DefinitionExtractor definitionExtractor = new DefinitionExtractor();
        for (int i = 0; i < program.basicBlockCount(); ++i) {
            currentBlock = program.basicBlockAt(i);
            for (Instruction insn : currentBlock.getInstructions()) {
                insn.acceptVisitor(definitionExtractor);
                for (Variable var : definitionExtractor.getDefinedVariables()) {
                    markAssignment(var);
                }
            }
        }
    }
View Full Code Here


            instructions.addAll(0, newInstructions);
        }
    }

    private int whereDefined(List<Instruction> instructions, int index, Variable var) {
        DefinitionExtractor def = new DefinitionExtractor();
        while (index >= 0) {
            Instruction insn = instructions.get(index);
            insn.acceptVisitor(def);
            for (Variable defVar : def.getDefinedVariables()) {
                if (defVar == var) {
                    return index;
                }
            }
            --index;
View Full Code Here

        reads = new int[variableCount];
        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()]++;
                }
View Full Code Here

TOP

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

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.