private Variable createRegisterParameter(String name, DataType dt, MessageLog log) {
		Register ecx = function.getProgram().getLanguage().getRegister("ECX");
		try {
			Parameter[] parameters =
				function.getParameters(VariableFilter.REGISTER_VARIABLE_FILTER);
			for (Parameter parameter : parameters) {
				if (parameter.getRegister().equals(ecx)) {
					parameter.setDataType(dt, false, true, SourceType.ANALYSIS);
					try {
						parameter.setName(name, SourceType.IMPORTED);
					}
					catch (DuplicateNameException e) {
					}
					return parameter;
				}
			}

			Variable variable = new LocalVariableImpl(name, 0, dt, ecx, function.getProgram());
			try {
				return function.addParameter(variable, SourceType.IMPORTED);
			}
			catch (DuplicateNameException e) {
				variable.setName(variable + "_" + ecx.getName(), SourceType.IMPORTED);
				return function.addParameter(variable, SourceType.IMPORTED);
			}
		}
		catch (Exception e) {
			log.appendMsg("PDB",
				"Unable to create register variable " + name + " in " + function.getName());
		}
		return null;
	}
Get the stack offset after it settles down.

@param monitor
@return stack offset that stack variables will be relative to.
@throws CancelledException
Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/ApplyStackVariables.java