o
    1Æ&iç  ã                   @   sH   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 )
é    )Úir)ÚVisitorÚCallVisitorc                   @   s,   e Zd ZdZeg d¢ƒZdd„ 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   ó
   || _ d S ©N©Úflags©Úselfr	   © r   úBC:\wamp64\www\opt\env\Lib\site-packages\numba/core/fastmathpass.pyÚ__init__   ó   
zFastFloatBinOpVisitor.__init__c                 C   s6   |j | jv r|js| jD ]}|j |¡ qd S d S d S r   )ÚopnameÚfloat_binopsr	   Úappend©r   ÚinstrÚflagr   r   r   Úvisit_Instruction   s   
ýz'FastFloatBinOpVisitor.visit_InstructionN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	frozensetr   r   r   r   r   r   r   r      s
    r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚFastFloatCallVisitorzD
    A pass to change all float function calls to use fastmath.
    c                 C   r   r   r   r
   r   r   r   r      r   zFastFloatCallVisitor.__init__c                 C   s6   |j t ¡ t ¡ fv r| jD ]
}|j |¡ qd S d S r   )Útyper   Z	FloatTypeZ
DoubleTyper	   ZfastmathÚaddr   r   r   r   Ú
visit_Call   s
   
þzFastFloatCallVisitor.visit_CallN)r   r   r   r   r   r   r   r   r   r   r      s    r   c                 C   s&   |j }t|ƒ | ¡ t|ƒ | ¡ dS )zC
    Rewrite the given LLVM module to use fastmath everywhere.
    N)r	   r   Úvisitr   )ÚmodÚoptionsr	   r   r   r   Úrewrite_module%   s   r#   N)Zllvmliter   Zllvmlite.ir.transformsr   r   r   r   r#   r   r   r   r   Ú<module>   s
    