private static String buildStringRepresentation(Program program, Address address,
			Reference reference, ShowBlockName showBlockName) {
		if (address == null) {
			return "<NULL>";
		}
		if (address.getAddressSpace().getType() == AddressSpace.TYPE_NONE) {
			return ""; // NO_ADDRESS or EXT_FROM_ADDRESS not rendered
		}
		if (address.isExternalAddress()) {
			return getExternalAddressRepresentation(program, address);
		}
		if (address.isVariableAddress()) {
			return getVariableAddressRepresentation();
		}
		if (address.isStackAddress()) {
			return getStackAddressRepresentation(address);
		}
		if (address.isConstantAddress()) {
			return getConstantAddressRepresentation(address);
		}
		if (isRegisterAddress(program, address)) {
			return getRegisterAddressRepresentation(program, address);
		}

		// Handle all other spaces (e.g., memory, other, overlays, hash, etc.)
		String addrStr;
		if (reference != null && reference.isOffsetReference()) {
			OffsetReference offsetRef = (OffsetReference) reference;
			long offset = offsetRef.getOffset();
			boolean neg = (offset < 0);
			Address baseAddr = offsetRef.getBaseAddress();
			addrStr = baseAddr.toString() + (neg ? "-" : "+") + "0x" +
				Long.toHexString(neg ? -offset : offset);
		}
		else if (reference != null && reference.isShiftedReference()) {
			// TODO: unsure of rendering which has never really been addressed
			// TODO: shifted references have never addressed concerns related to
			// addressable unit size
			ShiftedReference shiftedRef = (ShiftedReference) reference;
			StringBuilder buf = new StringBuilder();
			buf.append(address.toString());
			buf.append("(0x");
			buf.append(Long.toHexString(shiftedRef.getValue()));
			buf.append("<<");
			buf.append(Long.toString(shiftedRef.getShift()));
			buf.append(")");
			addrStr = buf.toString();
		}
		else {
			addrStr = address.toString();
		}

		if (showBlockName != ShowBlockName.NEVER) {
			Memory mem = program.getMemory();
			MemoryBlock toBlock = mem.getBlock(address);
			if (toBlock != null && showBlockName == ShowBlockName.NON_LOCAL && reference != null &&
				toBlock.equals(mem.getBlock(reference.getFromAddress()))) {
				toBlock = null;
			}
			if (toBlock != null) {
				addrStr = toBlock.getName() + "::" + addrStr;
			}
		}

		return addrStr;
	}
@return true if location corresponds to memory address
Ghidra/Features/Base/src/main/java/ghidra/util/table/field/AddressBasedLocation.java