
    xKg                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ	 d dl
mZ d dlmZ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 d dlmZ d d	lmZ d d
l m!Z!  e"g d      Z#d Z$d Z%d Z& G d de'      Z( G d de      Z) G d de)      Z* G d de*      Z+ G d de*      Z, G d de'      Z-d Z. G d de'      Z/ G d d e      Z0 G d! d"e0      Z1 G d# d$e1      Z2 G d% d&e1      Z3d' Z4d( Z5y))    N)abstractmethodABCMeta)utilsconfigcgutils)create_pass_manager_builder)remove_redundant_nrt_refct)rtsys)require_global_compiler_lock)NumbaInvalidConfigWarning)disassemble_elf_to_cfg)PassTimingsCollection)x86i386i486i586i686i786i886i986c                 :    | j                  d      d   }|t        v S )N-r   )split_x86arch)triplearchs     V/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/core/codegen.py_is_x86r      s     <<QD8    c                  ,   t         j                  j                  d      } | syd}| D ]>  }|j                         }	 |t	        t
        j                  |j                               z  }@ |S # t        $ r  t        j                  d|t               Y kw xY w)zParse refprune flags from the `config`.

    Invalid values are ignored an warn via a `NumbaInvalidConfigWarning`
    category.

    Returns
    -------
    flags : llvmlite.binding.RefPruneSubpasses
    ,r   zinvalid refprune flags )r   LLVM_REFPRUNE_FLAGSr   stripgetattrllRefPruneSubpassesupperAttributeErrorwarningswarnr   )flagsvalitems      r   _parse_refprune_flagsr.       s     &&,,S1E
Czz|	572//>>C  J  	5MM3D8<35	5s   +A**&BBc                 J  	
 t         j                  r6	 dd l}ddlm ddlm} ddlm} ddlm	 ddl	m

 ||d}||   	
fd}nt        }t        d
       t        | j                  dd              ||       t        d
       y # t        $ r d	}t        |      w xY w)Nr   )	highlight)GasLexer)	LlvmLexer)Terminal256Formatter)by_colorscheme)llvmasmc           
      N    t         |                                     y )N)style)print)argr3   r4   r0   lexers    r   printerzdump.<locals>.printerH   s%    iUW*1ABD Er   z0Please install pygments to see highlighted dumpszP================================================================================P   r   )r   HIGHLIGHT_DUMPSpygmentsr0   pygments.lexersr1   r2   pygments.formattersr3   numba.misc.dump_styler4   ImportError
ValueErrorr9   center)headerbodylangr?   	gas_lexer
llvm_lexer	lexer_mapr<   msgr3   r4   r0   r;   s            @@@@r   dumprM   8   s    	E
 +=?@<!+I>IdOEE E 	(O	&--C
 !DM	(O)  	"DCS/!	"s   B B"c                   :    e Zd ZdZd Z	 	 	 	 ddZd	dZd Zd Zy)
_CFGa  
    Wraps the CFG graph for different display method.

    Instance of the class can be stringified (``__repr__`` is defined) to get
    the graph in DOT format.  The ``.display()`` method plots the graph in
    PDF.  If in IPython notebook, the returned image can be inlined.
    c                     || _         || _        || _        |j                  |      }t	        j
                  |      | _        || _        y N)cresnamepy_funcget_functionr%   get_function_cfgdotkwargs)selfrR   rS   rT   rX   fns         r   __init__z_CFG.__init__[   s@    		t$&&r*r   Nc	                   KLMNOPQRSTUVWX ddl SddlWddl}	ddl}
ddlm} ddlm} ddlm	} ddl
m} d} |||||||||      } |||	      Kd
 } |||        |K|        |d       NdNd<   dNd<   dNd<   dNd<   dNd<   dNd<   dNd<   dNd<   dNd<   dNd<   d Nd!<   | j                  j                  | j                        }| j                  j                         }Wfd"} ||      USfd#} || j                  | j                  |      }Wj!                  d$      }Wj!                  d%      }Wj!                  d&      Vd'}Wj!                  |      TWj!                  d(      }Wj!                  d)      }Wj!                  d*      }Wj!                  d+      }Wj!                  d,      }Wj!                  d-      }Wj!                  d.      } Wj!                  d/      }!d0 }"d1 Li }#i }$Kj"                  r|
j%                  | j&                        \  XQ |j(                  |      j+                  d2d3      }%Sj-                  |%      j/                  d45      }&|	j1                  |&j3                  d6            }'d}(|'d7   D ]E  })d8\  PO|)d9   }*|)d:   }+|)d;   },|+|#|,<   |*d<d= }*|*j5                  d>      }-g }.d<Md3}/|j7                  |-d=         }0|-}1|0|0j9                         d   }2|2j5                  d?      }3t;        |3      Md@}4g }5|j<                  rNd   Nd   dA}6ni }6|3D ]X  }7|j7                  |7      j9                         \  }8}9|6j?                  |9dB      }:|5jA                  |4jC                  |:|8|9             Z d3jE                  |5      }/|-dd= }1dC};|.jA                  |;jC                  NdD   M L|1d   jG                                            dERKLMNOPQRTUVXfdF}<|1d<d D ]w  }=|j7                  |=      rKjH                  sKj"                  r |<|=|.      }>|>|>\  PO|jJ                  r|jM                  |=      rNd   }?n|jN                  r|jM                  |=      rNd   }?n|jP                  r|jM                  |=      rNd   }?n|jR                  r| jM                  |=      rNd   }?nn|jT                  r|!jM                  |=      rNd   }?nK|jV                  r|jM                  |=      rNd   }?n(|jX                  r|jM                  |=      rNd!   }?nNdD   }?|?NdD   us|rC |" L|=            D ]$  }@|.jA                  RjC                  |?M|@             & z |/r |.jA                  dGjC                  |/             d3jE                  |.      }A|ArdH|(dIAdJ}BdKjC                  |B      }*nd3}*|j[                  |+|*L       H dM|'v r/|'dM   D ]'  }C|Cd;   },|Cj?                  dNd      }D|CdO   |CdP   |Df|$|,<   ) |$j]                         D ]6  \  },}C|#|Cd<      }E|#|Cd      }F|CdQ   }G|GEdRGz  z  }E|j_                  EF       8 |rlg }HNj]                         D ]&  \  }I}JHjA                  dSjC                  |J|I             ( |j[                  dTdUjC                  d3jE                  H            L       |||ja                  |||V       |j/                  dW5      S )Xz
        "Pretty" prints the DOT graph of the CFG.
        For explanation of the parameters see the docstring for
        numba.core.dispatcher::inspect_cfg.
        r   N)binding)List)SimpleNamespace)defaultdictF)increfdecrefreturnsraisesmeminfobranchesllvm_intrin_callsfunction_calls)pythonlineinfoc                    t        |t              r| j                  D ]  }t        | ||        yt        |t              rd|j                         D ]P  \  }}|| j                  vrt        d|z        t        |t              rt        | ||       @d}t        |||fz         yt        |t              r1|D ]+  }|| j                  vrt        d|z        t        | |d       - yd}t        |t        |      z        )z Parses the kwarg into a consistent format for use in configuring
            the Digraph rendering. _config is the configuration instance to
            update, kwarg is the kwarg on which to base the updates.
            zUnexpected key in kwarg: %sz$Unexpected value for key: %s, got:%sTz)Unhandled configuration type for kwarg %sN)	
