o
    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.
    )faddfsubfmulfdivfremfcmpc                 C   
   || _ d S Nflagsselfr    r   T/home/ubuntu/veenaModal/venv/lib/python3.10/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   	FloatType
DoubleTyper   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)llvmliter   llvmlite.ir.transformsr   r   r   r"   r,   r   r   r   r   <module>   s
    