private void applyFunctionAffects(SequenceNumber calledFrom, Address destAddr, Function func,
			ContextState currentState, TaskMonitor monitor) {

		PrototypeModel callingConvention = null;
		if (func != null) {
			callingConvention = func.getCallingConvention();
		}
		if (callingConvention == null) {
			callingConvention = program.getCompilerSpec().getDefaultCallingConvention();
		}

		// TODO: Apply other affects other than return ??

		// TODO: We really do not know what has been affected - how do we manage constant/expression propagation after a call ??

		// Must invalidate return varnode
		DataType returnType = null;
		if (func == null) {
			if (DEBUG) {
				Msg.debug(this,
					"No function at " + destAddr + " called from " + calledFrom.getTarget() +
						" - default return/affects assumed");
			}
		}
		else {
			returnType = func.getReturnType();
			if (VoidDataType.isVoidDataType(returnType)) {
				return;
			}
		}

		VariableStorage retStorage = callingConvention.getReturnLocation(returnType, program);
		Varnode varnode = null;
		if (retStorage.isValid() && (retStorage.getVarnodeCount()==1)) {
			varnode = retStorage.getFirstVarnode();
		}
		if (varnode != null) {
			// invalidate stored value
			currentState.store(varnode, getInvalidatedVarnode(calledFrom, varnode));
		}
	}
Returns list of registers which are read before written.
Ghidra/Features/Base/src/main/java/ghidra/util/state/ResultsState.java