
    pi                     +   d dl mZmZmZmZmZmZmZ d dlm	Z	 d dl
mZ d dlmZ d Zd Zd Zd dZ e	d	d
      Z G d d	e      Z G d de      Zd!dZd Zd Z G d de      Z G d d      Z G d dej4                  e      Z G d dej4                  e      Z G d dej4                        Z G d dej4                        Z G d dej4                        Z ee      egej@                  jB                  _"        egej@                  jF                  _"         ee      gej@                  jH                  _"        ejJ                  ej@                  jL                  _'        ejJ                  ejP                  ejR                  gej@                  jT                  _"        ejJ                  gej@                  jV                  _"        ejJ                  gej@                  jX                  _"        ejJ                  gej@                  jZ                  _"        ejJ                  gej@                  j\                  _"        ejJ                  gej@                  j^                  _"        ejJ                  gej@                  j`                  _"        ejJ                  gej@                  jb                  _"        ejJ                  gej@                  jd                  _"        ejJ                  gej@                  jf                  _"        ejJ                  gej@                  jh                  _"        ejJ                  gej@                  jj                  _"        ejJ                  gej@                  jl                  _"        ejJ                  gej@                  jn                  _"        ejJ                  gej@                  jp                  _"        ejJ                  gej@                  jr                  _"        ejJ                  gej@                  jt                  _"        ejJ                  gej@                  jv                  _"        ejJ                  gej@                  jx                  _"        ejJ                  gej@                  jz                  _"        ejJ                  gej@                  j|                  _"        ejJ                  gej@                  j~                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  gej@                  j                  _"        ejJ                  eegej@                  j                  _"        ej                  ej@                  j                  _'        ej                  ej                  ejR                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  egej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                   _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j
                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                  _"        ej                  gej@                  j                   _"        ej                  gej@                  j"                  _"        ej                  gej@                  j$                  _"        ej                  gej@                  j&                  _"        ej                  gej@                  j(                  _"        ej                  gej@                  j*                  _"        ej                  gej@                  j,                  _"        ej                  eegej@                  j.                  _"        ej0                  ej@                  j2                  _'        eej@                  j4                  _'        ej0                  gej@                  j4                  _"        ej0                  egej@                  j6                  _"        eej@                  j8                  _'        ej0                  gej@                  j8                  _"        ej0                  egej@                  j:                  _"        eej@                  j<                  _'        ej0                  gej@                  j<                  _"        ej0                  egej@                  j>                  _"        eej@                  j@                  _'        ej0                  gej@                  j@                  _"        ej0                  egej@                  jB                  _"        eej@                  jD                  _'        ej0                  egej@                  jF                  _"        ej0                  gej@                  jH                  _"        ejR                  ej@                  jJ                  _'        ejL                  ej0                  gej@                  jJ                  _"        ejR                  gej@                  jN                  _"        ejP                  ej@                  jR                  _'        ejP                  gej@                  jT                  _"        ejR                  ejP                  gej@                  jV                  _"        ejP                   ee      gej@                  jX                  _"        ejJ                  ej@                  jZ                  _'        ejR                  eegej@                  jZ                  _"        ej                  ej@                  j\                  _'        ejR                  eegej@                  j\                  _"        y)"    )c_boolc_intc_size_tPOINTER	Structurebyrefc_char_p)
namedtuple)IntFlag)ffic                      t               S N)ModulePassManager     b/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/llvmlite/binding/newpassmanagers.pycreate_new_module_pass_managerr      s    r   c                      t               S r   )FunctionPassManagerr   r   r    create_new_function_pass_managerr      s      r   c                     t        | |      S r   )PassBuilder)tmptos     r   create_pass_builderr      s    r3r   c                     t        | |      S r   )PipelineTuningOptions)speed_level
size_levels     r   create_pipeline_tuning_optionsr       s     j99r   
PruneStatsz&basicblock diamond fanout fanout_raisec                       e Zd ZdZd Zd Zy)r!   z4 Holds statistics from reference count pruning.
    c                 @   t        |t              s%d}t        |j                  t	        |                  t        | j
                  |j
                  z   | j                  |j                  z   | j                  |j                  z   | j                  |j                  z         S )Nz;PruneStats can only be added to another PruneStats, got {}.	
