
    "
3jz                     8   S SK r S SKrS SKrS SKJr  S SKJr  S SKJr  \S;   a  \	" / SQ5      r
O\S;   a  \	" / SQ5      r
O\" \5      e " S	 S
\5      r " S S\ R                  " SS5      5      r " S S\ R                   5      r " S S\5      r " S S\5      rg)    N)Loc)UnsupportedError)	PYVERSION)      )
SETUP_LOOPFOR_ITER
SETUP_WITHBEFORE_WITHLOAD_SPECIAL)r   
   r      r      r      )r	   r
   r   r   c                   &    \ rS rSrS rS rS rSrg)CFBlock   c                 H    Xl         / U l        0 U l        0 U l        SU l        g )NF)offsetbodyoutgoing_jumpsincoming_jumpsterminating)selfr   s     P/home/wildlama/miniconda3/lib/python3.13/site-packages/numba/core/controlflow.py__init__CFBlock.__init__   s*    	 ! !     c                 v    U R                   [        U R                  5      [        U R                  5      4nSU-  $ )Nz,block(offset:%d, outgoing: %s, incoming: %s))r   sortedr   r   )r   argss     r    __repr__CFBlock.__repr__$   s9    t**+t**+- >DDr#   c                 ,    [        U R                  5      $ N)iterr   r   s    r    __iter__CFBlock.__iter__*   s    DIIr#   )r   r   r   r   r   N)__name__
