private void replaceDef(SsaInsn def, SsaInsn prev, int length, ArrayList<RegisterSpec> newRegs) {
    Type resultType = def.getResult().getType();

    // Create new zeroed out registers for each element in the array
    for (int i = 0; i < length; i++) {
      Constant newZero = Zeroes.zeroFor(resultType.getComponentType());
      TypedConstant typedZero = (TypedConstant) newZero;
      RegisterSpec newReg = RegisterSpec.make(ssaMeth.makeNewSsaReg(), typedZero);
      newRegs.add(newReg);
      insertPlainInsnBefore(def, RegisterSpecList.EMPTY, newReg, RegOps.CONST, newZero);
    }
  }
Replaces the instructions that define an array with equivalent registers. For each entry in the
array, a register is created, initialized to zero. A mapping between this register and the
corresponding array index is added.

@param def {@code non-null;} move result instruction for array
@param prev {@code non-null;} instruction for instantiating new array
@param length size of the new array
@param newRegs {@code non-null;} mapping of array indices to new registers to be populated
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/EscapeAnalysis.java