isinstancebool__dict__setattrdictitemsrD   settype)_configkwargattrkvrL   r-   s          r   parse_configz)_CFG.pretty_printer.<locals>.parse_config   s    
 %&#,,DGT51 -E4(!KKMDAq 0 00()F)JKK!!T*A.D(1v66 * E3'!D7#3#33()F)MNNt4	 " B tE{!233r   c                       y)Nwhite r|   r   r   <lambda>z%_CFG.pretty_printer.<locals>.<lambda>   s    r   orangemarkeryellowri   greentruebrredfalsebrcyanra   	turquoiserb   	lightpinkraiselightseagreenre   purplereturn	rosybrownrg   tomatorh   c                     i }j                  d      }| j                         D ]D  }|j                  |      }||j                         }|*t	        |      dk(  sJ |d   ||d   <   F |S )z Gets the metadata entries from the LLVM IR, these look something
            like '!123 = INFORMATION'. Returns a map of metadata key to metadata
            value, i.e. from the example {'!123': INFORMATION}z(^[!][0-9]+)(\s+=\s+.*)      r   )compile
splitlinesmatchgroupslen)llvm_strmdmetadata_entryxr   gres         r   get_metadataz)_CFG.pretty_printer.<locals>.get_metadata   sz     BZZ(BCN((*&,,Q/$A}"1v{*{#$Q41Q4 + Ir   c                     d}t        |      |kD  r%d| d}t        j                  |t               |d | }j	                  | |      }|j                  d       |j                  ddd	t        |      z  
       |S )N   zCFG output filename "z9" exceeds maximum supported length, it will be truncated.)filenameTB)rankdirnodenonez%s)shapefontsize)r   r)   r*   r   Digraphrv   str)rS   fnamer   cmaxwstrfgvs         r   init_digraphz)_CFG.pretty_printer.<locals>.init_digraph   s     D5zD /w 7B Cd$=>et

4%
0AFF4F FF6$X2FFGHr   z
.*{(.*)}.*z.*<(.*)>(.*)z.*!dbg\s+(![0-9]+).*z7.*!DILocation\(line:\s+([0-9]+),\s+column:\s+([0-9]),.*z.*call void @llvm.dbg.value.*z@NRT_incref\bz@NRT_decref\bz@NRT_MemInfoz.*call.*@llvm\..*z.*call.*@.*z"store .*\!numba_exception_output.*zret i32 [^1],?.*c                 2    t        j                  | dd      S )Nx   z... )widthsubsequent_indent)textwrapwrap)ss    r   r   z!_CFG.pretty_printer.<locals>.wrap   s    ==#HHr   c                 V   d}t        |       |kD  r)t        t        |             }dj                  | d | |      } t	        j
                  |       } | j                  dd      } | j                  dd      } | j                  dd      } | j                  d	d
      } | j                  dd      } | S )Ni,  z{}...<hash={}>z\{z&#123;z\}z&#125;\z&#92;%z&#37;!z&#33;)r   r   hashformathtmlescapereplace)r   nhss      r   cleanz"_CFG.pretty_printer.<locals>.clean   s     A1vza\$++AbqE26AA		%*A		%*A		$(A		#w'A		#w'AHr   z\l... dot_json)r   utf-8objects)r   labelrS   _gvidr   r   z\l|z<<td BGCOLOR="{}" BORDER="1" ALIGN="center" PORT="{}">{}</td>)TFr{   zF<tr><td BGCOLOR="{}" BORDER="1" ALIGN="left" COLSPAN="{}">{}</td></tr>defaultzF<tr><td BGCOLOR="{}" BORDER="0" ALIGN="left" COLSPAN="{}">{}</td></tr>c                    j                  |       }|1|j                         }|t        |      dk(  sJ |       |d   }j                  |d      }|j                  |      }|t        |j                               dk(  sJ |       |j                         \  }}|k7  s|k7  rj                  r7d}	|	|||fz  }
j                  d    |
            }|j                  |       j                  rFt        |      dz   z
  }|dz      }j                  d    |            }|j                  |       ||fS yyyyy)z
                Search line `l` for metadata associated with python or line info
                and inject it into `new_lines` if requested.
                Nr   r   r   zMarker %s, Line %s, column %sr   ri   )	r   r   r   getrj   r   appendri   int)l	new_linesmatchedr   r   
debug_dataldlinecolmfmt	mark_linelnlidxsource_line_interleaver   col_spancscur_colcur_linefirstlinenofmtlocation_entryr   metadata_markersrc_codes                 r   metadata_interleavez0_CFG.pretty_printer.<locals>.metadata_interleavei  s|   
 *//2&(A}"1v{-A-{!"1%'VVFD%9