isinstancer!   	TypeErrorformattype
basicblockdiamondfanoutfanout_raiseselfothermsgs      r   __add__zPruneStats.__add__   s}    %,OCCJJtE{344$//E,<,<<,,6++4++e.@.@@B 	Br   c                 @   t        |t              s%d}t        |j                  t	        |                  t        | j
                  |j
                  z
  | j                  |j                  z
  | j                  |j                  z
  | j                  |j                  z
        S )NzBPruneStats can only be subtracted from another PruneStats, got {}.r$   r-   s      r   __sub__zPruneStats.__sub__(   s    %,CCJJtE{344$//E,<,<<,,6++4++e.@.@@B 	Br   N)__name__
__module____qualname____doc__r1   r3   r   r   r   r!   r!      s    BBr   c                   (    e Zd ZdefdefdefdefgZy)_c_PruneStatsr)   r*   r+   r,   N)r4   r5   r6   r   _fields_r   r   r   r9   r9   3   s)    	x 	H	8	"	$Hr   r9   c                     t        dddd      }t        |       }t        j                  j	                  t        |      |       t        |j                  |j                  |j                  |j                        S )z Returns a namedtuple containing the current values for the refop pruning
    statistics. If kwarg `printout` is True the stats are printed to stderr,
    default is False.
    r   )r9   r   r   libLLVMPY_DumpRefPruneStatsr   r!   r)   r*   r+   r,   )printoutstatsdo_prints      r   dump_refprune_statsrA   ;   s`     !Q1%EhHGG$$U5\8<e&&u||((* *r   c                 T    t         j                  j                  t        |              y)zEnable or disable the pass timers.

    Parameters
    ----------
    enable : bool
        Set to True to enable the pass timers.
        Set to False to disable the pass timers.
    N)r   r<   LLVMPY_SetTimePassesr   )enables    r   set_time_passesrE   N   s     GG  0r   c                      t        j                         5 } t         j                  j                  |        t	        |       cddd       S # 1 sw Y   yxY w)a  Returns the pass timings report and resets the LLVM internal timers.

    Pass timers are enabled by ``set_time_passes()``. If the timers are not
    enabled, this function will return an empty string.

    Returns
    -------
    res : str
        LLVM generated timing report.
    N)r   OutputStringr<   LLVMPY_ReportAndResetTimingsstr)bufs    r   report_and_reset_timingsrK   Z   s@     
			 s,,S13x  s   *A		Ac                   2    e Zd ZdZdZdZdZeez  ez  ez  Zy)RefPruneSubpasses            N)r4   r5   r6   PER_BBDIAMONDFANOUTFANOUT_RAISEALLr   r   r   rM   rM   j   s*    FGFL
7
V
#l
2Cr   rM   c                      e Zd Zd Zd Zd Zd Zd Zd Zd-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 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' Z)d( Z*d) Z+d* Z,d+ Z-y,).NewPassManagerc                 <    t        |       t        u rt        d      y )Nz*Cannot instantiate NewPassManager directly)r(   rX   r&   r.   s    r   __init__zNewPassManager.__init__t   s    :'HII (r   c                     t        | t              r"t        j                  j	                  | ||       y t        j                  j                  | ||       y r   )r%   r   r   r<   LLVMPY_RunNewModulePassManager LLVMPY_RunNewFunctionPassManager)r.   IRpbs      r   runzNewPassManager.runx   s9    d-.GG224R@GG44T2rBr   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddAAEvaluatorLLVMPY_function_AddAAEvaluatorrZ   s    r   add_aa_eval_passzNewPassManager.add_aa_eval_pass~   1    d-.GG006GG2248r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<    LLVMPY_module_AddSimplifyCFGPass"LLVMPY_function_AddSimplifyCFGPassrZ   s    r   add_simplify_cfg_passz$NewPassManager.add_simplify_cfg_pass   1    d-.GG44T:GG66t<r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddLoopUnrollPass!LLVMPY_function_AddLoopUnrollPassrZ   s    r   add_loop_unroll_passz#NewPassManager.add_loop_unroll_pass   1    d-.GG33D9GG55d;r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<    LLVMPY_module_AddInstCombinePass"LLVMPY_function_AddInstCombinePassrZ   s    r   add_instruction_combine_passz+NewPassManager.add_instruction_combine_pass   rk   r   c                     t        | t              r!t        j                  j	                  | |       y t        j                  j                  | |       y r   )r%   r   r   r<   "LLVMPY_AddJumpThreadingPass_module$LLVMPY_AddJumpThreadingPass_function)r.   	thresholds     r   add_jump_threading_passz&NewPassManager.add_jump_threading_pass   s5    d-.GG66tYGGG88yIr   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddCFGPrinterPass!LLVMPY_function_AddCFGPrinterPassrZ   s    r   add_cfg_printer_passz#NewPassManager.add_cfg_printer_pass   rp   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   #LLVMPY_module_AddCFGOnlyPrinterPass%LLVMPY_function_AddCFGOnlyPrinterPassrZ   s    r   add_cfg_only_printer_passz(NewPassManager.add_cfg_only_printer_pass   1    d-.GG77=GG99$?r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddDomPrinterLLVMPY_function_AddDomPrinterrZ   s    r   add_dom_printer_passz#NewPassManager.add_dom_printer_pass   1    d-.GG//5GG11$7r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddDomOnlyPrinter!LLVMPY_function_AddDomOnlyPrinterrZ   s    r   add_dom_only_printer_passz(NewPassManager.add_dom_only_printer_pass   rp   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddPostDomPrinter!LLVMPY_function_AddPostDomPrinterrZ   s    r   add_post_dom_printer_passz(NewPassManager.add_post_dom_printer_pass   rp   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   #LLVMPY_module_AddPostDomOnlyPrinter%LLVMPY_function_AddPostDomOnlyPrinterrZ   s    r   add_post_dom_only_printer_passz-NewPassManager.add_post_dom_only_printer_pass   r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddDomViewerLLVMPY_function_AddDomViewerrZ   s    r   add_dom_viewer_passz"NewPassManager.add_dom_viewer_pass   1    d-.GG..t4GG006r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddDomOnlyViewer LLVMPY_function_AddDomOnlyViewerrZ   s    r   add_dom_only_viewer_passz'NewPassManager.add_dom_only_viewer_pass   1    d-.GG2248GG44T:r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddPostDomViewer LLVMPY_function_AddPostDomViewerrZ   s    r   add_post_dom_viewer_passz'NewPassManager.add_post_dom_viewer_pass   r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   "LLVMPY_module_AddPostDomOnlyViewer$LLVMPY_function_AddPostDomOnlyViewerrZ   s    r   add_post_dom_only_viewer_passz,NewPassManager.add_post_dom_only_viewer_pass   s1    d-.GG66t<GG88>r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddLintPassLLVMPY_function_AddLintPassrZ   s    r   add_lint_passzNewPassManager.add_lint_pass   1    d-.GG--d3GG//5r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddADCEPassLLVMPY_function_AddADCEPassrZ   s    r   add_aggressive_dce_passz&NewPassManager.add_aggressive_dce_pass   r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   'LLVMPY_module_AddBreakCriticalEdgesPass)LLVMPY_function_AddBreakCriticalEdgesPassrZ   s    r   add_break_critical_edges_passz,NewPassManager.add_break_critical_edges_pass   1    d-.GG;;DAGG==dCr   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddDSEPassLLVMPY_function_AddDSEPassrZ   s    r   add_dead_store_elimination_passz.NewPassManager.add_dead_store_elimination_pass   1    d-.GG,,T2GG..t4r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddDCEPassLLVMPY_function_AddDCEPassrZ   s    r   add_dead_code_elimination_passz-NewPassManager.add_dead_code_elimination_pass   r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   *LLVMPY_module_AddAggressiveInstCombinePass,LLVMPY_function_AddAggressiveInstCombinePassrZ   s    r   add_aggressive_instcombine_passz.NewPassManager.add_aggressive_instcombine_pass   s1    d-.GG>>tDGG@@Fr   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddLCSSAPassLLVMPY_function_AddLCSSAPassrZ   s    r   add_lcssa_passzNewPassManager.add_lcssa_pass   r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddNewGVNPassLLVMPY_function_AddNewGVNPassrZ   s    r   add_new_gvn_passzNewPassManager.add_new_gvn_pass  r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   !LLVMPY_module_AddLoopSimplifyPass#LLVMPY_function_AddLoopSimplifyPassrZ   s    r   add_loop_simplify_passz%NewPassManager.add_loop_simplify_pass  1    d-.GG55d;GG77=r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   %LLVMPY_module_AddLoopUnrollAndJamPass'LLVMPY_function_AddLoopUnrollAndJamPassrZ   s    r   add_loop_unroll_and_jam_passz+NewPassManager.add_loop_unroll_and_jam_pass  1    d-.GG99$?GG;;DAr   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddSCCPPassLLVMPY_function_AddSCCPPassrZ   s    r   add_sccp_passzNewPassManager.add_sccp_pass  r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<    LLVMPY_module_AddLowerAtomicPass"LLVMPY_function_AddLowerAtomicPassrZ   s    r   add_lower_atomic_passz$NewPassManager.add_lower_atomic_pass  rk   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<    LLVMPY_module_AddLowerInvokePass"LLVMPY_function_AddLowerInvokePassrZ   s    r   add_lower_invoke_passz$NewPassManager.add_lower_invoke_pass   rk   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<    LLVMPY_module_AddLowerSwitchPass"LLVMPY_function_AddLowerSwitchPassrZ   s    r   add_lower_switch_passz$NewPassManager.add_lower_switch_pass&  rk   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddMemCpyOptPass LLVMPY_function_AddMemCpyOptPassrZ   s    r   add_mem_copy_opt_passz$NewPassManager.add_mem_copy_opt_pass,  r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   +LLVMPY_module_AddUnifyFunctionExitNodesPass-LLVMPY_function_AddUnifyFunctionExitNodesPassrZ   s    r   "add_unify_function_exit_nodes_passz1NewPassManager.add_unify_function_exit_nodes_pass2  s1    d-.GG??EGGAA$Gr   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<    LLVMPY_module_AddReassociatePass"LLVMPY_function_AddReassociatePassrZ   s    r   add_reassociate_passz#NewPassManager.add_reassociate_pass8  rk   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddRegToMemPassLLVMPY_function_AddRegToMemPassrZ   s    r   add_register_to_memory_passz*NewPassManager.add_register_to_memory_pass>  s1    d-.GG11$7GG33D9r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddSROAPassLLVMPY_function_AddSROAPassrZ   s    r   add_sroa_passzNewPassManager.add_sroa_passD  r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddSinkingPassLLVMPY_function_AddSinkingPassrZ   s    r   add_sinking_passzNewPassManager.add_sinking_passJ  rf   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   !LLVMPY_module_AddTailCallElimPass#LLVMPY_function_AddTailCallElimPassrZ   s    r   add_tail_call_elimination_passz-NewPassManager.add_tail_call_elimination_passP  r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   %LLVMPY_module_AddInstructionNamerPass'LLVMPY_function_AddInstructionNamerPassrZ   s    r   add_instruction_namer_passz)NewPassManager.add_instruction_namer_passV  r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   !LLVMPY_module_AddLoopDeletionPass#LLVMPY_function_AddLoopDeletionPassrZ   s    r   add_loop_deletion_passz%NewPassManager.add_loop_deletion_pass\  r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   'LLVMPY_module_AddLoopStrengthReducePass)LLVMPY_function_AddLoopStrengthReducePassrZ   s    r   add_loop_strength_reduce_passz,NewPassManager.add_loop_strength_reduce_passb  r   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   LLVMPY_module_AddLoopRotatePass!LLVMPY_function_AddLoopRotatePassrZ   s    r   add_loop_rotate_passz#NewPassManager.add_loop_rotate_passh  rp   r   c                     t        | t              r t        j                  j	                  |        y t        j                  j                  |        y r   )r%   r   r   r<   !LLVMPY_DisposeNewModulePassManger#LLVMPY_DisposeNewFunctionPassMangerrZ   s    r   _disposezNewPassManager._disposen  r   r   N)).r4   r5   r6   r[   ra   re   rj   ro   rt   ry   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r
  r  r  r   r   r   rX   rX   r   s    JC9=<=J<@8<<@7;;?66D55G78>B6===;H=:69>B>D<>r   rX   c                        e Zd Zd 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 Zd Zd Zd Zd Zd Zej4                  dfdZ xZS )r   c                 d    |t         j                  j                         }t        |   |       y r   )r   r<   !LLVMPY_CreateNewModulePassManagersuperr[   r.   ptr	__class__s     r   r[   zModulePassManager.__init__w  s'    ;'';;=Cr   c                 B    t         j                  j                  |        y r   )r   r<   LLVMPY_module_AddVerifierPassrZ   s    r   add_verifierzModulePassManager.add_verifier|  s    --d3r   c                 B    t         j                  j                  |        y r   )r   r<   "LLVMPY_module_AddConstantMergePassrZ   s    r   add_constant_merge_passz)ModulePassManager.add_constant_merge_pass      2248r   c                 B    t         j                  j                  |        y r   )r   r<   ,LLVMPY_module_AddDeadArgumentEliminationPassrZ   s    r   add_dead_arg_elimination_passz/ModulePassManager.add_dead_arg_elimination_pass  s    <<TBr   c                 B    t         j                  j                  |        y r   )r   r<   (LLVMPY_module_AddCallGraphDOTPrinterPassrZ   s    r   add_dot_call_graph_printer_passz1ModulePassManager.add_dot_call_graph_printer_pass      88>r   c                 B    t         j                  j                  |        y r   )r   r<   +LLVMPY_module_AddModuleDebugInfoPrinterPassrZ   s    r   add_module_debug_info_passz,ModulePassManager.add_module_debug_info_pass      ;;DAr   c                 B    t         j                  j                  |        y r   )r   r<   "LLVMPY_module_AddAlwaysInlinerPassrZ   s    r   add_always_inliner_passz)ModulePassManager.add_always_inliner_pass  r!  r   c                 B    t         j                  j                  |        y r   )r   r<   2LLVMPY_module_AddReversePostOrderFunctionAttrsPassrZ   s    r   add_rpo_function_attrs_passz-ModulePassManager.add_rpo_function_attrs_pass  s    BB4Hr   c                 B    t         j                  j                  |        y r   )r   r<   LLVMPY_module_AddGlobalDCEPassrZ   s    r   #add_global_dead_code_eliminate_passz5ModulePassManager.add_global_dead_code_eliminate_pass      ..t4r   c                 B    t         j                  j                  |        y r   )r   r<   LLVMPY_module_AddGlobalOptPassrZ   s    r   add_global_opt_passz%ModulePassManager.add_global_opt_pass  r6  r   c                 B    t         j                  j                  |        y r   )r   r<   LLVMPY_module_AddIPSCCPPassrZ   s    r   add_ipsccp_passz!ModulePassManager.add_ipsccp_pass  s    ++D1r   c                 B    t         j                  j                  |        y r   )r   r<    LLVMPY_module_AddInternalizePassrZ   s    r   add_internalize_passz&ModulePassManager.add_internalize_pass  s    006r   c                 B    t         j                  j                  |        y r   )r   r<   "LLVMPY_module_AddLoopExtractorPassrZ   s    r   add_loop_extract_passz'ModulePassManager.add_loop_extract_pass  r!  r   c                 B    t         j                  j                  |        y r   )r   r<   #LLVMPY_module_AddMergeFunctionsPassrZ   s    r   add_merge_functions_passz*ModulePassManager.add_merge_functions_pass      33D9r   c                 B    t         j                  j                  |        y r   )r   r<   #LLVMPY_module_AddPartialInlinerPassrZ   s    r   add_partial_inliner_passz*ModulePassManager.add_partial_inliner_pass  rF  r   c                 B    t         j                  j                  |        y r   )r   r<   !LLVMPY_module_AddStripSymbolsPassrZ   s    r   add_strip_symbols_passz(ModulePassManager.add_strip_symbols_pass  s    11$7r   c                 B    t         j                  j                  |        y r   )r   r<   'LLVMPY_module_AddStripDeadDebugInfoPassrZ   s    r   add_strip_dead_debug_info_passz0ModulePassManager.add_strip_dead_debug_info_pass  s    77=r   c                 B    t         j                  j                  |        y r   )r   r<   (LLVMPY_module_AddStripDeadPrototypesPassrZ   s    r   add_strip_dead_prototype_passz/ModulePassManager.add_strip_dead_prototype_pass  r(  r   c                 B    t         j                  j                  |        y r   )r   r<   &LLVMPY_module_AddStripDebugDeclarePassrZ   s    r   add_strip_debug_declare_passz.ModulePassManager.add_strip_debug_declare_pass      66t<r   c                 B    t         j                  j                  |        y r   )r   r<   )LLVMPY_module_AddStripNonDebugSymbolsPassrZ   s    r    add_strip_non_debug_symbols_passz2ModulePassManager.add_strip_non_debug_symbols_pass  s    99$?r   c                 B    t         j                  j                  |        y r   )r   r<   &LLVMPY_module_AddArgumentPromotionPassrZ   s    r   add_argument_promotion_passz-ModulePassManager.add_argument_promotion_pass  rV  r   c                 B    t         j                  j                  |        y r   )r   r<   +LLVMPY_module_AddPostOrderFunctionAttrsPassrZ   s    r   'add_post_order_function_attributes_passz9ModulePassManager.add_post_order_function_attributes_pass  r,  r     c                 \    t        |      }t        j                  j                  | ||       ya  Add Numba specific Reference count pruning pass.

        Parameters
        ----------
        subpasses_flags : RefPruneSubpasses
            A bitmask to control the subpasses to be enabled.
        subgraph_limit : int
            Limit the fanout pruners to working on a subgraph no bigger than
            this number of basic-blocks to avoid spending too much time in very
            large graphs. Default is 1000. Subject to change in future
            versions.
        N)rM   r   r<   LLVMPY_AddRefPrunePass_moduler.   subpasses_flagssubgraph_limitiflagss       r   add_refprune_passz#ModulePassManager.add_refprune_pass  s$     #?3--dFNKr   r   )r4   r5   r6   r[   r  r   r$  r'  r+  r/  r2  r5  r9  r<  r?  rB  rE  rI  rL  rO  rR  rU  rY  r\  r_  rM   rV   rh  __classcell__r  s   @r   r   r   u  s    
49C?
B9I55279::8>?=@=B 1B0E0E)-Lr   r   c                   @     e Zd Zd fd	Zej
                  dfdZ xZS )r   c                 d    |t         j                  j                         }t        |   |       y r   )r   r<   #LLVMPY_CreateNewFunctionPassManagerr  r[   r  s     r   r[   zFunctionPassManager.__init__  s'    ;''==?Cr   r`  c                 \    t        |      }t        j                  j                  | ||       yrb  )rM   r   r<   LLVMPY_AddRefPrunePass_functionrd  s       r   rh  z%FunctionPassManager.add_refprune_pass  s$     #?3//fnMr   r   )r4   r5   r6   r[   rM   rV   rh  ri  rj  s   @r   r   r     s     1B0E0E)-Nr   r   c                       e Zd Zd fd	Zed        Zej                  d        Zed        Zej                  d        Zed        Zej                  d        Zed        Z	e	j                  d	        Z	ed
        Z
