On 10/8/2026 2:56 AM, Yonggang Luo wrote: >>> How about letting machines (and machines only first), have a new field >>> 'targets', being a uint32_t mask with an array of EMU_TARGET? >>> machine->targets = EMU_TARGET_X | EMU_TARGET_Y; > > To be explicit state what, I give you a pseudo code to compute > machine->targets from TypeInfo::is_available(TargetInfo*) > let targets=0 > foreach ti of TargetInfo list: > if (machine::TypeImpl::is_avaible(ti)) > targets |= 1 << ti->target_arch > fi > endif > So they basically have equivalent effect, and is_available will handle > other code-needed condition properly such as > CPU/AccelClass. not restrict to targets, we can also attach the > KConfig into TargetInfo, so is_available(TargetInfo*) > also works for Kconfig. that's why I insist this way, it's solved all > the issues around. > > so machine->targets = EMU_TARGET_X | EMU_TARGET_Y; is a good idea, > and it can be implemented with TypeInfo::is_available(TargetInfo*) > without much burden. and targets can be saved into a (machine or > TypeImpl) for fast access when needed, we can compute it > when the program starts. >
In what we described, there is no need to keep any kind of callback, targets field is sufficient to filter any type declaratively. For the KConfig related types, I would really be keen to leave that available for now, and add a proper error message later. Regards, Pierrick
