private void addMapping(RegisterSpec ssaSpec, int ropReg) {
    int ssaReg = ssaSpec.getReg();

    // An assertion.
    if (ssaRegsMapped.get(ssaReg) || !canMapReg(ssaSpec, ropReg)) {
      throw new RuntimeException("attempt to add invalid register mapping");
    }

    if (DEBUG) {
      System.out.printf(
          "Add mapping s%d -> v%d c:%d\n", ssaSpec.getReg(), ropReg, ssaSpec.getCategory());
    }

    int category = ssaSpec.getCategory();
    mapper.addMapping(ssaSpec.getReg(), ropReg, category);
    ssaRegsMapped.set(ssaReg);
    usedRopRegs.set(ropReg, ropReg + category);
  }
Adds a mapping from an SSA register to a rop register. {@link #canMapReg} should have already
been called.

@param ssaSpec {@code non-null;} SSA register to map from
@param ropReg {@code >=0;} rop register to map to
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java