private void fixJumpTable(Program program, Instruction startInstr, TaskMonitor monitor) {
		int tableLen = -1;
		Address tableAddr = null;
		int valueSize = -1;
		Register target = null;

		// if already has more than one reference from it, assume it has been
		// done!
		Address addr = startInstr.getMinAddress();
		if (checkAlreadyRecovered(program, addr)) {
			return;
		}

		// search backward for:
		// sltiu instruction, that is the size of the table
		// addiu instruction, the reference there is the table
		Instruction curInstr = startInstr;
		while (tableLen == -1 || (target != null && tableAddr == null)) {
			Address fallAddr = curInstr.getFallFrom();
			Instruction prevInstr = null;
			if (fallAddr != null) {
				prevInstr = program.getListing().getInstructionContaining(fallAddr);
			}
			if (prevInstr == null) {
				ReferenceIterator iter = curInstr.getReferenceIteratorTo();
				if (iter.hasNext()) {
					Reference ref = iter.next();
					if (!ref.getReferenceType().isCall()) {
						prevInstr =
							program.getListing().getInstructionContaining(ref.getFromAddress());
					}
				}
			}
			if (!curInstr.isInDelaySlot() && prevInstr != null &&
				prevInstr.getPrototype().hasDelaySlots()) {
				prevInstr = prevInstr.getNext();
			}
			if (prevInstr == null) {
				return;
			}
			if (prevInstr.getMinAddress().compareTo(curInstr.getMinAddress()) >= 0) {
				return;
			}
			curInstr = prevInstr;

			// this is the size of the table
			if (tableLen == -1 && (curInstr.getMnemonicString().equals("sltiu") ||
				curInstr.getMnemonicString().equals("_sltiu"))) {
				Scalar scalar = curInstr.getScalar(2);
				if (scalar == null) {
					return;
				}
				tableLen = (int) scalar.getUnsignedValue();
				if (tableLen > 255 || tableLen < 2) {
					return;
				}
				continue;
			}
			// this is the table location
			// assumes the mips markup has already found the lui/addiu pair
			if (tableAddr == null && curInstr.getMnemonicString().equals("addiu")) {
				if (target == null || target.equals(curInstr.getRegister(0))) {
					Reference[] refs = curInstr.getReferencesFrom();
					if (refs == null || refs.length == 0) {
						return;
					}
					tableAddr = refs[0].getToAddress();
				}
			}

			if (tableLen == -1) {
				// this is the step of the table
				if (valueSize == -1 && (curInstr.getMnemonicString().equals("sll") ||
					curInstr.getMnemonicString().equals("_sll"))) {
					valueSize = 1 << (int) curInstr.getScalar(2).getUnsignedValue();
				}
				if (tableAddr == null) {
					if (valueSize == -1 && curInstr.getMnemonicString().equals("lw")) {
						valueSize = 4;
					}
					if (curInstr.getMnemonicString().equals("addu")) {
						target = curInstr.getRegister(2);
					}
				}
			}
		}

		if (tableAddr == null) {
			return;
		}

		if (tableLen <= 0) {
			return;
		}

		if (valueSize == -1) {
			valueSize = program.getDefaultPointerSize();
		}

		AddressTable table = AddressTable.getEntry(program, tableAddr, monitor, false, tableLen,
			valueSize, 0, AddressTable.MINIMUM_SAFE_ADDRESS, true);
		if (table == null) {
			table = AddressTable.getEntry(program, tableAddr, monitor, false, 3, valueSize, 0,
				AddressTable.MINIMUM_SAFE_ADDRESS, true);
			if (table != null) {
				Msg.error(this,
					"**** MIPS Analyzer: SHOULD be a table of size " + tableLen + " at " +
						tableAddr + " got " + table.getNumberAddressEntries() +
						" from instruction at " + startInstr.getMinAddress());
			}
			else {
				Msg.error(this, "**** MIPS Analyzer: SHOULD be a table of size " + tableLen +
					" at " + tableAddr + " from instruction at " + startInstr.getMinAddress());
				return;
			}
		}
		if (tableLen < table.getNumberAddressEntries()) {
			table.truncate(tableLen);
		}

		// We don't do indexes, even if it says it has one. So get rid of it.
		if (table.getIndexLength() != 0) {
			table = new AddressTable(table.getTopAddress(), table.getTableElements(), null, 0,
				valueSize, 0, false);
		}
		table.createSwitchTable(program, startInstr, 1, false, monitor);
	}
@param program
@param startInstr
@param monitor
Ghidra/Processors/MIPS/src/main/java/ghidra/app/plugin/core/analysis/MipsAddressAnalyzer.java