
    X-Ph                        d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZmZmZmZmZmZmZmZmZ ddZddZdS )z5Insert spills for values that are live across yields.    )annotations)AnalysisResultanalyze_live_regsget_cfg)TEMP_ATTR_NAME)ClassIR)FuncIR)	
BasicBlockBranchDecRefGetAttrIncRefLoadErrorValueRegisterSetAttrValueirr	   envr   returnNonec                    t          | j        d          }t          | j        |          }|j        | j        d         df         }d |D             }d |D             }t	          | j        |||          | _        d S )NT)
use_yieldsr   c                J    h | ] }t          |t                    r|j        |!S  )
isinstancer   is_arg.0ops     U/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mypyc/transform/spill.py	<setcomp>z insert_spills.<locals>.<setcomp>   s.    ZZZ*R2J2JZryZ"ZZZ    c                <    h | ]}t          |t                    |S r   )r   r   r   s     r    r!   z insert_spills.<locals>.<setcomp>   s'    JJJB1I1IJ"JJJr"   )r   blocksr   before
spill_regs)r   r   cfglive
entry_lives        r    insert_spillsr*      s~    
")
-
-
-CRY,,DRYq\1_-JZZzZZZJJJzJJJJ29c:t<<BIIIr"   r$   list[BasicBlock]to_spill
set[Value]r(   AnalysisResult[Value]c                x   | d         j         D ]&}t          |t                    r|j        dk    r|} n't	          d          i t          |          D ]K\  }}t           d| }|j        |j        |<   |j        j	        r|j
                            |           ||<   L| D ]}	|	j         }
g |	_         t          |
          D ]r\  }}g }t          |t                    r|j        v rt	          d          t          |t                    r|j        v r}|j        |j        |	|f         vrf||j        |	|f         v rUt!          |j        j                  }|	j                             |t%          ||j                 ||j                  g           t)          fd|                                D                       rt          |t,                    r|j        t,          j        k    sg }|                                }|                                D ]}|v rqt          ||         |j                  }|	j                             |           |                    |           |j        j        r||vr|                    |           w|                    |           |                    |           |	j                             |           |D ])}|	j                             t          |                     *|v r5|	j                             t%          ||         ||j                             t| S )Nr   __mypyc_env__zcould not find __mypyc_env__2_z0not sure what to do with an incref of a spill...c              3      K   | ]}|v V  	d S )Nr   )r   src
spill_locss     r    	<genexpr>zspill_regs.<locals>.<genexpr>O   s(      >>#C:%>>>>>>r"   )opsr   r   attrAssertionError	enumerater   type
attributeserror_overlap_always_initialized_attrsaddr   r3   r   afterr   extendr   lineanysourcesr   r   IS_ERRORstolenappendis_refcountedset_sources)r$   r   r,   r(   r   env_regivalnameblockr6   	to_decrefnullnew_sourcesrE   r3   readdecr4   s                     @r    r&   r&   "   sq    Qim = =b'"" 	rw/'A'AGE;<<<JH%%  3 ''A''"xt8! 	4 )--d333
3 3P 3Pi	s^^ /	P /	PEArI"f%% Y"&J*>*>$%WXXX"f%% "&J*>*> 6E1H!555'TZPUWXPXEY:Y:Y)"&+66DI$$dGGZ=OQUWYW^,_,_%`aaa >>>>>>>>>, $B//	, 57EV_4L4L+-::<< 0 0Cj((&w
3II	((...#**400081 3c6G6G%,,T222#**3////{+++IR     . .	  ----Z	  *R."bg!N!NOOO_/	Pb Mr"   N)r   r	   r   r   r   r   )
r$   r+   r   r   r,   r-   r(   r.   r   r+   )__doc__
__future__r   mypyc.analysis.dataflowr   r   r   mypyc.commonr   mypyc.ir.class_irr   mypyc.ir.func_irr	   mypyc.ir.opsr
   r   r   r   r   r   r   r   r   r*   r&   r   r"   r    <module>rZ      s   ; ; " " " " " " N N N N N N N N N N ' ' ' ' ' ' % % % % % % # # # # # #
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
	= 	= 	= 	=I I I I I Ir"   