private Reference addDefaultMemoryReferenceIfMissing(Instruction inst, int opIndex,
			Address refAddr, RefType refType, List<Reference> oldRefList,
			Reference operandPrimaryRef) {

		Reference ref = removeOldReference(oldRefList, refAddr, opIndex, refType);
		if (ref == null) {
			ref = refManager.addMemoryReference(inst.getMinAddress(), refAddr, refType,
				SourceType.DEFAULT, opIndex);
			if (operandPrimaryRef == null) {
				operandPrimaryRef = ref;
			}
		}
		else if (ref.isPrimary()) {
			operandPrimaryRef = ref;
		}
		return operandPrimaryRef;
	}
Remove the specified reference is from oldRefList if present, otherwise add to instruction 
as a DEFAULT. Return as preferred primary reference if it previously existed as a primary 
reference in oldRefList or the specified operandPrimaryRef was null.
@param inst instruction to which references apply
@param opIndex operand to which reference applies
@param refAddr default reference to-address
@param refType default reference type
@param oldRefList list of old references which exist on instruction which have yet to be 
accounted for (may be null).
@param operandPrimaryRef current preferred primary reference for operand
@return updated preferred primary address for operand (i.e., operandPrimaryRef)
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/code/CodeManager.java