private static PointerReferenceClassification getPointerClassification(Program program,
			Reference ref) {

		Address fromAddr = ref.getFromAddress();

		Set<Address> refAddrs = new HashSet<>();
		refAddrs.add(fromAddr);
		if (fromAddr.equals(ref.getToAddress())) {
			return PointerReferenceClassification.LOOP;
		}
		int depth = 1;
		while (ref != null && ref.isMemoryReference()) {
			Address toAddr = ref.getToAddress();
			if (!refAddrs.add(toAddr)) {
				break;
			}
			if (++depth > 2) {
				return PointerReferenceClassification.DEEP;
			}
			Data data = getDataAt(program, toAddr);
			if (data == null) {
				break;
			}
			ref = data.getPrimaryReference(0);
		}
		return PointerReferenceClassification.NORMAL;
	}
Construct a pointer of a specified length to a referencedDataType. Note: It
is preferred to use default sized pointers when possible (i.e., length=-1,
see {@link #PointerDataType(DataType, DataTypeManager)}) instead of
explicitly specifying the pointer length value.

@param referencedDataType data type this pointer points to
@param length             pointer length (-1 will result in dynamically-sized
                          pointer)
@param dtm                associated data type manager whose data
                          organization will be used
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/PointerDataType.java