Package booton.translator

Examples of booton.translator.OperandCondition


            if (match(DCMP, JUMP) || match(FCMP, JUMP)) {
                // for float and double
                current.condition(current.remove(1), EQ, current.remove(0), node);
            } else if (match(LCMP, JUMP)) {
                // for long
                current.addOperand(new OperandCondition(operateLong("equals"), NE, ZERO, node));
            } else {
                // others
                current.condition(current.remove(0), EQ, ZERO, node);
            }
            break;
        case IFNE: // != 0
            if (match(DCMP, JUMP) || match(FCMP, JUMP)) {
                // for float and double
                current.condition(current.remove(1), NE, current.remove(0), node);
            } else if (match(LCMP, JUMP)) {
                // for long
                current.addOperand(new OperandCondition(operateLong("notEquals"), NE, ZERO, node));
            } else {
                // others
                current.condition(current.remove(0), NE, ZERO, node);
            }
            break;

        case IFGE: // => 0
            if (match(DCMP, JUMP) || match(FCMP, JUMP)) {
                // for float and double
                current.condition(current.remove(1), GE, current.remove(0), node);
            } else if (match(LCMP, JUMP)) {
                // for long
                current.addOperand(new OperandCondition(operateLong("greaterThanOrEqual"), NE, ZERO, node));
            } else {
                // others
                current.condition(current.remove(0), GE, ZERO, node);
            }
            break;

        case IFGT: // > 0
            if (match(DCMP, JUMP) || match(FCMP, JUMP)) {
                // for float and double
                current.condition(current.remove(1), GT, current.remove(0), node);
            } else if (match(LCMP, JUMP)) {
                // for long
                current.addOperand(new OperandCondition(operateLong("greaterThan"), NE, ZERO, node));
            } else {
                // others
                current.condition(current.remove(0), GT, ZERO, node);
            }
            break;

        case IFLE: // <= 0
            if (match(DCMP, JUMP) || match(FCMP, JUMP)) {
                // for float and double
                current.condition(current.remove(1), LE, current.remove(0), node);
            } else if (match(LCMP, JUMP)) {
                // for long
                current.addOperand(new OperandCondition(operateLong("lessThanOrEqual"), NE, ZERO, node));
            } else {
                // others
                current.condition(current.remove(0), LE, ZERO, node);
            }
            break;

        case IFLT: // < 0
            if (match(DCMP, JUMP) || match(FCMP, JUMP)) {
                // for float and double
                current.condition(current.remove(1), LT, current.remove(0), node);
            } else if (match(LCMP, JUMP)) {
                // for long
                current.addOperand(new OperandCondition(operateLong("lessThan"), NE, ZERO, node));
            } else {
                // others
                current.condition(current.remove(0), LT, ZERO, node);
            }
            break;
View Full Code Here


                    node.destination = target.getDestination();
                }

                for (Operand operand : node.stack) {
                    if (operand instanceof OperandCondition) {
                        OperandCondition condition = (OperandCondition) operand;

                        if (condition.then == target) {
                            condition.then = target.getDestination();
                        }
View Full Code Here

            return;
        }

        // Search and merge the sequencial conditional operands in this node from right to left.
        int start = info.start;
        OperandCondition left = null;
        OperandCondition right = (OperandCondition) node.peek(start);

        for (int index = 1; index < info.conditions.size(); index++) {
            left = (OperandCondition) node.peek(start + index);

            if (info.canMerge(left, right)) {
                Debugger.print("Merge conditions. left[" + left + "]  right[" + right + "] start: " + node.id);
                Debugger.print(nodes);

                // Merge two adjucent conditional operands.
                right = new OperandCondition(left, (OperandCondition) node.remove(--start + index));

                node.set(start + index, right);
            } else {
                Debugger.print("Stop merging at " + node.id + "  left[" + left + "]  right[" + right + "]");
                Debugger.print(nodes);
                right = left;
                left = null;
            }
        }

        // If the previous node is terminated by conditional operand and the target node is started
        // by conditional operand, we should try to merge them.
        if (info.conditionalHead && node.previous != null) {
            Operand operand = node.previous.peek(0);

            if (operand instanceof OperandCondition) {
                OperandCondition condition = (OperandCondition) operand;

                if (info.canMerge(condition, right) && condition.elze == node) {
                    dispose(node);

                    // Merge recursively
View Full Code Here

                        break;
                    }
                }

                // conditional operand is found
                OperandCondition condition = (OperandCondition) operand;

                if (conditions.isEmpty()) {
                    // this is first condition
                    start = index;
View Full Code Here

                    // transfer condition operands to the created node
                    // [non-condition] [condition]
                    Node created = createNodeAfter(base);

                    for (int i = 0; i < size; i++) {
                        OperandCondition condition = (OperandCondition) base.stack.pollLast();

                        // disconnect from base node
                        base.disconnect(condition.then);
                        base.disconnect(condition.elze);
View Full Code Here

TOP

Related Classes of booton.translator.OperandCondition

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.