pub trait FlagGroup: Sized + Clone + Copy {
    type FlagType: Flag;
    type FlagClass: FlagClass;

    // Required methods
    fn name(&self) -> Cow<'_, str>;
    fn id(&self) -> u32;
    fn flags_required(&self) -> Vec<Self::FlagType>;
    fn flag_conditions(&self) -> HashMap<Self::FlagClass, FlagCondition>;
}

Required Associated Types§

Required Methods§

source

fn name(&self) -> Cow<'_, str>

source

fn id(&self) -> u32

Unique identifier for this FlagGroup.

MUST be in the range [0, 0x7fff_ffff]

source

fn flags_required(&self) -> Vec<Self::FlagType>

Returns the list of flags that need to be resolved in order to take the clean flag resolution path – at time of writing, all required flags must have been set by the same instruction, and the ‘querying’ instruction must be reachable from one instruction that sets all of these flags.

source

fn flag_conditions(&self) -> HashMap<Self::FlagClass, FlagCondition>

Returns the mapping of Semantic Flag Classes to Flag Conditions, in the context of this Flag Group.

Example:

If we have a group representing cr1_lt (as in PowerPC), we would have multiple Semantic Flag Classes used by the different Flag Write Types to represent the different comparisons, so for cr1_lt we would return a mapping along the lines of:

cr1_signed -> LLFC_SLT,
cr1_unsigned -> LLFC_ULT,

This allows the core to recover the semantics of the comparison and inline it into conditional branches when appropriate.

Object Safety§

This trait is not object safe.

Implementors§