%1 "0!5!5j!AB!~'*299;'71'< @b @'<,.IIK	c $(8#3sg~'2';';/N48FD#;N4N	-0ZZ8h8=i8H.J(1(8(8(<'2'9'9 034yK!O/L6>tax6H-0ZZ8h8=k8J.L(1(8(8(<+/9$4% 8F  .	 2	 % 'r   z<tr>{}</tr>z<table id="z<" BORDER="1" CELLBORDER="0" CELLPADDING="0" CELLSPACING="0">z</table>z<{}>)r   edgestailportheadtailr   z:%sz;<tr><td BGCOLOR="{}" BORDER="0" ALIGN="center">{}</td></tr>Keyzn<<table BORDER="1" CELLBORDER="1" CELLPADDING="2" CELLSPACING="1"><tr><td BORDER="0">Key:</td></tr>{}</table>>)r   viewr   svg)1graphvizr   jsoninspectllvmliter]   numba.typedr^   typesr_   collectionsr`   rR   rU   rS   get_llvm_strr   ri   getsourcelinesrT   rV   r   Sourcepipeloadsdecoder   r   r   r   rf   r   r   r   joinr#   rj   ra   searchrb   re   rd   rc   rg   rh   r   rq   edgerender)YrY   r   r   render_formatr0   
interleavestrip_irshow_keyr   r   r   r%   r^   r_   r`   _default
_highlightry   rZ   r   r   r   r   
port_matchport_jmp_matchlocation_expr	dbg_value
nrt_incref
nrt_decrefnrt_meminfoll_intrin_callsll_function_callll_raise	ll_returnr   node_idsedge_idsraw_dot
json_bytesjzonidcobjr   rS   gvidlinesr   	port_liner   sliced_linesportsports_tokenstdfmttbl_datacolorstoktargetvaluecolor	fmtheaderr   r   updated_lineinfocolourr   dattabr   tpr   r   portkey_tabrw   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   sY                                                                              @@@@@@@@@@@@@@r   pretty_printerz_CFG.pretty_printerc   sM    	*$)+$H+3,4+3,4-56>3;>
 &XI	46 	Z+[*- )88898"8!7'98"-' YY##DII.99))+	 (#	$ DIIx8 ZZ-
N3**%<=4M2JJ?@	ZZ 01
ZZ 01
jj0**%9:::n5::CDJJ12		I
	,  $+$:$:4<<$H!Hk
 &"%%b)11(B?YYw',,J,?
zz*++G45	?C !'HgLEv;Dw<D!HTN !BKEKK&E I, H I &&uRy1G L"(+${{3/|,-&&#%h<bmDFF'C$2$8$8$=$D$D$FMFE"JJug6EOOELL$FG ( GGH-	  %Sbz5IY--bmX.3LO4I4I4K.LN O/C)5 )5V "!"% ??1% '';+=+=':1i'H$'3,<)' $$):):1)=\F&&:+<+<Q+?\F''K,>,>q,A	]F&&8??1+=[F''I,<,<Q,?\F11o6L6LQ6O 34F..3C3J3J13M 01F	]F
 I.h!%(^!((FHa)HI ,K &T   !5!5i!@A '')$CHKHKM c* FF4uF%c #h d?WG}XXj$/"&v,Vb!A & #..*JD$DG$DDG$D7D$FF4 + G
1 !0171? # FF5 "0178H1I  K
 4#3HHhT-HH vvUv##r   c                 d     | j                   d|||d| j                  }|j                  d      S )a  
        Plot the CFG.  In IPython notebook, the return image object can be
        inlined.

        The *filename* option can be set to a specific path for the rendered
        output to write to.  If *view* option is True, the plot is opened by
        the system default application for the image format (PDF). *format* can
        be any valid format string accepted by graphviz, default is 'pdf'.
        )r   r   r   r   r|   r,  rX   r   )rY   r   r   r   rawbyts        r   displayz_CFG.display  s@     %$$ JhT39J=A[[J}}W%%r   c                 X     | j                   di | j                  j                  d      S )Nr   r|   r.  rY   s    r   
_repr_svg_z_CFG._repr_svg_  s'    "t""1T[[188AAr   c                     | j                   S rQ   )rW   r2  s    r   __repr__z_CFG.__repr__  s    xxr   )NNNTFFT
   )NpdfF)	__name__
__module____qualname____doc__r[   r,  r0  r3  r5  r|   r   r   rO   rO   S   s3     FJ!%BF "L$\&Br   rO   c                       e Zd ZdZdZdZdZdddefdZe	d        Z
e	d        Ze	d	        Ze	d
        Zd Zd Zd Zd Zed        Zed        Zed        Zed        Zed        Zed        Zd Zd Zd Zy)CodeLibraryz
    An interface for bundling LLVM code together and compiling it.
    It is tied to a *codegen* instance (e.g. JITCPUCodegen) that will
    determine how the LLVM code is transformed and linked together.
    Fcodegen
CPUCodegenrS   c                     || _         || _        | j                  j                   d| j                  d}t	        |      | _        g | _        y )N())_codegen_name	__class__r8  r   _recorded_timings_dynamic_globals)rY   r>  rS   ptc_names       r   r[   zCodeLibrary.__init__  sF    
nn--.a

~Q?!6x!@ "r   c                 R    | j                          t        | j                        dkD  S )Nr   )_ensure_finalizedr   rG  r2  s    r   has_dynamic_globalszCodeLibrary.has_dynamic_globals  s$     4(()A--r   c                     | j                   S rQ   )rF  r2  s    r   recorded_timingszCodeLibrary.recorded_timings  s    %%%r   c                     | j                   S )z9
        The codegen object owning this library.
        )rC  r2  s    r   r>  zCodeLibrary.codegen"  s    
 }}r   c                     | j                   S rQ   )rD  r2  s    r   rS   zCodeLibrary.name)  s    zzr   c                 6    d| j                   t        |       fz  S )Nz<Library %r at 0x%x>)rS   idr2  s    r   r5  zCodeLibrary.__repr__-  s    %BtH(===r   c                 8    | j                   rt        d|       y )Nz)operation impossible on finalized object )
_finalizedRuntimeErrorr2  s    r   _raise_if_finalizedzCodeLibrary._raise_if_finalized0  s#    ??"& ) * * r   c                 >    | j                   s| j                          y y rQ   )rS  finalizer2  s    r   rJ  zCodeLibrary._ensure_finalized5  s    MMO r   c                 \    | j                          | j                  j                  |      }|S )zC
        Create an LLVM IR module for use by this library.
        )rU  rC  _create_empty_modulerY   rS   	ir_modules      r   create_ir_modulezCodeLibrary.create_ir_module9  s*     	  "MM66t<	r   c                      y)zk
        Add a library for linking into this library, without losing
        the original library.
        Nr|   rY   librarys     r   add_linking_libraryzCodeLibrary.add_linking_libraryA      r   c                      y)zC
        Add an LLVM IR module's contents to this library.
        Nr|   )rY   r[  s     r   add_ir_modulezCodeLibrary.add_ir_moduleH  ra  r   c                      y)z
        Finalize the library.  After this call, nothing can be added anymore.
        Finalization involves various stages of code optimization and
        linking.
        Nr|   r2  s    r   rW  zCodeLibrary.finalizeN  ra  r   c                      y)z5
        Return the function named ``name``.
        Nr|   rY   rS   s     r   rU   zCodeLibrary.get_functionV  ra  r   c                      y)zA
        Get the human-readable form of the LLVM module.
        Nr|   r2  s    r   r   zCodeLibrary.get_llvm_str\  ra  r   c                      y)z2
        Get the human-readable assembly.
        Nr|   r2  s    r   get_asm_strzCodeLibrary.get_asm_strb  ra  r   c                 .    d| _         d | _        d| _        y )NTF)_object_caching_enabled_compiled_object	_compiledr2  s    r   enable_object_cachingz!CodeLibrary.enable_object_cachingl  s    '+$ $r   c                     | j                   st        d|       | j                  t        d|       | j                  S )Nobject caching not enabled in zno compiled object yet for )rk  rD   rl  rT  r2  s    r   _get_compiled_objectz CodeLibrary._get_compiled_objectq  s?    ++4IJJ  ($HII$$$r   c                     | j                   st        d|       | j                  rt        d|       || _        d| _        y )Nrp  zlibrary already compiled: T)rk  rD   rm  rl  _disable_inspection)rY   r"  s     r   _set_compiled_objectz CodeLibrary._set_compiled_objectx  s>    ++4IJJ>>tEFF %#' r   N)r8  r9  r:  r;  rS  rk  rs  r   r[   propertyrK  rM  r>  rS   r5  rU  rJ  r\  r   r`  rc  rW  rU   r   ri  rn  rq  rt  r|   r   r   r=  r=    s    J## #C # . . & &    >*
    
    
  
  
