private void makeReference(Instruction instruction, int opIndex, Address addr) {
		if (targetInDelaySlot && instruction.getPrototype().hasDelaySlots()) {
			instruction = instruction.getNext();
			if (instruction == null) {
				return;
			}
		}
		if (opIndex == -1) {
			for (int i = 0; i < instruction.getNumOperands(); i++) {
				int opType = instruction.getOperandType(i);
				// markup the program counter for any flow
				if ((opType & OperandType.DYNAMIC) != 0) {
					opIndex = i;
					break;
				}
			}
		}
		if (opIndex == -1) {
			opIndex = instruction.getNumOperands() - 1;
		}

		// check if it already has the reference
		Reference[] referencesFrom = instruction.getReferencesFrom();
		boolean hasRef = Arrays.stream(referencesFrom).anyMatch(p -> p.getToAddress().equals(addr));
		if (hasRef) {
			return;
		}

		if (opIndex == -1) {
			instruction.addMnemonicReference(addr, RefType.DATA, SourceType.ANALYSIS);
		}
		else {
			instruction.addOperandReference(opIndex, addr, RefType.DATA, SourceType.ANALYSIS);
		}
	}
Make the reference on the instruction at the correct location.

@param instruction to receive reference
@param space reference created in this space
@param scalar used as offset into address space
Ghidra/Features/Base/ghidra_scripts/MultiInstructionMemReference.java