private void processRegisterReference(Map<String, Object> result, boolean overwrite) {
		try {
			Address fromAddr = getLocation(result);
			if (fromAddr == null) {
				throw new AddressFormatException("Incompatible Memory Reference FROM Address");
			}

			String toAddrStr = (String) result.get("to");
			if (toAddrStr == null) {
				throw new RuntimeException("TO_ADDRESS attribute missing for REGISTER_REFERENCE element");
			}
			Address toAddr = parseAddress(factory, toAddrStr);
			if (toAddr == null) {
				throw new AddressFormatException("Incompatible Register Reference TO Address: " + toAddrStr);
			}
			Register[] registers = program.getLanguage().getRegisters(toAddr);
			Register reg = registers[0];

			int opIndex = CodeUnit.MNEMONIC;
			if (result.get("opIndex") != null) {
				opIndex = (int) (double) result.get("opIndex");
			}

			boolean primary = false;
			if (result.get("primary") != null) {
				primary = (boolean) result.get("primary");
			}

			if (!overwrite) {
				Reference[] existingRefs = refManager.getReferencesFrom(fromAddr, opIndex);
				if (existingRefs != null && existingRefs.length != 0) {
					log.appendMsg("Memory reference already existed from [" + fromAddr + "] to [" + toAddr
							+ "] on operand [" + opIndex + "]");
					return;
				}
			}

			int index = Integer.parseInt((String) result.get("index"));
			RefType refType = getRefType(index);

			SourceType sourceType = getSourceType((String) result.get("sourceType"));
			ReferenceManager refMgr = program.getReferenceManager();
			Reference ref = refMgr.addRegisterReference(fromAddr, opIndex, reg, refType, sourceType);
			refMgr.setPrimary(ref, primary);

		} catch (Exception e) {
			log.appendException(e);
		}
	}
@param result
@param language
@param overwrite
Ghidra/Features/Sarif/src/main/java/sarif/managers/MarkupSarifMgr.java