%(r   r=  )	metaclassc                        e Zd Z fdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd ZddZd Zed        Zed        Zed        Zd Zd Zed        Z xZS )CPUCodeLibraryc                 *   t         |   ||       g | _        t        j                  t        | j                  j                  | j                                    | _	        t        j                  | j                        | j                  _        d | _        y rQ   )superr[   _linking_librariesr%   parse_assemblyr   rC  rY  rS   _final_moduler   normalize_ir_text_shared_module)rY   r>  rS   rE  s      r   r[   zCPUCodeLibrary.__init__  sn    $'"$..22499=>@")";";DII"F"r   c                    | j                   j                  |_        | j                   j                  |      5 }|j                  D ]f  }d|j
                  }| j                  j                  |      5  |j                          |j                  |       |j                          ddd       h 	 ddd       y# 1 sw Y   |xY w# 1 sw Y   yxY w)zP
        Internal: run function-level optimizations inside *ll_module*.
        zFunction passes on N)rC  _data_layoutdata_layout_function_pass_manager	functionsrS   rF  record
initializerunrW  )rY   	ll_modulefpmfuncrw   s        r   _optimize_functionsz"CPUCodeLibrary._optimize_functions  s    
 !% : :	]]11)< "++)$))7++2215NN$GGDMLLN 65 , =<
 65 =<s#   :C12B7#
C7C <CCc                    d}| j                   j                  |      5  | j                  j                  j	                  | j
                         ddd       t        j                  st        | j
                        | _        d}| j                   j                  |      5  | j                  j                  j	                  | j
                         ddd       y# 1 sw Y   xY w# 1 sw Y   yxY w)zA
        Internal: optimize this library's final module.
        z/Module passes (cheap optimization for refprune)Nz!Module passes (full optimization))
rF  r  rC  
_mpm_cheapr  r}  r   LLVM_REFPRUNE_PASSr	   	_mpm_full)rY   
cheap_name	full_names      r   _optimize_final_modulez%CPUCodeLibrary._optimize_final_module  s     G
##**:6 MM$$((););< 7
 ((!;D<N<N!OD7	##**95MM##''(:(:; 65 76 65s   0C0C"C"C+c                    | j                          | j                  | j                  S | j                  }g }d}|j                  D ]W  }|dz  }|j                  r|j
                  t        j                  j                  k(  s=|j                  |j                         Y |dk(  rt        d|       |r-|j                         }|D ]  }d|j                  |      _         || _        |S )a:  
        Internal: get a LLVM module suitable for linking multiple times
        into another library.  Exported functions are made "linkonce_odr"
        to allow for multiple definitions, inlining, and removal of
        unused exports.

        See discussion in https://github.com/numba/numba/pull/890
        r   r   z5library unfit for linking: no available functions in linkonce_odr)rJ  r  r}  r  is_declarationlinkager%   Linkageexternalr   rS   rT  clonerU   )rY   modto_fixnfuncsrZ   rS   s         r   _get_module_for_linkingz&CPUCodeLibrary._get_module_for_linking  s     	 *&&&  --BaKF$$rzz7J7J)Jbgg&   Q; "& ) * * ))+C 2@  &.  "