e
j                  d        Z
ed        Zej                  d        Zed        Zej                  d        Zd Z xZS )r   c                     d | _         d | _        || _        || _        t        |   t        j                  j                                y r   )	_speed_level_size_levelr   r   r  r[   r   r<   "LLVMPY_CreatePipelineTuningOptions)r.   r   r   r  s      r   r[   zPipelineTuningOptions.__init__  s<     &$CCEFr   c                     | j                   S r   )rr  rZ   s    r   r   z!PipelineTuningOptions.speed_level  s       r   c                 V    d|cxk  rdk  st        d       t        d      || _        y )Nr      z4Optimization level for speed should be 0, 1, 2, or 3)
ValueErrorrr  r.   values     r   r   z!PipelineTuningOptions.speed_level  s>    EQFH H FH H!r   c                     | j                   S r   )rs  rZ   s    r   r   z PipelineTuningOptions.size_level  s    r   c                     d|cxk  rdk  st        d       t        d      |dk7  r| j                  dk7  rt        d      || _        y )Nr   rO   z0Optimization level for size should be 0, 1, or 2z=Optimization for size should be encoded with speed level == 2)rx  r   rs  ry  s     r   r   z PipelineTuningOptions.size_level  sX    EQOPP OPPA:$**a/OQ Q r   c                 @    t         j                  j                  |       S r   )r   r<   LLVMPY_PTOGetLoopInterleavingrZ   s    r   loop_interleavingz'PipelineTuningOptions.loop_interleaving      ww44T::r   c                 D    t         j                  j                  | |       y r   )r   r<   LLVMPY_PTOSetLoopInterleavingry  s     r   r  z'PipelineTuningOptions.loop_interleaving      --dE:r   c                 @    t         j                  j                  |       S r   )r   r<   LLVMPY_PTOGetLoopVectorizationrZ   s    r   loop_vectorizationz(PipelineTuningOptions.loop_vectorization  s    ww55d;;r   c                 D    t         j                  j                  | |       y r   )r   r<   LLVMPY_PTOSetLoopVectorizationry  s     r   r  z(PipelineTuningOptions.loop_vectorization  s    ..tU;r   c                 @    t         j                  j                  |       S r   )r   r<   LLVMPY_PTOGetSLPVectorizationrZ   s    r   slp_vectorizationz'PipelineTuningOptions.slp_vectorization  r  r   c                 D    t         j                  j                  | |       y r   )r   r<   LLVMPY_PTOSetSLPVectorizationry  s     r   r  z'PipelineTuningOptions.slp_vectorization  r  r   c                 @    t         j                  j                  |       S r   )r   r<   LLVMPY_PTOGetLoopUnrollingrZ   s    r   loop_unrollingz$PipelineTuningOptions.loop_unrolling#  s    ww11$77r   c                 D    t         j                  j                  | |       y r   )r   r<   LLVMPY_PTOSetLoopUnrollingry  s     r   r  z$PipelineTuningOptions.loop_unrolling'  s    **47r   c                 @    t         j                  j                  |       S r   )r   r<   LLVMPY_PTOGetInlinerThresholdrZ   s    r   inlining_thresholdz(PipelineTuningOptions.inlining_threshold+  r  r   c                 D    t         j                  j                  | |       y r   )r   r<   LLVMPY_PTOSetInlinerThresholdry  s     r   r  z(PipelineTuningOptions.inlining_threshold/  r  r   c                 B    t         j                  j                  |        y r   )r   r<   #LLVMPY_DisposePipelineTuningOptionsrZ   s    r   r  zPipelineTuningOptions._dispose3  rF  r   rO   r   )r4   r5   r6   r[   propertyr   setterr   r  r  r  r  r  r  ri  rj  s   @r   r   r     sP   G ! ! " "     ! ! ; ; ; ; < < < < ; ; ; ; 8 8 8 8 ; ; ; ;:r   r   c                   $     e Zd Z fdZd Z xZS )TimePassesHandlerc                 \    t         |   t        j                  j	                                y r   )r  r[   r   r<   LLVMPY_CreateTimePassesHandler)r.   r  s    r   r[   zTimePassesHandler.__init__8  s    ??ABr   c                 B    t         j                  j                  |        y r   )r   r<   LLVMPY_DisposeTimePassesHandlerrZ   s    r   r  zTimePassesHandler._dispose;  s    //5r   )r4   r5   r6   r[   r  ri  rj  s   @r   r  r  7  s    C6r   r  c                   <     e Zd Z fdZd Zd Zd Zd Zd Z xZ	S )r   c                     t         |   t        j                  j	                  ||             || _        || _        d | _        y r   )r  r[   r   r<   LLVMPY_CreatePassBuilder_pto_tm_time_passes_handler)r.   r   r   r  s      r   r[   zPassBuilder.__init__A  s7    99"cBC	$(!r   c                     t        t        j                  j                  | | j                  j
                  | j                  j                              S r   )r   r   r<   $LLVMPY_buildPerModuleDefaultPipeliner  r   r   rZ   s    r   getModulePassManagerz PassBuilder.getModulePassManagerG  s=     GG88dii++TYY-A-AC
 	
