
    k=1e	                         d Z ddlmZmZ i Z G d d          Zd Z ee          Zd Zed             Z	ed             Z
ed	             Zd
S )z'Aliases for microarchitecture features.   )TARGETS_JSONLazyDictionaryc                       e Zd ZdZd Zd ZdS )FeatureAliasTestzA test that must be passed for a feature alias to succeed.

    Args:
        rules (dict): dictionary of rules to be met. Each key must be a
            valid alias predicate
    c                     || _         g | _        |                                D ]2\  }}| j                            t	          |         |                     3d S N)rules
predicatesitemsappend_FEATURE_ALIAS_PREDICATE)selfr	   nameargss       2lib/python3.11/site-packages/archspec/cpu/alias.py__init__zFeatureAliasTest.__init__   s`    
++-- 	I 	IJD$O""#;D#A$#G#GHHHH	I 	I    c                 D    t          fd| j        D                       S )Nc              3   .   K   | ]} |          V  d S r    ).0feature_testmicroarchitectures     r   	<genexpr>z,FeatureAliasTest.__call__.<locals>.<genexpr>   s.      WW|<< 122WWWWWWr   )allr
   )r   r   s    `r   __call__zFeatureAliasTest.__call__   s(    WWWWtWWWWWWr   N)__name__
__module____qualname____doc__r   r   r   r   r   r   r      sD         I I IX X X X Xr   r   c                  |    t           d         } i }|                                 D ]\  }}t          |          ||<   |S )z6Returns the dictionary of all defined feature aliases.feature_aliases)r   r   r   )	json_dataaliasesaliasr	   s       r   _feature_aliasesr&      sG    ./IG!)) 1 1u)%00Nr   c                 d    | j         }|t          v rd| d}t          |          | t          |<   | S )zXDecorator to register a predicate that can be used to evaluate
    feature aliases.
    zthe alias predicate "z" already exists)r   r   KeyError)funcr   msgs      r   alias_predicater+   *   sE     =D '''<d<<<smm%)T"Kr   c                     d S )zThis predicate returns always True and it's there to allow writing
    a documentation string in the JSON file to explain why an alias is needed.
    c                     dS )NTr   )xs    r   <lambda>zreason.<locals>.<lambda>?   s    T r   r   )_s    r   reasonr1   :   s    
 >r   c                       fd}|S )zReturns a predicate that is True if any of the feature in the
    list is in the microarchitecture being tested, False otherwise.
    c                 <     t           fdD                       S )Nc              3       K   | ]}|v V  	d S r   r   )r   r.   r   s     r   r   z(any_of.<locals>._impl.<locals>.<genexpr>I   s)      DDa1))DDDDDDr   )any)r   list_of_featuress   `r   _implzany_of.<locals>._implH   s(    DDDD3CDDDDDDr   r   )r6   r7   s   ` r   any_ofr8   B   s(    E E E E E Lr   c                       fd}|S )zReturns a predicate that is True if the architecture family of
    the microarchitecture being tested is in the list, False otherwise.
    c                 0    t          | j                  v S r   )strfamily)r   list_of_familiess    r   r7   zfamilies.<locals>._implT   s    $+,,0@@@r   r   )r=   r7   s   ` r   familiesr>   N   s(    A A A A A Lr   N)r    schemar   r   r   r   r&   FEATURE_ALIASESr+   r1   r8   r>   r   r   r   <module>rA      s   
 . - 0 0 0 0 0 0 0 0 X X X X X X X X&   !.!122              r   