Search in sources :

Example 1 with Insn

use of suite.instructionexecutor.InstructionUtil.Insn in project suite by stupidsing.

the class InstructionExtractor method extract.

private Instruction extract(List<Node> rs) {
    String insnName = ((Atom) rs.get(0)).name;
    Insn insn;
    if (Objects.equals(insnName, "EVALUATE")) {
        Atom atom = (Atom) rs.remove(3);
        TermOp operator = TermOp.find(atom.name);
        insn = InstructionUtil.getEvalInsn(operator);
    } else
        insn = InstructionUtil.getInsn(insnName);
    if (insn != null) {
        Instruction instruction = new // 
        Instruction(// 
        insn, // 
        getRegisterNumber(rs, 1), // 
        getRegisterNumber(rs, 2), getRegisterNumber(rs, 3));
        if (insn == Insn.FRAMEBEGIN____)
            frameBegins.push(instruction);
        else if (insn == Insn.FRAMEEND______)
            frameBegins.pop();
        return instruction;
    } else
        return Fail.t("unknown opcode " + insnName);
}
Also used : Insn(suite.instructionexecutor.InstructionUtil.Insn) TermOp(suite.node.io.TermOp) Instruction(suite.instructionexecutor.InstructionUtil.Instruction) Atom(suite.node.Atom)

Aggregations

Insn (suite.instructionexecutor.InstructionUtil.Insn)1 Instruction (suite.instructionexecutor.InstructionUtil.Instruction)1 Atom (suite.node.Atom)1 TermOp (suite.node.io.TermOp)1