r   c                     t        t        j                  j                  | | j                  j
                  | j                  j                              S r   )r   r   r<   *LLVMPY_buildFunctionSimplificationPipeliner  r   r   rZ   s    r   getFunctionPassManagerz"PassBuilder.getFunctionPassManagerM  s=    "GG>>dii++TYY-A-AC
 	
r   c                     | j                   rt        d      t               | _         t        j                  j                  | | j                          y)zEnable the pass timers.

        Raises
        ------
        RuntimeError
            If pass timing is already enabled.
        z!Pass timing can only be done onceN)r  RuntimeErrorr  r   r<   LLVMPY_EnableTimePassesrZ   s    r   start_pass_timingzPassBuilder.start_pass_timingS  s>     $$BCC$5$7!''d.G.GHr   c                     | j                   st        d      t        j                         5 }t        j                  j                  | j                   |       t        |      cddd       S # 1 sw Y   yxY w)a:  Returns the pass timings report and disables the LLVM internal
        timers. Pass timers are enabled by ``start_pass_timing()``. If the
        timers are not enabled, this function will return an empty string.

        Returns
        -------
        res : str
            LLVM generated timing report.
        zPass timing is not enabledN)r  r  r   rG   r<   !LLVMPY_ReportAndDisableTimePassesrI   )r.   rJ   s     r   finish_pass_timingzPassBuilder.finish_pass_timing`  s`     ((;<< 	3GG55))30s8	 	 	s   5A++A4c                 B    t         j                  j                  |        y r   )r   r<   LLVMPY_DisposePassBuilderrZ   s    r   r  zPassBuilder._disposes  s    ))$/r   )
