public void getPcodeInject(String nm, Decoder paramDecoder, int type, Encoder resultEncoder)
			throws DecoderException, UnknownInstructionException, IOException,
			MemoryAccessException, NotFoundException {
		PcodeInjectLibrary snippetLibrary = pcodecompilerspec.getPcodeInjectLibrary();

		InjectPayload payload = snippetLibrary.getPayload(type, nm);
		if (payload == null) {
			throw new NotFoundException("No p-code injection with name: " + nm);
		}
		InjectContext con = snippetLibrary.buildInjectContext();
		PcodeOp[] pcode;
		con.decode(paramDecoder);
		int fallThruOffset;
		if (payload.getType() == InjectPayload.EXECUTABLEPCODE_TYPE) {
			// Executable p-code has no underlying instruction address and
			// does (should) not use the inst_start, inst_next symbols that need
			// to know about it.
			fallThruOffset = 4;		// Provide a dummy length
		}
		else {
			Instruction instr = getInstruction(con.baseAddr);
			if (instr == null) {
				Msg.warn(this, "Decompiling " + funcEntry + ", pcode inject error at " +
					con.baseAddr + ": instruction not found");
				return;
			}

			// get next inst addr for inst_next pcode variable
			fallThruOffset = instr.getDefaultFallThroughOffset();
			con.nextAddr = con.baseAddr.add(fallThruOffset);

			con.refAddr = null;
			for (Reference ref : program.getReferenceManager().getReferencesFrom(con.baseAddr)) {
				if (ref.isPrimary() && ref.getReferenceType().isCall()) {
					con.refAddr = ref.getToAddress();
					break;
				}
			}
		}
		pcode = payload.getPcode(program, con);
		if (pcode == null) {
			return;		// Return without result, which should let the decompiler exit gracefully
		}
		encodeInstruction(resultEncoder, con.baseAddr, pcode, fallThruOffset,
			payload.getParamShift(), addrfactory);
		if (debug != null) {
			XmlEncode xmlEncode = new XmlEncode();
			encodeInstruction(xmlEncode, con.baseAddr, pcode, fallThruOffset,
				payload.getParamShift(), addrfactory);
			debug.addInject(con.baseAddr, nm, type, xmlEncode.toString());
		}
	}
Generate p-code ops for a named injection payload
@param nm is the name of the payload
@param paramDecoder contains the context
@param type is the type of payload
@param resultEncoder will contain the generated p-code ops
@throws DecoderException for problems decoding the injection context
@throws UnknownInstructionException if there is no instruction at the injection site
@throws IOException for errors encoding the injection result
@throws NotFoundException if an expected aspect of the injection is not present in context
@throws MemoryAccessException for problems establishing the injection context
Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileCallback.java