public Operand buildMultipleAsgn(MultipleAsgnNode multipleAsgnNode, IRScope s) { Operand values = build(multipleAsgnNode.getValueNode(), s); Variable ret = getValueInTemporaryVariable(s, values); buildMultipleAsgnAssignment(multipleAsgnNode, s, null, ret); return ret; }
public Operand buildMultipleAsgn(MultipleAsgnNode multipleAsgnNode, IRScope s) { Operand values = build(multipleAsgnNode.getValueNode(), s); Variable ret = getValueInTemporaryVariable(s, values); buildMultipleAsgnAssignment(multipleAsgnNode, s, null, ret); return ret; }
public Operand buildMultipleAsgn19(MultipleAsgnNode multipleAsgnNode) { Node valueNode = multipleAsgnNode.getValueNode(); Operand values = build(valueNode); Variable ret = getValueInTemporaryVariable(values); if (valueNode instanceof ArrayNode) { buildMultipleAsgn19Assignment(multipleAsgnNode, null, ret); } else { Variable tmp = createTemporaryVariable(); addInstr(new ToAryInstr(tmp, ret)); buildMultipleAsgn19Assignment(multipleAsgnNode, null, tmp); } return ret; }
public Operand buildMultipleAsgn19(MultipleAsgnNode multipleAsgnNode) { Node valueNode = multipleAsgnNode.getValueNode(); Operand values = build(valueNode); Variable ret = getValueInTemporaryVariable(values); if (valueNode instanceof ArrayNode) { buildMultipleAsgn19Assignment(multipleAsgnNode, null, ret); } else { Variable tmp = createTemporaryVariable(); addInstr(new ToAryInstr(tmp, ret)); buildMultipleAsgn19Assignment(multipleAsgnNode, null, tmp); } return ret; }
protected Variable buildDefnCheckIfThenPaths(Label undefLabel, Operand defVal) { Label defLabel = getNewLabel(); Variable tmpVar = getValueInTemporaryVariable(defVal); addInstr(new JumpInstr(defLabel)); addInstr(new LabelInstr(undefLabel)); addInstr(new CopyInstr(tmpVar, manager.getNil())); addInstr(new LabelInstr(defLabel)); return tmpVar; }
protected Variable buildDefnCheckIfThenPaths(IRScope s, Label undefLabel, Operand defVal) { Label defLabel = s.getNewLabel(); Variable tmpVar = getValueInTemporaryVariable(s, defVal); s.addInstr(new JumpInstr(defLabel)); s.addInstr(new LabelInstr(undefLabel)); s.addInstr(new CopyInstr(tmpVar, manager.getNil())); s.addInstr(new LabelInstr(defLabel)); return tmpVar; }
protected Variable buildDefnCheckIfThenPaths(IRScope s, Label undefLabel, Operand defVal) { Label defLabel = s.getNewLabel(); Variable tmpVar = getValueInTemporaryVariable(s, defVal); s.addInstr(new JumpInstr(defLabel)); s.addInstr(new LabelInstr(undefLabel)); s.addInstr(new CopyInstr(tmpVar, manager.getNil())); s.addInstr(new LabelInstr(defLabel)); return tmpVar; }
protected Variable buildDefnCheckIfThenPaths(Label undefLabel, Operand defVal) { Label defLabel = getNewLabel(); Variable tmpVar = getValueInTemporaryVariable(defVal); addInstr(new JumpInstr(defLabel)); addInstr(new LabelInstr(undefLabel)); addInstr(new CopyInstr(tmpVar, manager.getNil())); addInstr(new LabelInstr(defLabel)); return tmpVar; }
public Operand buildOpAsgnAnd(OpAsgnAndNode andNode) { Label l = getNewLabel(); Operand v1 = build(andNode.getFirstNode()); Variable result = getValueInTemporaryVariable(v1); addInstr(createBranch(v1, manager.getFalse(), l)); Operand v2 = build(andNode.getSecondNode()); // This does the assignment! addInstr(new CopyInstr(result, v2)); addInstr(new LabelInstr(l)); return result; }
public Operand buildOpAsgnAnd(OpAsgnAndNode andNode, IRScope s) { Label l = s.getNewLabel(); Operand v1 = build(andNode.getFirstNode(), s); Variable result = getValueInTemporaryVariable(s, v1); s.addInstr(BEQInstr.create(v1, manager.getFalse(), l)); Operand v2 = build(andNode.getSecondNode(), s); // This does the assignment! s.addInstr(new CopyInstr(result, v2)); s.addInstr(new LabelInstr(l)); return result; }
public Operand buildOpAsgnAnd(OpAsgnAndNode andNode) { Label l = getNewLabel(); Operand v1 = build(andNode.getFirstNode()); Variable result = getValueInTemporaryVariable(v1); addInstr(createBranch(v1, manager.getFalse(), l)); Operand v2 = build(andNode.getSecondNode()); // This does the assignment! addInstr(new CopyInstr(result, v2)); addInstr(new LabelInstr(l)); return result; }
public Operand buildOpAsgnAnd(OpAsgnAndNode andNode, IRScope s) { Label l = s.getNewLabel(); Operand v1 = build(andNode.getFirstNode(), s); Variable result = getValueInTemporaryVariable(s, v1); s.addInstr(BEQInstr.create(v1, manager.getFalse(), l)); Operand v2 = build(andNode.getSecondNode(), s); // This does the assignment! s.addInstr(new CopyInstr(result, v2)); s.addInstr(new LabelInstr(l)); return result; }
public Operand buildOr(final OrNode orNode) { // lazy evaluation opt. Don't bother building rhs of expr is lhs is unconditionally true. if (orNode.getFirstNode().getNodeType().alwaysTrue()) return build(orNode.getFirstNode()); // lazy evaluation opt. Eliminate conditional logic if we know lhs is always false. if (orNode.getFirstNode().getNodeType().alwaysFalse()) { build(orNode.getFirstNode()); // needs to be executed for potential side-effects return build(orNode.getSecondNode()); // but we return rhs for result. } Label endOfExprLabel = getNewLabel(); Operand left = build(orNode.getFirstNode()); Variable result = getValueInTemporaryVariable(left); addInstr(createBranch(left, manager.getTrue(), endOfExprLabel)); Operand right = build(orNode.getSecondNode()); addInstr(new CopyInstr(result, right)); addInstr(new LabelInstr(endOfExprLabel)); return result; }
public Operand buildOr(final OrNode orNode) { // lazy evaluation opt. Don't bother building rhs of expr is lhs is unconditionally true. if (orNode.getFirstNode().getNodeType().alwaysTrue()) return build(orNode.getFirstNode()); // lazy evaluation opt. Eliminate conditional logic if we know lhs is always false. if (orNode.getFirstNode().getNodeType().alwaysFalse()) { build(orNode.getFirstNode()); // needs to be executed for potential side-effects return build(orNode.getSecondNode()); // but we return rhs for result. } Label endOfExprLabel = getNewLabel(); Operand left = build(orNode.getFirstNode()); Variable result = getValueInTemporaryVariable(left); addInstr(createBranch(left, manager.getTrue(), endOfExprLabel)); Operand right = build(orNode.getSecondNode()); addInstr(new CopyInstr(result, right)); addInstr(new LabelInstr(endOfExprLabel)); return result; }
public Operand buildAnd(final AndNode andNode, IRScope s) { if (andNode.getFirstNode().getNodeType().alwaysTrue()) { // build first node (and ignore its result) and then second node build(andNode.getFirstNode(), s); return build(andNode.getSecondNode(), s); } else if (andNode.getFirstNode().getNodeType().alwaysFalse()) { // build first node only and return its value return build(andNode.getFirstNode(), s); } else { Label l = s.getNewLabel(); Operand v1 = build(andNode.getFirstNode(), s); Variable ret = getValueInTemporaryVariable(s, v1); s.addInstr(BEQInstr.create(v1, manager.getFalse(), l)); Operand v2 = build(andNode.getSecondNode(), s); s.addInstr(new CopyInstr(ret, v2)); s.addInstr(new LabelInstr(l)); return ret; } }
public Operand buildOr(final OrNode orNode, IRScope s) { if (orNode.getFirstNode().getNodeType().alwaysTrue()) { // build first node only and return true return build(orNode.getFirstNode(), s); } else if (orNode.getFirstNode().getNodeType().alwaysFalse()) { // build first node as non-expr and build second node build(orNode.getFirstNode(), s); return build(orNode.getSecondNode(), s); } else { Label l = s.getNewLabel(); Operand v1 = build(orNode.getFirstNode(), s); Variable ret = getValueInTemporaryVariable(s, v1); s.addInstr(BEQInstr.create(v1, manager.getTrue(), l)); Operand v2 = build(orNode.getSecondNode(), s); s.addInstr(new CopyInstr(ret, v2)); s.addInstr(new LabelInstr(l)); return ret; } }
public Operand buildAnd(final AndNode andNode) { if (andNode.getFirstNode().getNodeType().alwaysTrue()) { // build first node (and ignore its result) and then second node build(andNode.getFirstNode()); return build(andNode.getSecondNode()); } else if (andNode.getFirstNode().getNodeType().alwaysFalse()) { // build first node only and return its value return build(andNode.getFirstNode()); } else { Label l = getNewLabel(); Operand v1 = build(andNode.getFirstNode()); Variable ret = getValueInTemporaryVariable(v1); addInstr(createBranch(v1, manager.getFalse(), l)); Operand v2 = build(andNode.getSecondNode()); addInstr(new CopyInstr(ret, v2)); addInstr(new LabelInstr(l)); return ret; } }
public Operand buildAnd(final AndNode andNode) { if (andNode.getFirstNode().getNodeType().alwaysTrue()) { // build first node (and ignore its result) and then second node build(andNode.getFirstNode()); return build(andNode.getSecondNode()); } else if (andNode.getFirstNode().getNodeType().alwaysFalse()) { // build first node only and return its value return build(andNode.getFirstNode()); } else { Label l = getNewLabel(); Operand v1 = build(andNode.getFirstNode()); Variable ret = getValueInTemporaryVariable(v1); addInstr(createBranch(v1, manager.getFalse(), l)); Operand v2 = build(andNode.getSecondNode()); addInstr(new CopyInstr(ret, v2)); addInstr(new LabelInstr(l)); return ret; } }
public Operand buildOr(final OrNode orNode, IRScope s) { if (orNode.getFirstNode().getNodeType().alwaysTrue()) { // build first node only and return true return build(orNode.getFirstNode(), s); } else if (orNode.getFirstNode().getNodeType().alwaysFalse()) { // build first node as non-expr and build second node build(orNode.getFirstNode(), s); return build(orNode.getSecondNode(), s); } else { Label l = s.getNewLabel(); Operand v1 = build(orNode.getFirstNode(), s); Variable ret = getValueInTemporaryVariable(s, v1); s.addInstr(BEQInstr.create(v1, manager.getTrue(), l)); Operand v2 = build(orNode.getSecondNode(), s); s.addInstr(new CopyInstr(ret, v2)); s.addInstr(new LabelInstr(l)); return ret; } }
public Operand buildAnd(final AndNode andNode, IRScope s) { if (andNode.getFirstNode().getNodeType().alwaysTrue()) { // build first node (and ignore its result) and then second node build(andNode.getFirstNode(), s); return build(andNode.getSecondNode(), s); } else if (andNode.getFirstNode().getNodeType().alwaysFalse()) { // build first node only and return its value return build(andNode.getFirstNode(), s); } else { Label l = s.getNewLabel(); Operand v1 = build(andNode.getFirstNode(), s); Variable ret = getValueInTemporaryVariable(s, v1); s.addInstr(BEQInstr.create(v1, manager.getFalse(), l)); Operand v2 = build(andNode.getSecondNode(), s); s.addInstr(new CopyInstr(ret, v2)); s.addInstr(new LabelInstr(l)); return ret; } }