private static boolean containsRegister(Program program, HashSet<Varnode> setRegisters,
			Varnode regVarnode) {
		if (setRegisters.contains(regVarnode)) {
			return true;
		}
		// check the parent varnode
		Register register = program.getRegister(regVarnode);
		if (register == null) {
			return false;
		}
		Register parentRegister = register.getParentRegister();
		if (parentRegister == null) {
			return false;
		}
		Varnode parentVarnode =
			new Varnode(parentRegister.getAddress(), parentRegister.getBitLength() / 8);
		return setRegisters.contains(parentVarnode);
	}
Check if the setRegisters contains the varnode or any of its parents.
If a parent register has been set, then this varnode is set
Ghidra/Features/Base/src/main/java/ghidra/app/cmd/function/CreateThunkFunctionCmd.java