private int createDataType(Instruction instr, Address address) {
		Program program = instr.getProgram();
		if (!program.getListing().isUndefined(address, address)) {
			return 0;
		}

		String mnemonic = instr.getMnemonicString();

		int charOff = 0;
		if (mnemonic.startsWith("ldrex") || mnemonic.startsWith("strex")) {
			charOff = 5;
		}
		else if (mnemonic.startsWith("ldrs") || mnemonic.startsWith("strs")) {
			charOff = 4;
		}
		else if (mnemonic.startsWith("ldr") || mnemonic.startsWith("str")) {
			charOff = 3;
		}
		else if (mnemonic.startsWith("ld") || mnemonic.startsWith("st")) {
			charOff = 2;
		}
		else if (mnemonic.startsWith("tbh")) {
			charOff = 2;
		}
		else if (mnemonic.startsWith("tbb")) {
			charOff = 2;
		}
		else if (mnemonic.startsWith("vldr") || mnemonic.startsWith("vstr")) {
			charOff = mnemonic.length() - 2;
		}

		if (charOff <= 0) {
			return 0;
		}

		DataType dt = Undefined4DataType.dataType;
		if (mnemonic.length() > charOff) {
			char endCh = mnemonic.charAt(charOff);
			switch (endCh) {
				case '6':
					dt = Undefined8DataType.dataType;
					break;
				case '3':
					dt = Undefined4DataType.dataType;
					break;
				case 'l':
					dt = Undefined4DataType.dataType;
					break;
				case 'w':
				case 'h':
					dt = Undefined2DataType.dataType;
					break;
				case 'b':
					dt = Undefined1DataType.dataType;
					break;
			}
		}

		//new CreateDataCmd(address, dt).applyTo(program);
		Data data = null;
		try {
			data = program.getListing().createData(address, dt);
		}
		catch (CodeUnitInsertionException e) {
			data = program.getListing().getDefinedDataAt(address);
		}
		int addrByteSize = dt.getLength();
		//data = program.getListing().getDefinedDataAt(address);
		if (data != null) {
			Object dValue = data.getValue();
			// if the value at the location looks like a pointer, create a pointer
			if (dValue != null && dValue instanceof Scalar) {
				Scalar sValue = (Scalar) dValue;

				long value = sValue.getUnsignedValue();
				if (value < 4096 || value == 0xffff || value == 0xff00 || value == 0xffffff ||
					value == 0xff0000 || value == 0xff00ff || value == 0xffffffff ||
					value == 0xffffff00 || value == 0xffff0000 || value == 0xff000000) {
					return 0;
				}

				// If the access is a read, and the data is not far away, consider it constant
				long distance = address.getOffset() - instr.getAddress().getOffset();
				if (distance > 0 && distance < MAX_DISTANCE) {
					markDataAsConstant(data);
				}

//				Address sAddr = address.getNewAddress(sValue.getUnsignedValue());
//					if (program.getMemory().contains(sAddr)) {
//						program.getListing().clearCodeUnits(address, address);
//						new CreateDataCmd(address, DataTypeFactory.POINTER).applyTo(program);
//					}
			}
		}
		return addrByteSize;
	}
Check if there are any data references to this location.
@param program
@param addr
@return true if there are any data references to addr
Ghidra/Processors/ARM/src/main/java/ghidra/app/plugin/core/analysis/ArmAnalyzer.java