r   c                 Z    |j                          | j                  j                  |       y rQ   )rJ  r{  r   r^  s     r   r`  z"CPUCodeLibrary.add_linking_library  s"    !!#&&w/r   c                 &   | j                          t        |t        j                        sJ t	        j
                  t        |            }t        j                  |      }|j                  |_	        |j                          | j                  |       y rQ   )rU  rl   llvmirModuler   r~  r   r%   r|  rS   verifyadd_llvm_module)rY   r[  irr  s       r   rc  zCPUCodeLibrary.add_ir_module  sk      ")V]]333&&s9~6%%b)	"	Y'r   c                     | j                  |       t        j                  st        |      }| j                  j                  |       y rQ   )r  r   r  r	   r}  link_in)rY   r  s     r   r  zCPUCodeLibrary.add_llvm_module  s7      +((29=I""9-r   c                    t                | j                  j                          | j                          t        j
                  r(t        d| j                  z  | j                         d       t               }| j                  D ]C  }||vs|j                  |       | j                  j                  |j                         d       E | j                          | j                  j!                          | j#                          y )NzFUNCTION OPTIMIZED DUMP %sr5   T)preserve)r   rC  _check_llvm_bugsrU  r   DUMP_FUNC_OPTrM   rS   r   rr   r{  addr}  r  r  r  r  _finalize_final_module)rY   seenr_  s      r   rW  zCPUCodeLibrary.finalize  s    $& 	&&(  "-		9""$f. u..Gd"!""**335 +  / 	##%!!###%r   c                     | j                   j                  D ]C  }|j                  j                  d      s| j                  j                  |j                         E y )Nznumba.dynamic.globals)r}  global_variablesrS   
startswithrG  r   )rY   r   s     r   _finalize_dynamic_globalsz(CPUCodeLibrary._finalize_dynamic_globals  sC    $$55Bww!!"9:%%,,RWW5 6r   c                     | j                   j                  D ]P  }|j                  s|j                  j	                  d      s,d}t        |j                  |j                               y )N	_ZN5numbazSymbol {} not linked properly)r}  r  r  rS   r  AssertionErrorr   )rY   rZ   rL   s      r   _verify_declare_only_symbolsz+CPUCodeLibrary._verify_declare_only_symbols  sO    $$..B  RWW%7%7%D5$SZZ%899	 /r   c                    | j                          | j                          t        j                  |       | j                  _        | j                  j                  | j                        }|rt        j                  | |       | j                          d| _
        t        j                  r(t        d| j                  z  | j                         d       t        j                   r)t        d| j                  z  | j#                         d       yy)z?
        Make the underlying LLVM module ready to use.
        TzOPTIMIZED DUMP %sr5   zASSEMBLY %sr6   N)r  r  weakrefproxyr}  _CPUCodeLibrary__libraryrC  _add_modulerW  _finalize_specificrS  r   DUMP_OPTIMIZEDrM   rS   r   DUMP_ASSEMBLYri  )rY   cleanups     r   r  z%CPUCodeLibrary._finalize_final_module  s     	&&())+ (/}}T':$
 --++D,>,>?T7+!  $tyy0$2C2C2EvN*D,<,<,>F  r   c              #   h   K   | j                   }|j                  D ]  }|j                  r|  yw)zj
        Get all functions defined in the library.  The library must have
        been finalized.
        N)r}  r  r  )rY   r  rZ   s      r   get_defined_functionsz$CPUCodeLibrary.get_defined_functions'  s/     
   --B$$  s   (22c                 8    | j                   j                  |      S rQ   )r}  rU   rf  s     r   rU   zCPUCodeLibrary.get_function1  s    !!..t44r   c                 H    | j                   rt        j                  d       y y )Nz@Inspection disabled for cached code. Invalid result is returned.)rs  r)   r*   r2  s    r    _sentry_cache_disable_inspectionz/CPUCodeLibrary._sentry_cache_disable_inspection4  s!    ##MM 8 9 $r   c                 L    | j                          t        | j                        S rQ   )r  r   r}  r2  s    r   r   zCPUCodeLibrary.get_llvm_str9  s    --/4%%&&r   c                     | j                          t        | j                  j                  j	                  | j
                              S rQ   )r  r   rC  _tmemit_assemblyr}  r2  s    r   ri  zCPUCodeLibrary.get_asm_str=  s4    --/4==$$2243E3EFGGr   c                 >    | j                          t        | ||fi |S )z=
        Get control-flow graph of the LLVM function
        )r  rO   )rY   rS   rT   rX   s       r   rV   zCPUCodeLibrary.get_function_cfgA  s$     	--/D$2622r   c                 :    | j                         }t        ||      S )aa  
        Get the CFG of the disassembly of the ELF object at symbol mangled_name.

        Requires python package: r2pipe
        Requires radare2 binary on $PATH.
        Notebook rendering requires python package: graphviz
        Optionally requires a compiler toolchain (via pycc) to link the ELF to
        get better disassembly results.
        )rq  r   )rY   mangled_nameelfs      r   get_disasm_cfgzCPUCodeLibrary.get_disasm_cfgH  s     '')%c<88r   c                    ddl m} ddlm} ddlm}  | ||            }t        d       |j                         D ]  }|d   dk(  st        |j                         d 	      }t        d
       |D ]j  }|j                  st        d|j                  j                         |d   |d   |j                  |d   d         |j                  |d   d         fz         l  t                y)zw
        Dump the symbol table of an ELF file.
        Needs pyelftools (https://github.com/eliben/pyelftools)
        r   )ELFFile)descriptions)BytesIOz	ELF file:sh_type
SHT_SYMTABc                     | j                   S rQ   rS   )syms    r   r}   z*CPUCodeLibrary._dump_elf.<locals>.<lambda>b  s    SXXr   )keyz    symbols:z/    - %r: size=%d, value=0x%x, type=%s, bind=%sst_sizest_valuest_infors   bindN)elftools.elf.elffiler  elftools.elfr  ior  r9   iter_sectionssortediter_symbolsrS   r   describe_symbol_typedescribe_symbol_bind)	clsbufr  r  r  r   secsymbolsr  s	            r   	_dump_elfzCPUCodeLibrary._dump_elfU  s     	1-GCL!k??$C9~- !1!1!39MNn%"C88 K XX__. ^ _)>>s9~f?UV)>>s9~f?UV	   #	 % 	r   c                 r    	 |j                   }|j                  rd|_        ||_        yy# t        $ r Y yw xY w)zB
        `ll_module` was compiled into object code `buf`.
        NT)r  r(   rk  rm  rl  )r  r  r  rY   s       r   _object_compiled_hookz$CPUCodeLibrary._object_compiled_hookp  sE    
	&&D ''!DN$'D! (  		s   * 	66c                     	 |j                   }|j                  r"|j                  r|j                  }d|_        |S yy# t        $ r Y yw xY w)z>
        Return a cached object code for `ll_module`.
        N)r  r(   rk  rl  )r  r  rY   r  s       r   _object_getbuffer_hookz%CPUCodeLibrary._object_getbuffer_hook}  sZ    
	&&D ''D,A,A''C$(D!J -B'  		s   = 	A	A	c                 p    | j                          | j                  d| j                  j                         fS )zX
        Serialize this library using its bitcode as the cached representation.
        bitcode)rJ  rS   r}  
as_bitcoder2  s    r   serialize_using_bitcodez&CPUCodeLibrary.serialize_using_bitcode  s0     	 		9d&8&8&C&C&EFFr   c                     | j                          | j                         | j                         j                         f}| j                  d|fS )z
        Serialize this library using its object code as the cached
        representation.  We also include its bitcode for further inlining
        with other libraries.
        object)rJ  rq  r  r  rS   )rY   datas     r   serialize_using_object_codez*CPUCodeLibrary.serialize_using_object_code  sI     	 ))+,,.99;=		8T**r   c                    |\  }}}|j                  |      }t        ||       sJ |dk(  r,t        j                  |      |_        |j                          |S |dk(  r|\  }}|j                          |j                  |       t        j                  |      |_        |j                          |j                  j                  j                  |j                         |S t        d|      )Nr  r  zunsupported serialization kind )create_libraryrl   r%   parse_bitcoder}  r  rn  rt  r  rC  _engine_load_defined_symbolsrD   )	r  r>  staterS   kindr  rY   object_codeshared_bitcodes	            r   _unserializezCPUCodeLibrary._unserialize  s     dD%%d+$$$$9!#!1!1$!7D'')KX*.'K&&(%%k2"$"2"2>"BD'')MM!!778K8KLKDJKKr   rQ   )r8  r9  r:  r[   r  r  r  r`  rc  r  rW  r  r  r  r  rU   r  r   ri  rV   r  classmethodr  r  r  r  r  r  __classcell__)rE  s   @r   rx  rx    s    ## <"!F0(.&86:G459
