private void addMapping(int ropReg, RegisterSpec ssaReg) {
      int ssaRegNum = ssaReg.getReg();
      LocalItem ssaRegLocal = ssaReg.getLocalItem();

      currentMapping[ropReg] = ssaReg;

      /*
       * Ensure all SSA register specs with the same reg are identical.
       */
      for (int i = currentMapping.length - 1; i >= 0; i--) {
        RegisterSpec cur = currentMapping[i];

        if (ssaRegNum == cur.getReg()) {
          currentMapping[i] = ssaReg;
        }
      }

      // All further steps are for registers with local information.
      if (ssaRegLocal == null) {
        return;
      }

      // Record that this SSA reg has been associated with a local.
      setNameForSsaReg(ssaReg);

      // Ensure that no other SSA regs are associated with this local.
      for (int i = currentMapping.length - 1; i >= 0; i--) {
        RegisterSpec cur = currentMapping[i];

        if (ssaRegNum != cur.getReg() && ssaRegLocal.equals(cur.getLocalItem())) {
          currentMapping[i] = cur.withLocalItem(null);
        }
      }
    }
Enforces a few contraints when a register mapping is added.

<ol>
  <li>Ensures that all new SSA registers specs in the mapping table with the same register
      number are identical. In effect, once an SSA register spec has received or lost a local
      variable name, then every old-namespace register that maps to it should gain or lose
      its local variable name as well.
  <li>Records the local name associated with the register so that a register is never
      associated with more than one local.
  <li>ensures that only one SSA register at a time is considered to be associated with a
      local variable. When {@code currentMapping} is updated and the newly added element is
      named, strip that name from any other SSA registers.
</ol>

@param ropReg {@code >= 0;} rop register number
@param ssaReg {@code non-null;} an SSA register that has just been added to {@code
    currentMapping}
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/SsaRenamer.java