__module____qualname____firstlineno__r!   r'   r-   __static_attributes__ r#   r    r   r      s    	!Er#   r   c                   (    \ rS rSrSrSrS rS rSrg)Loop.   z7
A control flow loop, as detected by a CFGraph object.
r4   c                 b    [        U[        5      =(       a    UR                  U R                  :H  $ r*   )
isinstancer6   headerr   others     r    __eq__Loop.__eq__;   s!    %&F5<<4;;+FFr#   c                 ,    [        U R                  5      $ r*   )hashr:   r,   s    r    __hash__Loop.__hash__>   s    DKK  r#   N)	r/   r0   r1   r2   __doc__	__slots__r=   rA   r3   r4   r#   r    r6   r6   .   s     IG!r#   r6   )entriesexitsr:   r   c                   *    \ rS rSrSrS rS rS rSrg)_DictOfContainersB   zA defaultdict with customized equality checks that ignore empty values.

Non-empty value is checked by: `bool(value_item) == True`.
c                     [        U[        5      (       a$  U R                  5       nUR                  5       nX#:H  $ [        $ r*   )r9   rH   _non_empty_itemsNotImplemented)r   r<   minetheirss       r    r=   _DictOfContainers.__eq__H   s:    e.//((*D++-F>!r#   c                 H    U R                  U5      nU[        L a  U$ U(       + $ r*   )r=   rL   )r   r<   rets      r    __ne___DictOfContainers.__ne__P   s$    kk% . J7Nr#   c                 ~    [        U R                  5       5       VVs/ s H  u  pU(       d  M  X4PM     snn$ s  snnf r*   )r%   items)r   kvss      r    rK   "_DictOfContainers._non_empty_itemsW   s/    %+DJJL%9@%9EAR%9@@@s   99r4   N)	r/   r0   r1   r2   rC   r=   rR   rK   r3   r4   r#   r    rH   rH   B   s    
Ar#   rH   c                      \ rS rSrSrS rS rS<S jrS rS r	S	 r
S
 rS rS rS rS rS r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       r\R$                  S 5       rS rS rS r S r!S r"S  r#S! r$S" r%S# r&S=S$ jr'S<S% jr(S>S& jr)S<S' jr*S( r+S<S) jr,S* r-S+ r.S, r/S- r0S. r1S/ r2S=S0 jr3S1 r4S2 r5S<S3 jr6S4 r7S5 r8S6 r9S7 r:S8 r;S9 r<S: r=S;r>g)?CFGraph[   z:
Generic (almost) implementation of a Control Flow Graph.
c                     [        5       U l        [        [         5      U l        [        [         5      U l        0 U l        S U l        g r*   )set_nodesrH   _preds_succs
_edge_data_entry_pointr,   s    r    r!   CFGraph.__init__`   s2    e',', r#   c                 :    U R                   R                  U5        g)z{
Add *node* to the graph.  This is necessary before adding any
edges from/to the node.  *node* can be any hashable object.
N)r^   addr   nodes     r    add_nodeCFGraph.add_nodeg   s    
 	r#   Nc                     XR                   ;  a  [        SU< SU R                   < 35      eX R                   ;  a  [        SU< SU R                   < 35      eU R                  XU5        g)z
Add an edge from node *src* to node *dest*, with optional
per-edge *data*.
If such an edge already exists, it is replaced (duplicate edges
are not possible).
zCannot add edge as src node z not in nodes zCannot add edge as dest node N)r^   
ValueError	_add_edge)r   srcdestdatas       r    add_edgeCFGraph.add_edgen   s\     kk!!4;;0 1 1{{""DKK1 2 2s$'r#   c              #   ^   #    U R                   U    H  nX R                  X4   4v   M     g7f)z
Yield (node, data) pairs representing the successors of node *src*.
(*data* will be None if no data was specified when adding the edge)
N)r`   ra   )r   rm   rn   s      r    
successorsCFGraph.successors}   s.     
 KK$D	222 %   +-c              #   ^   #    U R                   U    H  nX R                  X!4   4v   M     g7f)z
Yield (node, data) pairs representing the predecessors of node *dest*.
(*data* will be None if no data was specified when adding the edge)
N)r_   ra   )r   rn   rm   s      r    predecessorsCFGraph.predecessors   s.     
 ;;t$Csy111 %ru   c                 2    XR                   ;   d   eXl        g)z-
Set the entry point of the graph to *node*.
N)r^   rb   rf   s     r    set_entry_pointCFGraph.set_entry_point   s     {{""" r#   c                 T    U R                   c  [        S5      eU R                  5         g)z
Compute essential properties of the control flow graph.  The graph
must have been fully populated, and its entry point specified. Other
graph properties are computed on-demand.
Nzno entry point defined!)rb   RuntimeError_eliminate_dead_blocksr,   s    r    processCFGraph.process   s(     $899##%r#   c                     U R                   $ )z
Return a dictionary of {node -> set(nodes)} mapping each node to
the nodes dominating it.

A node D dominates a node N when any path leading to N must go through D
)_domsr,   s    r    
dominatorsCFGraph.dominators        zzr#   c                     U R                   $ )z
Return a dictionary of {node -> set(nodes)} mapping each node to
the nodes post-dominating it.

A node P post-dominates a node N when any path starting from N must go
through P.
)
_post_domsr,   s    r    post_dominatorsCFGraph.post_dominators   s     r#   c                     U R                   $ )z
Return a dictionary of {node -> node} mapping each node to its
immediate dominator (idom).

The idom(B) is the closest strict dominator of V
)_idomr,   s    r    immediate_dominatorsCFGraph.immediate_dominators   r   r#   c                     U R                   $ )z
Return a dictionary of {node -> set(nodes)} mapping each node to
the nodes in its dominance frontier.

The dominance frontier _df(N) is the set of all nodes that are
immediate successors to blocks dominated by N but which aren't
strictly dominated by N
)_dfr,   s    r    dominance_frontierCFGraph.dominance_frontier   s     xxr#   c                     U R                   $ )z
return a dictionary of {node -> set(nodes)} mapping each node to
the set of nodes it immediately dominates

The domtree(B) is the closest strict set of nodes that B dominates
)_domtreer,   s    r    dominator_treeCFGraph.dominator_tree   s     }}r#   c                 "    U R                  5       $ r*   )_find_exit_pointsr,   s    r    _exit_pointsCFGraph._exit_points       %%''r#   c                 "    U R                  5       $ r*   )_find_dominatorsr,   s    r    r   CFGraph._doms       $$&&r#   c                 "    U R                  5       $ r*   )_find_back_edgesr,   s    r    _back_edgesCFGraph._back_edges   r   r#   c                 "    U R                  5       $ r*   )_find_topo_orderr,   s    r    _topo_orderCFGraph._topo_order   r   r#   c                 "    U R                  5       $ r*   )_find_descendentsr,   s    r    _descsCFGraph._descs   r   r#   c                 "    U R                  5       $ r*   )_find_loopsr,   s    r    _loopsCFGraph._loops   s    !!r#   c                 "    U R                  5       $ r*   )_find_in_loopsr,   s    r    	_in_loopsCFGraph._in_loops   s    ""$$r#   c                 "    U R                  5       $ r*   )_find_post_dominatorsr,   s    r    r   CFGraph._post_doms   s    ))++r#   c                 "    U R                  5       $ r*   )_find_immediate_dominatorsr,   s    r    r   CFGraph._idom   s    ..00r#   c                 "    U R                  5       $ r*   )_find_dominance_frontierr,   s    r    r   CFGraph._df   s    ,,..r#   c                 "    U R                  5       $ r*   )_find_dominator_treer,   s    r    r   CFGraph._domtree   s    ((**r#   c                      U R                   U   $ )z`
Return the set of descendents of the given *node*, in topological
order (ignoring back edges).
)r   rf   s     r    descendentsCFGraph.descendents   s    
 {{4  r#   c                 8    U R                   c   eU R                   $ )z
Return the entry point node.
)rb   r,   s    r    entry_pointCFGraph.entry_point  s"       ,,,   r#   c                     U R                   $ )z7
Return the computed set of exit nodes (may be empty).
)r   r,   s    r    exit_pointsCFGraph.exit_points  s        r#   c                 4    U R                   U R                     $ )z
Return the set of nodes constituting the graph's backbone.
(i.e. the nodes that every path starting from the entry point
 must go through).  By construction, it is non-empty: it contains
 at least the entry point.
)r   rb   r,   s    r    backboneCFGraph.backbone  s     t0011r#   c                     U R                   $ )zp
Return a dictionary of {node -> loop} mapping each loop header
to the loop (a Loop instance) starting with it.
)r   r,   s    r    loopsCFGraph.loops  s    
 {{r#   c                 ~    U R                   R                  US5       Vs/ s H  o R                  U   PM     sn$ s  snf )zU
Return the list of Loop objects the *node* belongs to,
from innermost to outermost.
r4   )r   getr   )r   rg   xs      r    in_loopsCFGraph.in_loops  s5    
 )-(:(:4(DE(D1A(DEEEs   :c                     U R                   $ )z;
Return the set of dead nodes (eliminated from the graph).
)_dead_nodesr,   s    r    
dead_nodesCFGraph.dead_nodes%  s     r#   c                     U R                   $ )z
Return the set of live nodes.
)r^   r,   s    r    nodesCFGraph.nodes+  s     {{r#   c                     U R                   $ )zJ
Return the sequence of nodes in topological order (ignoring back
edges).
)r   r,   s    r    
topo_orderCFGraph.topo_order1  s    
 r#   c              #      #    [        U5      nU R                  nU(       a  [        U5      nU H  nXA;   d  M
  Uv   M     g7f)zn
Iterate over the *nodes* in topological order (ignoring back edges).
The sort isn't guaranteed to be stable.
N)r]   r   reversed)r   r   reverseitns        r    	topo_sortCFGraph.topo_sort8  s;     
 E
"BAz s
   2A	Ac                 "   SSK nU=(       d    [        R                  n [        SUS9  U R	                  U5        [        SUS9  UR                  U R
                  US9  [        SUS9  UR                  U R                  US9  [        S[        U R                  5      US9  [        S	US9  UR                  U R                  US9  [        S
US9  UR                  U R                  US9  [        SUS9  UR                  U R                  5       US9  g)z#
Dump extensive debug information.
r   NzCFG adjacency lists:filezCFG dominators:streamzCFG post-dominators:zCFG back edges:z
CFG loops:zCFG node-to-loops:zCFG backbone:)pprintsysstdoutprint_dump_adj_listsr   r   r%   r   r   r   r   )r   r   r   s      r    dumpCFGraph.dumpE  s     	!szz(t4  &d+djj.$40dood3(8(8!9El&dkk$/".dnnT2oD)dmmod3r#   c                 T    SSK nUR                  US9nU R                   H  nUR	                  [        U5      5        M     U R                   H=  nU R                  U    H'  nUR                  [        U5      [        U5      5        M)     M?     U$ ! [         a    [        S5      ef = f)zRender the controlflow graph with GraphViz DOT via the
``graphviz`` python binding.

Returns
-------
g : graphviz.Digraph
    Use `g.view()` to open the graph in the default PDF application.
r   NzcThe feature requires `graphviz` but it is not available. Please install with `pip install graphviz`)filename)graphvizImportErrorDigraphr^   rg   strr`   edge)r   r   gvgr   r   s         r    
render_dotCFGraph.render_dotZ  s    	! JJJ)AFF3q6N  AAs1vs4y) '    	= 	s   B B'c                     U R                   U   R                  U5        U R                  U   R                  U5        X0R                  X4'   g r*   )r_   re   r`   ra   )r   from_toro   s       r    rl   CFGraph._add_edgew  s?     	BE"Er"%)	"r#   c                 @   U R                   R                  US5       H/  nU R                  U   R                  U5        U R                  X4	 M1     U R                  R                  US5       H/  nU R                   U   R                  U5        U R                  X14	 M1     g )Nr4   )r`   popr_   removera   )r   rg   succpreds       r    _remove_node_edgesCFGraph._remove_node_edges~  s    KKOOD"-DKK$$T*
+ . KKOOD"-DKK$$T*
+ .r#   c              #     #    Uc  U R                   4n[        5       n[        U5      nU(       a[  UR                  5       nXB;  a<  Uv   UR	                  U5        U R
                  U    H  nUR                  U5        M     U(       a  MZ  g g 7fr*   )rb   r]   listr   re   r`   append)r   rE   seenstackrg   r  s         r    _dfsCFGraph._dfs  sr     ?((*GuW99;D
 KK-DLL& . es   BB	Bc                     [        5       nU R                  5        H  nUR                  U5        M     U R                  U-
  U l        Xl        U R                   H  nU R                  U5        M     g)z`
Eliminate all blocks not reachable from the entry point, and
stash them into self._dead_nodes.
N)r]   r  re   r^   r   r  )r   liverg   deads       r    r~   CFGraph._eliminate_dead_blocks  sZ    
 uIIKDHHTN  ;;-$$D##D) %r#   c                     [        5       nU R                   H6  nU R                  R                  U5      (       a  M%  UR	                  U5        M8     U$ )z"
Compute the graph's exit points.
)r]   r^   r`   r   re   )r   r   r   s      r    r   CFGraph._find_exit_points  s@     eA;;??1%%"  r#   c                    ^^^^^^ U R                   mU R                  m/ m[        5       m/ mUUUUUU4S jmTU R                  4/mT(       a#  TR	                  5       u  pU" U5        T(       a  M#  T$ )Nc                    > U T;  aW  TR                  U 5        TR                  TR                  U 45        TU     H  nX4T;  d  M  TR                  TU45        M!     g g r*   re   r  )rg   rn   
back_edgesdfs_rec
post_orderr	  r
  succss     r    r  (CFGraph._find_postorder.<locals>.dfs_rec  sZ    4j//67!$KD|:5gt_5 (  r#   )r`   r   r]   rb   r   )	r   cbro   r  r  r  r	  r
  r  s	      @@@@@@r    _find_postorderCFGraph._find_postorder  sm    %%

u
	6 	6 4,,-.yy{HBtH e r#   c                   ^
^ U
U4S jnU R                   nU R                  nU R                  5       n[        U5       VVs0 s H  u  pVXe_M	     snnmX"0m
UR	                  5         UR                  5         SnU(       aO  SnU H>  n[        R                  " UU
4S jX8    5       5      n	UT
;  d  T
U   U	:w  d  M7  U	T
U'   SnM@     U(       a  MO  T
$ s  snnf )Nc                    > X:w  aE  TU    TU   :  a  TU    n TU    TU   :  a  M  TU    TU   :  a  TU   nTU    TU   :  a  M  X:w  a  ME  U $ r*   r4   )uvidomidxs     r    	intersect5CFGraph._find_immediate_dominators.<locals>.intersect  sh    &!fs1voQA !fs1vo!fs1voQA !fs1vo &
 Hr#   TFc              3   8   >#    U  H  nUT;   d  M  Uv   M     g 7fr*   r4   ).0r!  r"  s     r    	<genexpr>5CFGraph._find_immediate_dominators.<locals>.<genexpr>  s      -;101T	 ./Qs   
	)rb   r_   r  	enumerater   r   	functoolsreduce)r   r$  entrypreds_tableorderiechangedr   new_idomr"  r#  s             @@r    r   "CFGraph._find_immediate_dominators  s    	 !!kk$$& )% 01 0qt 01		G$++I-; -;< D=DGx$7&DG"G  g ! 2s    Cc                     U R                   n[        [        5      nUR                  5        H0  u  p4X2;  a  [        5       X#'   X4:w  d  M  X$   R	                  U5        M2     U$ r*   )r   rH   r]   rU   re   )r   r"  domtreer   r!  s        r    r   CFGraph._find_dominator_tree  sP    zz#C(JJLDA U
v
q! ! r#   c                    U R                   nU R                  nU Vs0 s H  o3[        5       _M     nnU HL  n[        X#   5      S:  a  M  X#    H.  nXQU   :w  d  M  XE   R	                  U5        X   nXQU   :w  a  M!  M0     MN     U$ s  snf )N   )r   r_   r]   lenre   )r   r"  r.  r   dfr!  s         r    r    CFGraph._find_dominance_frontier  s    zzkk $%1h%A;>"Q& ^7lEIIaLA 7l $  	 &s   Bc           	         U(       a.  [        U R                  5      nU R                  nU R                  nO.[        U R                  /5      nU R                  nU R                  nU(       d  [        S5      e0 nU H  n[        U/5      XV'   M     / nU R                   H2  nX;  d  M
  [        U R                  5      XX'   UR                  U5        M4     U(       a  UR                  5       nX;   a  M  [        U/5      n	X8   n
U
(       a;  U	[        R                  " [         R                  U
 Vs/ s H  oU   PM	     sn5      -  n	XU   :w  a3  [        U	5      [        XX   5      :  d   eXU'   UR                  XH   5        U(       a  M  U$ s  snf )Nz5no entry points: dominator algorithm cannot be seeded)r]   r   r`   r_   rb   r}   r^   r  r   r+  r,  intersectionr:  extend)r   postrE   r.  succs_tabledomsr1  todor   new_domspredsps               r    _find_dominators_internal!CFGraph._find_dominators_internal  sd   
 $++,G++K++K4,,-.G++K++K  2 3 3 A1#hDG  Adkk*A 
 
A|A3xHNEI,,S-=-=?D-Eu!1gu-EG G7"8}s47|333"QKN+ d  .Fs   ,F	c                      U R                  SS9$ )NFr@  )rG  r,   s    r    r   CFGraph._find_dominators2  s    --5-99r#   c                    [        5       nU R                  R                  U5        U R                  R	                  5        H:  nUR
                  (       a  M  UR                   H  nU R                  X15        M     M<     U R                  SS9nXA	 UR	                  5        H  nUR                  U5        M     U R                  U5        U R                  R                  U5        U$ )NTrJ  )objectr   re   r   valuesrF   r   rl   rG  discardr  r  )r   
dummy_exitloopbpdomsrB  s         r    r   CFGraph._find_post_dominators5  s     X
j)KK&&(D:::ANN11 # ) ..D.9LLNDLL$ #
+  ,r#   c                   ^ ^
^ Ub>  [        U[        5      (       d  [        S[        U5       35      eUR	                  SS5        [        5       n/ m
0 mT R                  5       n[        5       nU U
U4S jnU" U5        SnT
(       aw  US-  nT
S   nTU   nU(       a7  UR                  5       n	U	T
;   a  UR                  Xy45        O/X;  a  U" U	5        O!T
R                  5         UR                  U5        T
(       a  Mw  Ub  US==   U-  ss'   U$ )z]
Find back edges.  An edge (src, dest) is a back edge if and
only if *dest* dominates *src*.
z*stats* must be a dict; got iteration_countr   c                 v   > TR                  U 5        TR                  U     Vs/ s H  oPM     snTU '   g s  snf r*   )r  r`   )rg   rn   r   r
  succs_states     r    
push_state,CFGraph._find_back_edges.<locals>.push_statea  s6    LL26++d2C D2C$2C DK Ds   6   )	r9   dict	TypeErrortype
setdefaultr]   r   r   re   )r   statsr  r   checkedrY  iter_cttos	tos_succscur_noder
  rX  s   `         @@r    r   CFGraph._find_back_edgesJ  s    eT**">tE{m LMM.2
 U
&&(%	E 	; qLG)C#C(I$==?u$NNC?3,x( 		C % e( #$/$r#   c                    ^^^^^ U R                   mU R                  m/ m[        5       mUUUUU4S jmT" U R                  5        TR	                  5         T$ )Nc                    > U T;  a@  TR                  U 5        TU     H  nX4T;  d  M  T" U5        M     TR                  U 5        g g r*   r  )rg   rn   _dfs_recr  r  r	  r  s     r    rj  *CFGraph._find_topo_order.<locals>._dfs_rec  sJ    4!$KD|:5  ( !!$'  r#   )r`   r   r]   rb   r   )r   rj  r  r  r	  r  s    @@@@@r    r   CFGraph._find_topo_order  sO    %%

u	( 	( 	""#r#   c                     0 n[        U R                  5       H^  n[        5       =X'   nU R                  U    H:  nX$4U R                  ;  d  M  UR                  U5        UR                  X   5        M<     M`     U$ r*   )r   r   r]   r`   r   re   update)r   descsrg   
node_descsr  s        r    r   CFGraph._find_descendents  sp    T--.D'*u,EK*D)<t'7'77NN4(%%ek2 * / r#   c                 J   0 nU R                    H  u  p#Un[        U/5      nU/nU(       aM  UR                  5       nXu;  a/  UR                  U5        UR	                  U R
                  U   5        U(       a  MM  XA;   a  X   R                  U5        M  XQU'   M     0 nUR                  5        Hr  u  pE[        5       n	[        5       n
U HE  nU	R                  U R
                  U   U-
  5        U
R                  U R                  U   U-
  5        MG     [        XEXS9nXU'   Mt     U$ )z3
Find the loops defined by the graph's back edges.
)r:   r   rE   rF   )
r   r]   r   re   r?  r_   rn  rU   r`   r6   )r   bodiesrm   rn   r:   r   queuer   r   rE   rF   rQ  s               r    r   CFGraph._find_loops  s    ))ICF x=DEEIIK=HHQKLLQ0	 % %%d+!%v# *( "LLNLFeGEEt{{1~45T[[^d23  v'OD &M + r#   c                     U R                   n[        S U R                   5       5      n[        UR	                  5       S S9 H3  nUR
                   H   nX$   R                  UR                  5        M"     M5     U$ )Nc              3   (   #    U  H  o/ 4v   M
     g 7fr*   r4   )r'  r   s     r    r(  )CFGraph._find_in_loops.<locals>.<genexpr>  s     5ABs   c                 ,    [        U R                  5      $ r*   )r:  r   )rQ  s    r    <lambda>(CFGraph._find_in_loops.<locals>.<lambda>  s    C		Nr#   )key)r   r]  r^   r%   rN  r   r  r:   )r   r   r   rQ  r   s        r    r   CFGraph._find_in_loops  sc    555 5<<>/JKDYY""4;;/  L r#   c                 ~    [        S U R                  R                  5        5       5      nSS KnUR                  X!S9  g )Nc              3   R   #    U  H  u  pU[        [        U5      5      4v   M     g 7fr*   )r%   r  )r'  rm   destss      r    r(  *CFGraph._dump_adj_lists.<locals>.<genexpr>  s(      @+>ZS vd5k23+>s   %'r   r   )r]  r`   rU   r   )r   r   	adj_listsr   s       r    r   CFGraph._dump_adj_lists  s:     @+/;;+<+<+>@ @	i-r#   c                     [        U[        5      (       d  [        $ S H"  n[        XS 5      n[        XS 5      nX4:w  d  M"    g   g)N)r^   ra   rb   r_   r`   FT)r9   rZ   rL   getattr)r   r<   r   thisthats        r    r=   CFGraph.__eq__  sE    %))!!MA4D)D5T*D|	 N
 r#   c                 .    U R                  U5      (       + $ r*   )r=   r;   s     r    rR   CFGraph.__ne__  s    ;;u%%%r#   )r   ra   rb   r^   r_   r`   r*   )F)znumba_cfg.dot)?r/   r0   r1   r2   rC   r!   rh   rp   rs   rw   rz   r   r   r   r   r   r   r+  cached_propertyr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rl   r  r  r~   r   r  r   r   r   rG  r   r   r   r   r   r   r   r   r=   rR   r3   r4   r#   r    rZ   rZ   [   s   !(32!&	 ( ( ' ' ' ' ' ' ( ( " " % % , , 1 1 / / + +!!!2F  4*:*,'*0&P)V:*5n$"H	.	&r#   rZ   c                      \ rS rSrSrS rS rS rS rSS jr	S	 r
SS
 jrS rS rS rS rS rS rS rS rS r\r\r\r\r\r\r\r\rS r\r\rS r S r!\!r"S r#\$S;   a  S r%O\$S;   a  O\&" \$5      eS r'S r(Sr)g) ControlFlowAnalysisi  z
Attributes
----------
- bytecode

- blocks

- blockseq

- doms: dict of set
    Dominators

- backbone: set of block offsets
    The set of block that is common to all possible code path.

c                     Xl         0 U l        0 U l        / U l        S U l        S U l        SU l        S U l        / U l        / U l	        / U l
        g NT)bytecodeblocks
liveblocksblockseqrB  r   _force_new_block	_curblock_blockstackr   _withs)r   r  s     r    r!   ControlFlowAnalysis.__init__  sO     	 $r#   c              #   T   #    U R                    H  nU R                  U   v   M     g7f)z-
Return all blocks in sequence of occurrence
N)r  r  r   r0  s     r    
iterblocksControlFlowAnalysis.iterblocks   s#      A++a.  s   &(c              #   v   #    U R                    H%  nXR                  ;   d  M  U R                  U   v   M'     g7f)z2
Return all live blocks in sequence of occurrence
N)r  r  r  r  s     r    iterliveblocks"ControlFlowAnalysis.iterliveblocks  s-      AOO#kk!n$ s   99c              #      #    UR                   R                  5        H)  u  p#X R                  ;   d  M  U R                  U   U4v   M+     g7f)zA
Yield (incoming block, number of stack pops) pairs for *block*.
N)r   rU   r  r  )r   blockr0  popss       r    incoming_blocks#ControlFlowAnalysis.incoming_blocks  s?      ++113GAOO#kk!nd** 4s
   -AANc                 6    U R                   R                  S S9  g )Nr   )graphr   )r   r   s     r    r   ControlFlowAnalysis.dump  s    

T"r#   c                   ^  T R                  5        H  nSUR                  -  n[        T US 5      nUb
  U" U5        M,  UR                  (       a_  [	        T R
                  R                  R                  UR                  5      nUR                  S;   a  SnOSUR                  -  n[        XTS9eM     [        T R                  T R                  SS  5       HI  u  pgT R                  U   nUR                  (       a  M'  UR                  (       a  M:  SUR                  U'   MK     [        5       n	T R                   H  n
U	R!                  U
5        M     T R                  R#                  5        HB  n
U
R                  R%                  5        H!  u  pU	R'                  U
R(                  X5        M#     MD     U	R+                  [-        T R                  5      5        U	R/                  5         U	T l        T R                  R#                  5        HL  n
U
R                  R%                  5        H+  u  pUT R                  U   R2                  U
R(                  '   M-     MN     [5        U 4S jT R0                  R7                  5        5       5      T l        [;        T R                  5       H  nUT R8                  ;   d  M    O   [=        S	5      eT R0                  R?                  5       n[A        5       nT R                  RC                  5        H6  n
T R0                  RE                  U
5      (       d  M%  URG                  U
5        M8     X-
  T l        g )
Nzop_%s>   SETUP_FINALLYz2'try' block not supported until python3.7 or laterz$Use of unsupported opcode (%s) found)locr[  r   c              3   F   >#    U  H  nUTR                   U   4v   M     g 7fr*   )r  )r'  r0  r   s     r    r(  *ControlFlowAnalysis.run.<locals>.<genexpr>B  s%      <(:1 !"4;;q>2(:s   !zNo live block that exits!?)$
_iter_instopnamer  is_jumpr   r  func_idr   linenor   zipr  r  r   r   rZ   rh   rN  rU   rp   r   rz   minr   r  r   r]  r   r  r   AssertionErrorr   r]   keysr   re   )r   instfnamefnlmsgcurnxtblkr  rR  outr  lastblkr   inloopblockss   `               r    runControlFlowAnalysis.run  s   OO%Ddkk)Eud+B~4--66D;;"33NC@4;;NC&s22  &$ DMM4==+<=HC++c"C%%%cooo*+""3' >
 	ANN1 ##%A--335	qxx3 6 & 	c$++./
 ##%A--335	<@C //9 6 &
  <(,

(8(8(:< <  .G$//) / !!=>> ::&&( u!!#Azz""1%%  # $ !/r#   c                 4    X R                   R                  U'   g)z~
Register a jump (conditional or not) to *target* offset.
*pops* is the number of stack pops implied by the jump (default 0).
N)r  r   )r   targetr  s      r    jumpControlFlowAnalysis.jumpX  s    
 15%%f-r#   c              #     #    U R                    Hn  nU R                  U5      (       a"  U R                  U5        U R                  U5        U R                  R
                  R                  UR                  5        Uv   Mp     g 7fr*   )r  _use_new_block_guard_with_as_start_new_blockr  r   r  r   r   r  s     r    r  ControlFlowAnalysis._iter_inst_  sa     MMD""4((##D)%%d+NN&&t{{3J "s   B Bc                     UR                   U R                  R                  ;   a  SnO#UR                  [        ;   a  SnOU R
                  nSU l        U$ )NTF)r   r  labelsr  NEW_BLOCKERSr  )r   r  ress      r    r  "ControlFlowAnalysis._use_new_blockg  sF    ;;$--...C[[L(C''C %
r#   c                     [        UR                  5      U l        U R                  U R                  UR                  '   U R                  R                  UR                  5        g r*   )r   r   r  r  r  r  r  s     r    r  $ControlFlowAnalysis._start_new_blockr  s>     -#'>>DKK T[[)r#   c                     UR                   S:X  a7  U R                  UR                     R                   nUS:w  a  Sn[        U5      egg)zChecks if the next instruction after a SETUP_WITH is something other
than a POP_TOP, if it is something else it'll be some sort of store
which is not supported (this corresponds to `with CTXMGR as VAR(S)`).r   POP_TOPzGThe 'with (context manager) as (variable):' construct is not supported.N)r  r  nextr   )r   current_instnext_opr  s       r    r  "ControlFlowAnalysis._guard_with_asw  sR     ,.mmL$5$56==G)#$ 's++	 $ /r#   c                     UR                  5       nU R                  R                  U5        U R                  R                  UR                  U45        U R                  UR                  5        SU l        g r  )get_jump_targetr  r  r   r   r  r  r  r   r  ends      r    op_SETUP_LOOP!ControlFlowAnalysis.op_SETUP_LOOP  Y    ""$$DKK-. 			$)) $r#   c                     UR                  5       nU R                  R                  U5        U R                  R                  UR                  U45        U R                  UR                  5        SU l        g r  )r  r  r  r  r   r  r  r  r  s      r    op_SETUP_WITH!ControlFlowAnalysis.op_SETUP_WITH  r  r#   c                 8    U R                   R                  5         g r*   )r  r   r  s     r    op_POP_BLOCK ControlFlowAnalysis.op_POP_BLOCK  s    r#   c                     U R                  UR                  5       5        U R                  UR                  5        SU l        g r  r  r  r  r  r  s     r    op_FOR_ITERControlFlowAnalysis.op_FOR_ITER  /    		$&&()		$)) $r#   c                     U R                  UR                  5       5        U R                  UR                  5        SU l        g r  r  r  s     r    _op_ABSOLUTE_JUMP_IF(ControlFlowAnalysis._op_ABSOLUTE_JUMP_IF  r  r#   c                     U R                  UR                  5       5        U R                  UR                  SS9  SU l        g )Nr[  )r  Tr  r  s     r    _op_ABSOLUTE_JUMP_OR_POP,ControlFlowAnalysis._op_ABSOLUTE_JUMP_OR_POP  s3    		$&&()		$))!	$ $r#   c                 P    U R                  UR                  5       5        SU l        g r  r  r  r  r  s     r    op_JUMP_ABSOLUTE$ControlFlowAnalysis.op_JUMP_ABSOLUTE      		$&&() $r#   c                 P    U R                  UR                  5       5        SU l        g r  r  r  s     r    op_JUMP_FORWARD#ControlFlowAnalysis.op_JUMP_FORWARD  r  r#   c                 4    SU R                   l        SU l        g r  r  r   r  r  s     r    op_RETURN_VALUE#ControlFlowAnalysis.op_RETURN_VALUE      %)" $r#   )r   r   r   c                 4    SU R                   l        SU l        g r  r  r  s     r    op_RETURN_CONST#ControlFlowAnalysis.op_RETURN_CONST  s    )-DNN&$(D!r#   )r   r   c                 4    SU R                   l        SU l        g r  r  r  s     r    op_RAISE_VARARGS$ControlFlowAnalysis.op_RAISE_VARARGS  r  r#   c                 N    U R                  U R                  S   5        SU l        g )Nr\  T)r  r  r  r  s     r    op_BREAK_LOOP!ControlFlowAnalysis.op_BREAK_LOOP  s!    		$""2&' $r#   )r  r  r  r   r  r   r  r  r  rB  r  r  r*   )r   )*r/   r0   r1   r2   rC   r!   r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  op_POP_JUMP_IF_FALSEop_POP_JUMP_IF_TRUEop_JUMP_IF_FALSEop_JUMP_IF_TRUEop_POP_JUMP_FORWARD_IF_FALSEop_POP_JUMP_BACKWARD_IF_FALSEop_POP_JUMP_FORWARD_IF_TRUEop_POP_JUMP_BACKWARD_IF_TRUEr  op_JUMP_IF_FALSE_OR_POPop_JUMP_IF_TRUE_OR_POPr  r  op_JUMP_BACKWARDr  r   r   NotImplementedErrorr  r  r3   r4   r#   r    r  r    s     !%+#<0|5	*

,%%%
%
 0.+*O#7 $8!"6#7 %
 75%% '% //	) 
(	(!),,%%r#   r  )collectionsr+  r   numba.core.irr   numba.core.errorsr   numba.core.utilsr   	frozensetr  r  rM  r   
namedtupler6   defaultdictrH   rZ   r  r4   r#   r    <module>r     s      
  . & 
  L 66  L i
((f .!;!!&"HJ !(A// A2C
&f C
&Lr%& r%r#   