'H39  4 
( 
(  G	+ L Lr   rx  c                       e Zd Zd Zd Zd Zy)AOTCodeLibraryc                     | j                          | j                  j                  j                  | j                        S )z
        Return this library as a native object (a bytestring) -- for example
        ELF under Linux.

        This function implicitly calls .finalize().
        )rJ  rC  r  emit_objectr}  r2  s    r   emit_native_objectz!AOTCodeLibrary.emit_native_object  s1     	 }}  ,,T-?-?@@r   c                 V    | j                          | j                  j                         S )zz
        Return this library as LLVM bitcode (a bytestring).

        This function implicitly calls .finalize().
        )rJ  r}  r  r2  s    r   emit_bitcodezAOTCodeLibrary.emit_bitcode  s%     	 !!,,..r   c                      y rQ   r|   r2  s    r   r  z!AOTCodeLibrary._finalize_specific      r   N)r8  r9  r:  r  r  r  r|   r   r   r  r    s    A/r   r  c                       e Zd Zd Zd Zy)JITCodeLibraryc                     | j                          | j                  j                  }|j                  |      sy| j                  j                  j	                  |      S )a  
        Generate native code for function named *name* and return a pointer
        to the start of the function (as an integer).

        This function implicitly calls .finalize().

        Returns
        -------
        pointer : int
            - zero (null) if no symbol of *name* is defined by this code
              library.
            - non-zero if the symbol is defined.
        r   )rJ  rC  r  is_symbol_definedget_function_address)rY   rS   ees      r   get_pointer_to_functionz&JITCodeLibrary.get_pointer_to_function  sK     	 ]]""##D)==((==dCCr   c                     | j                   j                  | j                         | j                  j	                  d      5  | j                   j
                  j                          d d d        y # 1 sw Y   y xY w)NzFinalize object)rC  _scan_and_fix_unresolved_refsr}  rF  r  r  finalize_objectr2  s    r   r  z!JITCodeLibrary._finalize_specific  sQ    33D4F4FG##**+<=MM!!113 >==s   %A//A8N)r8  r9  r:  r  r  r|   r   r   r
  r
    s    D*4r   r
  c                   ,    e Zd ZdZdZd Zd Zd Zd Zy)RuntimeLinkerzP
    For tracking unresolved symbols generated at runtime due to recursion.
    z.numba.unresolved$c                 b    t        j                         | _        t               | _        g | _        y rQ   )r   
UniqueDict_unresolvedrr   _defined	_resolvedr2  s    r   r[   zRuntimeLinker.__init__  s#     ++-r   c                    | j                   }|j                  D ]  }|j                  j                  |      s|j                  t	        |      d }|j                  |j                        rSt        j                  j                  d      }t        j                  |      }|j                  |t        j                  |             || j                  |<    y)zr
        Scan and track all unresolved external symbols in the module and
        allocate memory for it.
        Nnrt_unresolved_abort)PREFIXr  rS   r  r   r  r
   r_  r  ctypesc_void_padd_global_mapping	addressofr  )rY   moduleengineprefixr   r  abortfnptrs           r   scan_unresolved_symbolsz%RuntimeLinker.scan_unresolved_symbols  s    
 ))Bww!!&)ggc&kl+++BGG4--??@VWoog.))"f.>.>s.CD(+  % *r   c                     |j                   D ]4  }|j                  r| j                  j                  |j                         6 y)z5
        Scan and track all defined symbols.
        N)r  r  r  r  rS   )rY   r!  rZ   s      r   scan_defined_symbolsz"RuntimeLinker.scan_defined_symbols  s3     ""B$$!!"''* #r   c                    | j                   D cg c]  }|| j                  v s| }}|D ]S  }|j                  |      }| j                   |   }||_        | j                  j                  ||f       | j                   |= U yc c}w )z=
        Fix unresolved symbols if they are defined.
        N)r  r  r  r"  r  r   )rY   r"  rS   pendingfnptrr%  s         r   resolvezRuntimeLinker.resolve  s    
 %)$4$4N$4D8M4$4ND//5E""4(CCINN!!4+.  &  Os
   BBN)	r8  r9  r:  r;  r  r[   r&  r(  r,  r|   r   r   r  r    s"     "F
,&+'r   r  c                 B     t        j                          fd       }|S )Nc                 0     | j                   g|i |S rQ   )_ee)rY   argsrX   olds      r   wrapperz_proxy.<locals>.wrapper"  s    488-d-f--r   )	functoolswraps)r1  r2  s   ` r   _proxyr5  !  s#    __S. .Nr   c                      e Zd ZdZd Zd Zd Zd Zd Z e	e
j                  j                        Z e	e
j                  j                        Z e	e
j                  j                        Z e	e
j                  j                        Zy)	JitEnginezWraps an ExecutionEngine to provide custom symbol tracking.
    Since the symbol tracking is incomplete  (doesn't consider
    loaded code object), we are not putting it in llvmlite.
    c                 0    || _         t               | _        y rQ   )r/  rr   _defined_symbols)rY   r  s     r   r[   zJitEngine.__init__-  s     !$r   c                     || j                   v S )z/Is the symbol defined in this session?
        )r9  rf  s     r   r  zJitEngine.is_symbol_defined:  s     t,,,,r   c                     |j                   |j                  fD ];  }| xj                  |D ch c]  }|j                  s|j                   c}z  c_        = yc c}w )z(Extract symbols from the module
        N)r  r  r9  r  rS   )rY   r  gsetsr   s       r   r  zJitEngine._load_defined_symbols?  s\     mmS%9%9:E!! &@"-/->-> ')gg &@ @! ;&@s   A
c                 Z    | j                  |       | j                  j                  |      S )zXOverride ExecutionEngine.add_module
        to keep info about defined symbols.
        )r  r/  
