a
    –§»a®	  ã                   @   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
 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)ÚRegistry)Ú	nvvmutilsé   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   úN/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/numba/cuda/printimpl.pyÚ
print_item   s    ÿr   c                 C   s:   | t jv rd}t j}n
d}t j}| ||| |¡}||gfS )Nz%lluz%lld)r   Zunsigned_domainZuint64Ú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   Úfloat64)r
   r   r   r   r   r   r   r   Úreal_print_impl'   s    r   c                 C   s.   | j }t|tƒsJ ‚d}| ||¡}||gfS )Nz%s)Zliteral_valueÚ
isinstanceÚstrÚ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 ||¡}t ||¡}t  |j¡}| ||| |t¡f¡ |  ¡ S )z½This 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.ú Ú
)r   Zdeclare_vprintÚmoduleÚ	enumerateÚzipÚargsr   ÚappendÚextendÚjoinr   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   ÚfmtÚarrayZarrayptrr   r   r   Úprint_varargs6   s    
r.   N)Ú	functoolsr   Zllvmliter   Z
numba.corer   r   Znumba.core.imputilsr   Z
numba.cudar   ÚregistryÚlowerZPointerTypeZIntTyper&   r   ÚregisterZIntegerZIntegerLiteralr   ZFloatr   ZStringLiteralr   ÚprintZVarArgÚAnyr.   r   r   r   r   Ú<module>   s$   







