private String translateVarnode(Varnode node, boolean useVarName) {
		if (node == null) {
			return "null";
		}
		Program p = hfunction.getFunction().getProgram();
		Address addr = node.getAddress();
		if (node.isConstant()) {
			return "#" + NumericUtilities.toHexString(addr.getOffset(), node.getSize());
		}
		else if (node.isUnique()) {
			return "u_" + Long.toHexString(addr.getOffset());
		}
		else if (addr.isRegisterAddress()) {
			Register r = p.getRegister(addr, node.getSize());
			if (r == null) {
				r = p.getRegister(addr);
			}
			if (r != null) {
				return r.getName();
			}
		}
		else if (addr.isStackAddress()) {
			if (useVarName) {
				HighVariable var = node.getHigh();
				if (var != null) {
					return var.getName();
				}
			}
			return "Stack[" + NumericUtilities.toSignedHexString(addr.getOffset()) + "]";
		}
		else if (addr.isMemoryAddress()) {
			return addr.toString(true);
		}
		return node.toString();
	}
Task to create a PCode control flow graph based on decompiler output
Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/PCodeCfgGraphTask.java