r4   r5   r6   r[   r  r  r  r  r  ri  rj  s   @r   r   r   ?  s"    )

I&0r   r   Nr  )F)ctypesr   r   r   r   r   r   r	   collectionsr
   enumr   llvmlite.bindingr   r   r   r   r    _prunestatsr!   r9   rA   rE   rK   rM   rX   	ObjectRefr   r   r   r  r   r<   r=   argtypesrC   rH   LLVMModulePassManagerRefr  restypeLLVMModuleRefLLVMPassBuilderRefr]   r  rc   rh   rm   r  rr   rv   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r#  r&  r*  r.  r1  r4  r8  r;  r>  rA  rD  rH  rK  rN  rQ  rT  rX  r[  r^  r  rc  LLVMFunctionPassManagerRefrm  LLVMValueRefr^   rd   ri   rn   rs   rw   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r	  r  ro  LLVMPipelineTuningOptionsRefrt  r~  r  r  r  r  r  r  r  r  r  r  r  LLVMTargetMachineRefr  LLVMTimePassesHandlerRefr  r  r  r  r  r  r   r   r   <module>r     s   O O O "   ! : BEB B0$I $*&	1 3 3@> @>FXL~ XLvN#-- N4J:CMM J:Z6 650#-- 50v .5]-CV,L     ))/   %181B0C $ $ - 584P4P ) ) 1   #"3"33 & & / 362N2N1P % % .141M1M0O $ $ -  5# ( ( 1   4# ' ' 0   4# ' ' 0   5# ( ( 1   7# * * 3   4# ' ' 0   8# + + 4   0# # # ,   4# ' ' 0   4# ' ' 0   8# + + 4   /# " " +   3# & & /   3# & & /   7# * * 3   .# ! ! *   .# ! ! *   <# / / 8   -#     )   -#     )   ?# 2 2 ;   /# " " +   0# # # ,   6# ) ) 2   :# - - 6   .# ! ! *   5# ( ( 1   5# ( ( 1   5# ( ( 1   3# & & /   @# 3 3 <   5# ( ( 1   2# % % .   .# ! ! *   1# $ $ -   6# ) ) 2   :# - - 6   6# ) ) 2   <# / / 8   7$ * * 3   A$ 4 4 =   =$ 0 0 9   @$ 3 3 <   7$ * * 3   G$ : : C   3$ & & /   3$ & & /   0$ # # ,   5$ ( ( 1   7$ * * 3   8$ + + 4   8$ + + 4   6$ ) ) 2   <$ / / 8   =$ 0 0 9   ;$ . . 7   >$ 1 1 :   ;$ . . 7   @$ 3 3 <   6# ) ) 2   %2 % % . ""  + + 3 ""C$4$45 ( ( 1
 ""3% & & / ""7% * * 3 ""6% ) ) 2 ""7% * * 3 ""E9, , , 5 ""6& ) ) 2 "":& - - 6 ""2& % % . ""6& ) ) 2 ""6& ) ) 2 "":& - - 6 ""1& $ $ - ""5& ( ( 1 ""5& ( ( 1 ""9& , , 5 ""0& # # , ""0& # # , "">& 1 1 : ""/& " " + ""/& " " + ""A& 4 4 = ""1& $ $ - ""2& % % . ""8& + + 4 ""<& / / 8 ""0& # # , ""7& * * 3 ""7& * * 3 ""7& * * 3 ""5& ( ( 1 ""B& 5 5 > ""7& * * 3 ""4& ' ' 0 ""0& # # , ""3& & & / ""8& + + 4 ""<& / / 8 ""6& ) ) 2 ""8& + + 4 "">& 1 1 : ""8% + + 4 ""E84 ' ' 0 $$  * * 2 17 % % -$$2' % % . $$f2. % % . 28 & & .$$3' & & / $$f3. & & / 17 % % -$$2' % % . $$f2. % % . .4 " " *$$/' " " + $$f/. " " + 16 % % - $$e2- % % . 	%%'  + + 4
 ,/+A+A     ($$-     )
 /2.D.D-F ! ! *     & & .   4# ' ' 0   ,   (   H6 ) ) 2     , , 4 E59* , , 5 ""  2 2 : E5?* 2 2 ;r   