add_modulerY   r!  s     r   r>  zJitEngine.add_moduleF  s'     	""6*xx""6**r   c                     | j                   j                  |j                         | j                  j	                  ||      S )z`Override ExecutionEngine.add_global_mapping
        to keep info about defined symbols.
        )r9  r  rS   r/  r  )rY   r   addrs      r   r  zJitEngine.add_global_mappingM  s3     	!!"''*xx**2t44r   N)r8  r9  r:  r;  r[   r  r  r>  r  r5  r%   ExecutionEngineset_object_cacher  r  get_global_value_addressr|   r   r   r7  r7  (  s    &-
@+5 b00AABR//??@O!""4"4"I"IJ%
33 
r   r7  c                   L    e Zd ZdZed        Zed        Zed        Zd Z	d Z
y)CodegenaM  
    Base Codegen class. It is expected that subclasses set the class attribute
    ``_library_class``, indicating the CodeLibrary class for the target.

    Subclasses should also initialize:

    ``self._data_layout``: the data layout for the target.
    ``self._target_data``: the binding layer ``TargetData`` for the target.
    c                      y)zD
        Create a new empty module suitable for the target.
        Nr|   rf  s     r   rY  zCodegen._create_empty_modulej  ra  r   c                      y)zu
        Add a module to the execution engine. Ownership of the module is
        transferred to the engine.
        Nr|   r?  s     r   r  zCodegen._add_modulep  ra  r   c                     | j                   S )zJ
        The LLVM "target data" object for this codegen instance.
        )_target_datar2  s    r   target_datazCodegen.target_dataw  s    
    r   c                 *     | j                   | |fi |S )zb
        Create a :class:`CodeLibrary` object for use with this codegen
        instance.
        )_library_class)rY   rS   rX   s      r   r  zCodegen.create_library~  s    
 #t""4888r   c                 :    | j                   j                  | |      S rQ   )rM  r  )rY   
serializeds     r   unserialize_libraryzCodegen.unserialize_library  s    ""//jAAr   N)r8  r9  r:  r;  r   rY  r  ru  rK  r  rP  r|   r   r   rF  rF  _  sN      
   ! !9Br   rF  c                   T    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zy)r?  c                     t                d | _        t        j                  t	        | j                  |                  | _        d| j                  _        t               | _	        | j                  | j                         y )Nglobal_codegen_module)initialize_llvmr  r%   r|  r   rY  _llvm_modulerS   r  	_rtlinker_init)rY   module_names     r   r[   zCPUCodegen.__init__  s_     --))+679!8&

4$$%r   c                    t        |j                        g k(  sJ d       t        j                  j	                  t        j
                               }t        t        j                        }| j                         | _
        | j                  |        |j                  d
i |}t        j                  }t        j                  |||      }t        j                  r|j!                          || _        t%        |      | _        |j(                  | _        t-        | j*                        | _        t        j                  j0                  rd}d}nd}d}| j3                  |d|d	      | _        | j3                         | _        | j&                  j9                  | j:                  j<                  | j:                  j>                         y )NzModule isn't empty)opt)use_lmmT   Fr   cheap)loop_vectorizeslp_vectorizerZ  costr|   ) listr  r%   Targetfrom_tripleget_process_triplerp   r   OPT_customize_tm_features_tm_features_customize_tm_optionscreate_target_machineUSE_LLVMLITE_MEMORY_MANAGERcreate_mcjit_compilerENABLE_PROFILINGenable_jit_eventsr  r7  r  rK  rJ  r   r  
is_opt_max_module_pass_managerr  r  rC  rM  r  r  )	rY   llvm_moduler!  
tm_optionstmr[  r"  loopvect	opt_levels	            r   rW  zCPUCodegen._init  sr   K001R7M9MM7&&r'<'<'>?fjj)
 779"":.)V))7J744))+r7K""$$& (".. 1 12::   HI HI338BG8A9@ 4 B
 224%%d&9&9&O&O&*&9&9&P&P	Rr   c                     t        j                  t        j                  |            }t	        j
                         |_        | j                  r| j                  |_        |S rQ   )	r  r  r   r~  r%   rd  r   r  r  rZ  s      r   rY  zCPUCodegen._create_empty_module  sI    MM'";";D"AB	002	$($5$5I!r   c                 $   t        j                         }|j                  t        j                                | j                  j                  |       |j                  dd       } | j                  di |5 }|j                  |       d d d        |H|dk(  rCt        j                  dk7  r0|j                          |j                          |j                          t        j                  r|j                  t!                      |S # 1 sw Y   ~xY w)Nr`  r]  r   r|   )r%   create_module_pass_manageradd_target_library_inford  r  add_analysis_passespop_pass_manager_builderpopulater   re  add_loop_rotate_passadd_instruction_combining_passadd_jump_threading_passr  add_refprune_passr.   )rY   rX   pmr`  pmbs        r   ro  zCPUCodegen._module_pass_manager  s    **,
""2#8#8#:;$$R(zz&$''T''1&1SLL 2 FJJ!O ##%--/&&($$  !6!89	 21s   7DDc                 ^   t        j                  |      }|j                  |j                         | j                  j                  |        | j                  di |5 }|j                  |       d d d        t        j                  r|j                  t                      |S # 1 sw Y   4xY w)Nr|   )r%   create_function_pass_managerrx  r   r  ry  r{  r|  r   r  r  r.   )rY   rp  rX   r  r  s        r   r  z!CPUCodegen._function_pass_manager  s    ,,[9
"";#5#56$$R('T''1&1SLL 2$$  !6!89		 21s   B##B,c                     |j                  dt        j                        }|j                  dt        j                        }|j                  dt        j                        }t        d|||d|}|S )a  
        Create a PassManagerBuilder.

        Note: a PassManagerBuilder seems good only for one use, so you
        should call this method each time you want to populate a module
        or function pass manager.  Otherwise some optimizations will be
        missed...
        rZ  r^  r_  )rZ  r^  r_  r|   )rz  r   re  LOOP_VECTORIZESLP_VECTORIZEr   )rY   rX   rt  r^  r_  r  s         r   r{  z CPUCodegen._pass_manager_builder  sm     JJufjj1	$4f6K6KL

?F4H4HI) 4i9G8E4 -34
 
r   c                     d}t        j                  |      }t        |      }d|v sd|v ryd|v r#t        j                         }t        d|d      t        d|d	      )
z<
        Guard against some well-known LLVM bug(s).
        zo
            define double @func()
            {
                ret double 1.23e+01
            }
            z12.3z1.23Nz1.0zFLLVM will produce incorrect floating-point code in the current locale zh.
