public static AddressSetView expandAddressSetToIncludeFullDelaySlots(Program program,
			AddressSetView originalSet) {
		Listing listing = program.getListing();
		AddressSet expandedSet = null;
		for (AddressRange originRange : originalSet.getAddressRanges()) {

			Instruction instr = listing.getInstructionAt(originRange.getMinAddress());
			if (instr != null && instr.isInDelaySlot()) {
				// expand range up
				Address newMinAddr = getStartOfDelaySlots(instr);
				if (!newMinAddr.equals(originRange.getMinAddress())) {
					if (expandedSet == null) {
						expandedSet = new AddressSet(originalSet);
					}
					expandedSet.addRange(newMinAddr, instr.getMaxAddress());
				}
			}

			instr = listing.getInstructionContaining(originRange.getMaxAddress());
			if (instr != null && (instr.isInDelaySlot() || instr.getDelaySlotDepth() != 0)) {
				// expand range down
				Address newMaxAddr = getEndOfDelaySlots(instr);
				if (!newMaxAddr.equals(originRange.getMaxAddress())) {
					if (expandedSet == null) {
						expandedSet = new AddressSet(originalSet);
					}
					expandedSet.addRange(instr.getMinAddress(), newMaxAddr);
				}
			}
		}
		return expandedSet != null ? expandedSet : originalSet;
	}
Expand a specified address set to include complete delay slotted instructions
which may be included at the start or end of each range within the specified
address set.
@param program program
@param originalSet original address set
@return expanded address set
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/SimpleDiffUtility.java