U
    ?h
                     @   s   d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ e
 ZejZeedZed	d
 Zeejeejdd Zeejdd Zeejdd Zeeeejdd Z dS )    )singledispatch)ir)typescgutils)NumbaWarning)Registry)	nvvmutils)warn   c                 C   s   t d| f dS )z
    Handle printing of a single value of the given Numba type.
    A (format string, [list of arguments]) is returned that will allow
    forming the final printf()-like call.
    z,printing unimplemented for values of type %sN)NotImplementedError)tycontextbuilderval r   F/var/www/html/venv/lib/python3.8/site-packages/numba/cuda/printimpl.py
print_item   s    r   c                 C   s:   | t jkrd}t j}n
d}t j}|||| |}||gfS )Nz%lluz%lld)r   Zunsigned_domainZuint64Zint64cast)r   r   r   r   rawfmtZdsttypelldr   r   r   int_print_impl   s    
r   c                 C   s   | ||| tj}d|gfS )Nz%f)r   r   Zfloat64)r   r   r   r   r   r   r   r   real_print_impl)   s    r   c                 C   s.   | j }t|tstd}|||}||gfS )Nz%s)Zliteral_value
isinstancestrAssertionErrorinsert_string_const_addrspace)r   r   r   ZsigvalZpyvalr   r   r   r   r   const_print_impl/   s
    r   c                 C   s   t |j}g }g }tt|j|D ]2\}\}}	t|| ||	\}
}||
 || q$d	|d }t
|dkrd}t|t |dd}| ||}t||}t||}t |j}|||||tf |  S )zThis function is a generic 'print' wrapper for arbitrary types.
    It dispatches to the appropriate 'print' implementations above
    depending on the detected real types in the signature. 
    zjCUDA print() cannot print more than 32 items. The raw format string will be emitted by the kernel instead.%z%%)r   Zdeclare_vprintmodule	enumeratezipargsr   appendextendjoinlenr	   r   replacer   r   Zmake_anonymous_structZalloca_once_valuecallZbitcastvoidptrZget_dummy_value)r   r   sigr$   ZvprintformatsvaluesiZargtypeargvalZargfmtZargvalsr   msgfmtarrayZarrayptrr   r   r   print_varargs8   s$    

r4   N)!	functoolsr   Zllvmliter   Z
numba.corer   r   Znumba.core.errorsr   Znumba.core.imputilsr   Z
numba.cudar   warningsr	   registrylowerZPointerTypeZIntTyper+   r   registerIntegerZIntegerLiteralr   Floatr   ZStringLiteralr   printZVarArgAnyr4   r   r   r   r   <module>   s(   