Please read https://numba.readthedocs.io/en/stable/user/faq.html#llvm-locale-bug for more information.zUnexpected IR:

)r%   r|  r   locale	getlocalerT  r  )rY   r  r  ir_outlocs        r   r  zCPUCodegen._check_llvm_bugs  sr     #SVv/F?""$C
 	  v?@@r   c                 d    | j                   j                  | j                         | j                  fS )zP
        Return a tuple unambiguously describing the codegen behaviour.
        )rU  r   _get_host_cpu_namerg  r2  s    r   magic_tuplezCPUCodegen.magic_tuple  s1     !!(($*A*A*C!!# 	#r   c                     | j                   j                  || j                         | j                   j                  |       | j                   j	                  | j                         y rQ   )rV  r&  r  r(  r,  r?  s     r   r  z(CPUCodegen._scan_and_fix_unresolved_refs#  sB    ..vt||D++F3t||,r   c                 p   t        j                  d      j                         }| j                  j                  |z   }|j
                  }	 |j                  |      }|j                  |j                  |      |j                               S # t        $ r" t        j                  |||      }d|_	        Y Yw xY w)N   r  r  )r  IntType
as_pointerrV  r  r!  
get_globalKeyErrorGlobalVariabler  bitcastload)rY   builderfntyrS   voidptrptrnamellvm_modr+  s           r   insert_unresolved_refz CPUCodegen.insert_unresolved_ref(  s    ..#..0..''$.>>	'''0E
 w||E2DOO4EFF	  	'))(G'JE&EM	's   
B
 
(B54B5c                 j    t         j                  t        j                         S t         j                  S rQ   )r   CPU_NAMEr%   get_host_cpu_namer2  s    r   r  zCPUCodegen._get_host_cpu_name4  s+    ??* $$& 	&__	&r   c                 V    t         j                  t         j                  S t               S rQ   )r   CPU_FEATURESget_host_cpu_featuresr2  s    r   _get_host_cpu_featuresz!CPUCodegen._get_host_cpu_features9  s#    *&&&$&&r   N)r8  r9  r:  r[   rW  rY  ro  r  r{  r  r  r  r  r  r  r|   r   r   r?  r?    sB    &-R^*(A<#-

G&
'r   r?  c                   .    e Zd ZdZeZddZd Zd Zd Z	y)AOTCPUCodegenzp
    A codegen implementation suitable for Ahead-Of-Time compilation
    (e.g. generation of object files).
    Nc                 F    |xs d| _         t        j                  | |       y Nr   )	_cpu_namer?  r[   )rY   rX  cpu_names      r   r[   zAOTCPUCodegen.__init__G  s    !RD+.r   c                     | j                   }|dk(  r| j                         }||d<   d|d<   d|d<   | j                  |d<   y )Nhostcpupicrelocr   	codemodelfeatures)r  r  rg  )rY   optionsr  s      r   rh  z#AOTCPUCodegen._customize_tm_optionsL  sN    >>v..0H! ("//
r   c                      yr  r|   r2  s    r   rf  z$AOTCPUCodegen._customize_tm_featuresU  s     r   c                      y rQ   r|   r?  s     r   r  zAOTCPUCodegen._add_moduleZ  r  r   rQ   )
r8  r9  r:  r;  r  rM  r[   rh  rf  r  r|   r   r   r  r  ?  s"    
 $N/
0
r   r  c                   ,    e Zd ZdZeZd Zd Zd Zd Z	y)JITCPUCodegenzI
    A codegen implementation suitable for Just-In-Time compilation.
    c                    | j                         |d<   t        j                  j                         j                  }|j                  d      rd}n|j                  d      rd}nd}||d<   d|d	<   | j                  |d
<   t        j                  t        j                  j                        }d|j                  v rd|d<   y y )Nr  r   staticppcr  r   r  
jitdefaultr  r  jitT)r  r%   rb  from_default_triplerS   r  rg  r   pysignatureri  
parameters)rY   r  r   reloc_modelsigs        r   rh  z#JITCPUCodegen._customize_tm_optionse  s     002 yy,,.33??5!"K__U#K#K&+ #//
 		 ? ?@CNN"!GEN #r   c                 "    | j                         S rQ   )r  r2  s    r   rf  z$JITCPUCodegen._customize_tm_features  s    **,,r   c                 :    | j                   j                  |       y rQ   )r  r>  r?  s     r   r  zJITCPUCodegen._add_module  s    'r   c                     | j                   j                  |      }t        j                  dz  j	                  |      }t        j                  t        |            |d<   y)zrSet the environment address.

        Update the GlobalVariable named *env_name* to the address of *env*.
        r   r   N)r  rD  r  r  from_addressrQ  )rY   env_nameenvgvaddrenvptrs        r   set_envzJITCPUCodegen.set_env  sG    
 66x@//A%33F;OOBsG,q	r   N)
r8  r9  r:  r;  r
  rM  rh  rf  r  r  r|   r   r   r  r  ^  s"     $N"6-(-r   r  c                  |    t        j                          t        j                          t        j                          y)z Safe to use multiple times.
    N)r%   r  initialize_native_targetinitialize_native_asmprinterr|   r   r   rT  rT    s%     MMO!##%r   c                      	 t        j                         } t        j                  s| D ]  }|j	                  d      sd| |<    | j                         S # t        $ r Y yw xY w)z~Get host CPU features using LLVM.

    The features may be modified due to user setting.
    See numba.config.ENABLE_AVX.
    avxFr   )r%   r  r   
ENABLE_AVXr  flattenrT  )r  rw   s     r   r  r    sd    "++-   <<&"'HQK 
 !!  s   A 	A A )6r)   r3  r  r  r  r   r   llvmlite.bindingr]   r%   llvmlite.irr  r  abcr   r   
numba.corer   r   r   numba.core.llvm_bindingsr   numba.core.runtime.nrtoptr	   numba.core.runtimer
   numba.core.compiler_lockr   numba.core.errorsr   numba.misc.inspectionr   numba.misc.llvm_pass_timingsr   	frozensetr   r   r.   rM   r  rO   r=  rx  r  r
  r  r5  r7  rF  r?  r  r  rT  r  r|   r   r   <module>r     s            ' - - @ @ $ A 7 8 >  & '
06p6 pfx(G x(vpL[ pLf	^ 24^ 4:5'F 5'n4
 4
n'B 'BTs' s'lJ >5-J 5-p&"r   