private boolean performRegisterMarkup(Instruction instr, int opIndex, Function func,
			Reference primaryRef, Variable referencedVariable,
			HashMap<Register, Integer> regIndexMap, List<Object> representationList) {

		if (func == null || !options.doRegVariableMarkup) {
			return false;
		}

		Program program = instr.getProgram();
		Register referencedRegister = null;
		if (referencedVariable != null && referencedVariable.isRegisterVariable()) {
			referencedRegister = referencedVariable.getRegister();
		}
		else {
			// In the absence of a register reference, check for mnemonic write register reference
			// This is how the decompiler establishes first use assignment of a new variable
// TODO: Not sure if this will circumvent follow-on mark-up for non register variable reference
			ReferenceManager refMgr = program.getReferenceManager();
			for (Reference ref : instr.getReferencesFrom()) {
				if (ref.getOperandIndex() == Reference.MNEMONIC &&
					ref.getReferenceType().isWrite()) {
					referencedVariable = refMgr.getReferencedVariable(ref);
					if (referencedVariable != null && referencedVariable.isRegisterVariable()) {
						primaryRef = ref;
						referencedRegister = referencedVariable.getRegister();
// TODO: Should we allow primaryRef to live-on for additional markup ?
						break;
					}
				}
			}
		}

		// Handle possible explicit and inferred register references without scalar offset
		// The corresponding register will be replaced by the associated VariableOffset object.
		for (Register reg : regIndexMap.keySet()) {
			VariableOffset varOff = null;
			if (registersOverlap(referencedRegister, reg)) {
				varOff = new VariableOffset(primaryRef, referencedVariable);
				primaryRef = null; // reference consumed
				referencedVariable = null;
			}
			else if (options.includeInferredVariableMarkup) {
				boolean isRead = isRead(reg, instr);
				Variable regVar = program.getFunctionManager()
						.getReferencedVariable(instr.getMinAddress(), reg.getAddress(),
							reg.getMinimumByteSize(), isRead);
				if (regVar != null) {
					// TODO: If register appears more than once, how can we distinguish read vs. write occurrence in operands
					if (isRead && isWritten(reg, instr) && !hasRegisterWriteReference(instr, reg) &&
						instr.getRegister(opIndex) != null) {
						// If register both read and written and there are no write references for this instruction
						// see if there is only one reference to choose from - if not we can't determine how to markup
						Variable regWriteVar = program.getFunctionManager()
								.getReferencedVariable(instr.getMinAddress(), reg.getAddress(),
									reg.getMinimumByteSize(), false);
						if (regWriteVar != regVar) {
							continue; // TODO: tough case - not which operand is read vs. write!
						}
					}

					// if can't get just a register out of it, assume indirection for the VariableOffset
					long offset = 0;
					varOff = new VariableOffset(regVar, offset, instr.getRegister(opIndex) == null,
						true);
				}
			}
			if (varOff != null) {
				varOff.setReplacedElement(reg);
				representationList.set(regIndexMap.get(reg), varOff);
			}
		}
		return primaryRef == null;
	}
Perform register markup with explicit and implied register variable
reference.

@param inst instruction
@param opIndex
@param func function containing instruction
@param primaryRef primary reference or null
@param referencedVariable option variable referenced by primaryRef
@param regIndexMap register index map
@param representationList
@return true if primaryRef was included in register mark-up
Ghidra/Features/Base/src/main/java/ghidra/program/model/listing/CodeUnitFormat.java