private void loadSelectedInstructions(Program program, ProgramSelection selection) {

		// First get the program listing.
		Listing listing = program.getListing();

		// Now check to make sure the user hasn't selected multiple regions; if they have,
		// LET THEM KNOW.  This situation is not allowed so pop up a dialog and cancel the whole show.
		if (selection.getNumAddressRanges() > 1) {
			Msg.showWarn(this, null, "Multiple Regions Selected",
				"Selected instructions must be contiguous");
		}

		// If we're here, we have only 1 selection range, so proceed.  Use an instruction
		// iterator to loop over all addresses, processing each in turn.
		AddressRange addrRange = selection.getFirstRange();
		AddressSet addrSet = new AddressSet(addrRange);
		InstructionIterator iter = listing.getInstructions(addrSet, true);
		while (iter.hasNext()) {

			// Grab the next instruction...
			Instruction instr = iter.next();
			Address addr = instr.getAddress();

			// Extract some info from the address.  If there's a problem, don't exit the entire loop, 
			// just move on to the next item.
			SleighDebugLogger logger =
				new SleighDebugLogger(program, addr, SleighDebugMode.VERBOSE);
			if (logger.parseFailed()) {
				break;
			}

			// Get the bytes and mask info related to this instruction.
			byte[] mask = logger.getInstructionMask();
			byte[] value = logger.getMaskedBytes(mask);

			MaskValue mnemonicMask = new MnemonicMaskValue(mask, value, instr.getMnemonicString());
			mnemonics.add(mnemonicMask);

			//Gets a code unit which can be used to determine if the operands are constants.
			CodeUnit cu = listing.getCodeUnitAt(addr);
			storeOperands(instr, logger, mnemonicMask, cu);
		}
	}
Loads whatever instructions have been selected and stores the mnemonics,
operands, and mask values for subsequent use.

@param program
@param selection
Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/mnemonic/MaskGenerator.java