private void findPair(Program program, AddressSet pairSet, Instruction start_inst,
			TaskMonitor monitor) {
		Address minPairAddr = start_inst.getMinAddress();

		BigInteger curvalue = program.getProgramContext().getValue(pairBitRegister,
			start_inst.getMinAddress(), false);
		boolean inPairBit = false;
		if (curvalue != null) {
			inPairBit = (curvalue.intValue() == 1);
		}
		if (inPairBit == true) {
			return;
		}

		// Search for a paired instruction
		Instruction curr_inst = start_inst;

		// for 5 instructions in
		//     fallthru, or jump flow
		alternateReg = null;

		int count = 0;
		while (count < 5) {
			// Follow through to get curr_inst we want to inspect
			Instruction next_instr = getNextInstruction(program, curr_inst);

			if (next_instr == null) {
				return;
			}
			curr_inst = next_instr;

			alternateReg = checkForMove(start_inst, curr_inst);

			if (checkPossiblePairInstruction(program, curr_inst.getMinAddress())) {
				Instruction pairInstr = getPairInstruction(start_inst, curr_inst);
				if (pairInstr != null) {
					// TODO: Need to adjust for delay slot for both
					//       set the bit on the whole instruction?, and back up for delay for both
					pairSet.add(getInstPairRange(start_inst));
					pairSet.add(getInstPairRange(pairInstr));
					break;
				}
			}
			count++;
		}
	}
Given one instruction, finds a corresponding paired instruction.
Ghidra/Processors/MIPS/src/main/java/ghidra/app/plugin/core/analysis/MipsPreAnalyzer.java