B
      ›\ÿ  ã               @   sX   d dl mZmZ d dlmZ d dlmZmZ G dd„ deƒZG dd„ deƒZ	dd	„ Z
d
S )é    )Úabsolute_importÚprint_function)Úir)ÚVisitorÚCallVisitorc               @   s,   e Zd ZdZeddddddgƒZdd	„ Zd
S )ÚFastFloatBinOpVisitorzb
    A pass to add fastmath flag to float-binop instruction if they don't have
    any flags.
    ZfaddZfsubZfmulZfdivZfremZfcmpc             C   s"   |j | jkr|js|j d¡ d S )NÚfast)ÚopnameÚfloat_binopsÚflagsÚappend)ÚselfÚinstr© r   ú9lib/python3.7/site-packages/numba/targets/fastmathpass.pyÚvisit_Instruction   s    z'FastFloatBinOpVisitor.visit_InstructionN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	frozensetr
   r   r   r   r   r   r      s   r   c               @   s   e Zd ZdZdd„ ZdS )ÚFastFloatCallVisitorzD
    A pass to change all float function calls to use fastmath.
    c             C   s&   |j t ¡ t ¡ fkr"|j d¡ d S )Nr   )Útyper   Z	FloatTypeZ
DoubleTypeZfastmathÚadd)r   r   r   r   r   Ú
visit_Call   s    zFastFloatCallVisitor.visit_CallN)r   r   r   r   r   r   r   r   r   r      s   r   c             C   s   t ƒ  | ¡ tƒ  | ¡ dS )zC
    Rewrite the given LLVM module to use fastmath everywhere.
    N)r   Zvisitr   )Úmodr   r   r   Úrewrite_module   s    r   N)Z
__future__r   r   Zllvmliter   Zllvmlite.ir.transformsr   r   r   r   r   r   r   r   r   Ú<module>   s
   
