B
      ›\)
  ã               @   sä   d dl mZmZmZ d dlmZmZ d dlmZm	Z	m
Z
mZ d dlmZ ddlmZ eƒ ZejZe e d¡¡Zej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 )é    )Úprint_functionÚabsolute_importÚdivision)ÚTypeÚConstant)ÚtypesÚtypingÚcgutilsÚutils)Ú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   ú3lib/python3.7/site-packages/numba/cuda/printimpl.pyÚ
print_item   s    r   c             C   sF   | t jkrd}t j}n
d}t j}| ||¡}| ||| |¡}||gfS )Nz%lluz%lld)r   Zunsigned_domainZuint64Zint64Úinsert_string_const_addrspaceÚcast)r   r   r   r   ÚrawfmtZdsttypeÚfmtÚ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ÚAssertionErrorr   )r   r   r   ZsigvalZpyvalr   r   r   r   r   Úconst_print_impl.   s
    r!   c             C   sº   t  |j¡}g }g }xFtt|j|ƒƒD ]2\}\}}	t|| ||	ƒ\}
}| |
¡ | |¡ q&W 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_valueZcallZbitcastÚvoidptrZget_dummy_value)r   r   Zsigr'   ZvprintZformatsÚvaluesÚiZargtypeZargvalZargfmtZargvalsr   r   ZarrayZarrayptrr   r   r   Úprint_varargs7   s    
r.   N)#Z
__future__r   r   r   Zllvmlite.llvmpy.corer   r   Znumbar   r   r	   r
   Znumba.targets.imputilsr   Ú r   ÚregistryÚlowerZpointerÚintr+   Úsingledispatchr   ÚregisterZIntegerZIntegerLiteralr   ZFloatr   ZStringLiteralr!   ÚprintZVarArgZAnyr.   r   r   r   r   Ú<module>   s   
	