public PcodeOp getPcode(HashMap<Object, Handle> handles, Position position, int opSequenceNumber, int off) throws Exception {
		int opc = opcode;

		Varnode out = null;
		if (output != null)
			out = output.resolve(handles, position, off);
		Varnode in[] = new Varnode[numInputs];
		for (int i = 0; i < numInputs; i++)
			in[i] = input[i].resolve(handles, position, off);
		
		// optimization: convert STOREs and LOADs to COPYs if possible
		if (opcode == PcodeOp.STORE) {
			Varnode ptr = in[1];
			if (ptr.isConstant()) { // if pointer is constant replace store with copy
				Varnode space = in[0];
				Varnode src = in[2];
				Address addr = addressFactory.getAddress((int)space.getOffset(),ptr.getOffset());
				out = new Varnode(addr,src.getSize());
				in = new Varnode[1];
				in[0] = src;
				opc = PcodeOp.COPY;
			}
		}
		else if (opcode == PcodeOp.LOAD) {
			Varnode ptr = in[1];
			if (ptr.isConstant()) {
				Varnode space = in[0];
				Varnode dest = out;
				Address addr = addressFactory.getAddress((int) space.getOffset(),ptr.getOffset());
				in = new Varnode[1];
				in[0] = new Varnode(addr,dest.getSize());
				opc = PcodeOp.COPY;
			}
		}
		
		// just before emitting pcode, trim constant varnodes to proper size
		for (int i = 0; i < in.length; i++)
			in[i].trim();
			
		return new PcodeOp(position.startAddr(),opSequenceNumber,opc,in,out);
	}
Method getPcode.
@param handles
@return PcodeOp
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/plugin/processors/generic/OpTemplate.java