ó
\K]c           @@ su   d  d l  m Z m Z d  d l m Z d  d l m Z m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d „  Z
 d	 S(
   i    (   t   absolute_importt   print_function(   t   ir(   t   Visitort   CallVisitort   FastFloatBinOpVisitorc           B@ s>   e  Z d  Z e d d d d d d g ƒ Z d „  Z d „  Z RS(	   sb   
    A pass to add fastmath flag to float-binop instruction if they don't have
    any flags.
    t   faddt   fsubt   fmult   fdivt   fremt   fcmpc         C@ s   | |  _  d  S(   N(   t   flags(   t   selfR   (    (    s9   lib/python2.7/site-packages/numba/targets/fastmathpass.pyt   __init__   s    c         C@ sI   | j  |  j k rE | j sE x$ |  j D] } | j j | ƒ q% WqE n  d  S(   N(   t   opnamet   float_binopsR   t   append(   R   t   instrt   flag(    (    s9   lib/python2.7/site-packages/numba/targets/fastmathpass.pyt   visit_Instruction   s    	(   t   __name__t
   __module__t   __doc__t	   frozensetR   R   R   (    (    (    s9   lib/python2.7/site-packages/numba/targets/fastmathpass.pyR      s   	t   FastFloatCallVisitorc           B@ s    e  Z d  Z d „  Z d „  Z RS(   sD   
    A pass to change all float function calls to use fastmath.
    c         C@ s   | |  _  d  S(   N(   R   (   R   R   (    (    s9   lib/python2.7/site-packages/numba/targets/fastmathpass.pyR      s    c         C@ sL   | j  t j ƒ  t j ƒ  f k rH x$ |  j D] } | j j | ƒ q+ Wn  d  S(   N(   t   typeR   t	   FloatTypet
   DoubleTypeR   t   fastmatht   add(   R   R   R   (    (    s9   lib/python2.7/site-packages/numba/targets/fastmathpass.pyt
   visit_Call    s    !(   R   R   R   R   R   (    (    (    s9   lib/python2.7/site-packages/numba/targets/fastmathpass.pyR      s   	c         C@ s3   | j  } t | ƒ j |  ƒ t | ƒ j |  ƒ d S(   sC   
    Rewrite the given LLVM module to use fastmath everywhere.
    N(   R   R   t   visitR   (   t   modt   optionsR   (    (    s9   lib/python2.7/site-packages/numba/targets/fastmathpass.pyt   rewrite_module'   s    	N(   t
   __future__R    R   t   llvmliteR   t   llvmlite.ir.transformsR   R   R   R   R#   (    (    (    s9   lib/python2.7/site-packages/numba/targets/fastmathpass.pyt   <module>   s
   