/** Append the list of variables used in this operand to the input list */ @Override public void addUsedVariables(List<Variable> l) { array.addUsedVariables(l); }
@Override public Operand getSimplifiedOperand(Map<Operand, Operand> valueMap, boolean force) { Operand v = valueMap.get(this); // You can only value-replace atomic values return (v != null) && (force || v.canCopyPropagate()) ? v : this; }
@Override public void simplifyOperands(Map<Operand, Operand> valueMap, boolean force) { arg1 = arg1.getSimplifiedOperand(valueMap, force); if (arg2 != null) arg2 = arg2.getSimplifiedOperand(valueMap, force); }
public void visit(Operand operand) { if (operand.hasKnownValue()) { operand.visit(this); } else if (operand instanceof Variable) { emitVariable((Variable)operand); } else { operand.visit(this); } }
@Override public Instr clone(CloneInfo ii) { return new ProcessModuleBodyInstr(ii.getRenamedVariable(result), getModuleBody().cloneForInlining(ii), getBlock().cloneForInlining(ii)); }
protected IRubyObject[] prepareArgumentsSimple(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { IRubyObject[] newArgs = new IRubyObject[argsCount]; for (int i = 0; i < argsCount; i++) { // receiver is operands[0] newArgs[i] = (IRubyObject) operands[i+1].retrieve(context, self, currScope, currDynScope, temp); } return newArgs; }
public void visit(Operand operand) { operand.visit(this); }
@Override public boolean hasKnownValue() { for (Operand o : elts) { if (!o.hasKnownValue()) return false; } return true; }
@Override public Operand simplifyAndGetResult(IRScope scope, Map<Operand, Operand> valueMap) { simplifyOperands(valueMap, false); Operand a = getArray().getValue(valueMap); return a instanceof Array ? a : null; }
@Override public void visit(Operand operand) { // Handle variables separately if (operand instanceof LocalVariable) { printAnsiOp(VARIABLE_COLOR, "*", operand); } else if (operand instanceof TemporaryVariable) { printAnsiOp(VARIABLE_COLOR, operand); } else { // Other operand forms need type identification printAnsi(OPERAND_COLOR, operand.getOperandType().shortName() + "<"); operand.visit(this); printAnsi(OPERAND_COLOR, ">"); } }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(symbolName); }
@Override public Operand fetchCompileTimeArrayElement(int argIndex, boolean getSubArray) { return array.fetchCompileTimeArrayElement(argIndex, getSubArray); }
@Override public Instr clone(CloneInfo ii) { return new AluInstr(getOperation(), ii.getRenamedVariable(result), getArg1().cloneForInlining(ii), getArg2().cloneForInlining(ii)); }
@Override public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { Object val = array.retrieve(context, self, currScope, currDynScope, temp); return (val instanceof RubyArray) ? val : context.nil; }
public void visit(Operand operand) { operand.visit(this); }
@Override public boolean hasKnownValue() { for (Operand o : pieces) { if (!o.hasKnownValue()) return false; } return true; }
public void visit(Operand operand) { if (operand.hasKnownValue()) { operand.visit(this); } else if (operand instanceof Variable) { emitVariable((Variable)operand); } else { operand.visit(this); } }
@Override public Operand simplifyAndGetResult(IRScope scope, Map<Operand, Operand> valueMap) { simplifyOperands(valueMap, false); return dontToAryArrays.isTrue() && (array.getValue(valueMap) instanceof Array) ? array : null; }
@Override public void visit(Operand operand) { // Handle variables separately if (operand instanceof LocalVariable) { printAnsiOp(VARIABLE_COLOR, "*", operand); } else if (operand instanceof TemporaryVariable) { printAnsiOp(VARIABLE_COLOR, operand); } else { // Other operand forms need type identification printAnsi(OPERAND_COLOR, operand.getOperandType().shortName() + "<"); operand.visit(this); printAnsi(OPERAND_COLOR, ">"); } }
@Override public void encode(IRWriterEncoder e) { super.encode(e); e.encode(frozenString); }