
    J/Ph                         d 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 d Zd Zd Z G d	 d
e          Z G d de          Z e            ZdS )zD
Register external C functions necessary for Numba code generation.
    N)ir)utils
intrinsics)
_helperlibc                 \    t          j        |           st          j        | |           dS dS )z1Add missing symbol into LLVM internal symtab
    N)lladdress_of_symbol
add_symbol)symboladdrs     T/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/core/externals.py_add_missing_symbolr      s9     '' $
fd#####$ $    c                 b    ddl m}m}m} t	          |j        |           } |||          j        S )zr
    Under Windows, look up a symbol inside the C runtime
    and return the raw pointer value as an integer.
    r   )cdllcastc_void_p)ctypesr   r   r   getattrmsvcrtvalue)r   r   r   r   fs        r   _get_msvcrt_symbolr      sH    
 ,+++++++++V$$A48""r   c           
      	   |                                  }|                    d          }|                    d          }t          j        d          }t          j        d          }t          j        |d          }t          j        |d          }t          j        |d          }t          j        |||g          }	t          j        ||	d          }
|
j        \  }}|
	                                }t          j
        |          }|                    ||          }|                    ||          }|                    |                    ||          |          }|                    |                    ||          |          }|                    |                    ||          |                    ||                    }|                    ||          }|                    ||          }|                    ||                    |                    ||          |                    ||                              }|                    ||                    ||                    }|                    ||          }|                    ||          }|                    ||          }|                    ||                    |                    ||          |                    ||                              }|                    ||                    ||                    }|                    ||                    ||                    }|                    ||                    |                    ||          |                    ||                              }|                    ||                    ||                    }|                    ||                    ||                    }|                    ||          }|                    ||                    |                    ||          |                    }|                    |           |                    |           |                                 |S )zo
    Compile the multi3() helper function used by LLVM
    for 128-bit multiplication on 32-bit platforms.
    multi3@      l        )name)codegencreate_librarycreate_ir_moduler   IntTypeConstantFunctionTypeFunctionargsappend_basic_block	IRBuildertruncashrmuland_lshraddshlzextretadd_ir_modulefinalize)contextr    libraryir_modi64i128
lower_mask_32_64fn_typefnabbbbuilderalblahbhrltrhrs                          r   compile_multi3rK      s   
 ooG$$X..G%%h//F
*R..C:c??DS*--J
+c2

C
+dB

CodT4L11G	VW8	4	4	4B7DAq				 	 Bl2G 
q#		B	q#		B	w||As++S	1	1B	w||As++S	1	1B 
W\\"j117<<J3O3O	P	PBRA	b*	%	%BAw{{7<<C#8#8#*<<J#?#?A A 	B 	BA 
RQ,,	-	-B	a		BRA	b*	%	%BAw{{7<<C#8#8#*<<J#?#?A A 	B 	BA 
RQ,,	-	-B	Ra--	.	.B	RW\\"c%:%:%,\\"c%:%:< < 
= 
=B 
RR,,	-	-B	RR,,	-	-B 	RAAw{{7<<D#9#93??@@AKKNNN&!!!Nr   c                       e Zd ZdZd ZdS )
_InstallerFc                 P    | j         s|                     |           d| _         dS dS )z
        Install the functions into LLVM.  This only needs to be done once,
        as the mappings are persistent during the process lifetime.
        TN)
_installed_do_install)selfr5   s     r   installz_Installer.installl   s7    
  	#W%%%"DOOO	# 	#r   N)__name__
__module____qualname__rO   rR    r   r   rM   rM   h   s(        J# # # # #r   rM   c                       e Zd ZdZd ZdS )_ExternalMathFunctionszd
    Map the math functions from the C runtime library into the LLVM
    execution environment.
    c                 6   t           j        dk    }t          j        }t          j                            d          r"|r t          d          }t          d|           nMt          j                            d          r.|r,t          d|d                    t          d|d	                    |rBt          |          | _
        | j
                            d
          }|sJ t          d|           t          j        D ]}t          j        |||                    d S )Nr   win32_ftol_ftol2linux__fixunsdfdifptoui__fixunssfdifptouifr   __multi3)r   MACHINE_BITSr   	c_helperssysplatform
startswithr   r   rK   _multi3_libget_pointer_to_functionr   	INTR_MATHr   r
   )rQ   r5   is32bitrd   ftolptrfnames          r   rP   z"_ExternalMathFunctions._do_install|   s&   $*(	<""7++ 		F 		F &g..D$////\$$W-- 	F' 	F	(0CDDD	)0DEEE 	1-g66D"::8DDCJJJ
C000  ) 	3 	3E
 M%5!12222	3 	3r   N)rS   rT   rU   __doc__rP   rV   r   r   rX   rX   v   s-         
3 3 3 3 3r   rX   )ro   re   llvmliter   llvmlite.bindingbindingr   
numba.corer   r   numbar   r   r   rK   objectrM   rX   c_math_functionsrV   r   r   <module>rw      s    


             ( ( ( ( ( ( ( (      $ $ $# # #F F FR# # # # # # # #"3 "3 "3 "3 "3Z "3 "3 "3J *)++   r   