U
    £½|eÍ;  ã                   @   s”  d dl mZmZmZmZmZmZmZ d dlZd dl	m
Z
 d dlmZmZ G dd„ dejƒZG dd„ dejƒZG d	d
„ d
ejƒZG dd„ de
jƒZG dd„ de
jƒZG dd„ de
jƒZG dd„ de
jƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZe
jeeƒge
jj_ e
jge
jj!_ e
j"e
jj!_#e
jge
jj$_ ee
jj$_#e
jege
jj%_ e
jge
jj&_ e
j'e
jj&_#e
j'ge
jj(_ ee
jj(_#e
j'ge
jj)_ ee
jj)_#e
j'ge
jj*_ e
j'e
jj*_#e
j'ge
jj+_ ee
jj+_#e
jge
jj,_ ee
jj,_#e
jege
jj-_ e
jge
jj._ ee
jj._#e
jege
jj/_ e
jge
jj0_ ee
jj0_#e
jege
jj1_ eege
jj2_ ee
jj2_#e
jege
jj3_ e
jge
jj4_ ee
jj4_#e
jge
jj5_ e
j6e
jj5_#e
jge
jj7_ e
j6e
jj7_#e
jge
jj8_ e
j6e
jj8_#e
jge
jj9_ e
j:e
jj9_#e
jge
jj;_ e
j:e
jj;_#e
jge
jj<_ e
j=e
jj<_#e
jge
jj>_ e
j?e
jj>_#e
jge
jj@_ e
jAe
jj@_#e
jge
jjB_ e
jCe
jjB_#e
j6ge
jjD_ e
j:ge
jjE_ e
j=ge
jjF_ e
jAge
jjG_ e
jCge
jjH_ e
j6ge
jjI_ ee
jjI_#e
j:ge
jjJ_ ee
jjJ_#e
j=ge
jjK_ e
je
jjK_#e
j?ge
jjL_ e
je
jjL_#e
jAge
jjM_ e
je
jjM_#e
jCge
jjN_ e
je
jjN_#e
jge
jjO_ ee
jjO_#dS )é    )ÚPOINTERÚc_char_pÚc_intÚc_size_tÚc_uintÚc_boolÚc_void_pN)Úffi)Ú_decode_stringÚ_encode_stringc                   @   sP   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdS )ÚLinkager   é   é   é   é   é   é   é   é   é	   é
   é   é   é   é   é   é   N)Ú__name__Ú
__module__Ú__qualname__ZexternalZavailable_externallyZlinkonce_anyZlinkonce_odrZlinkonce_odr_autohideZweak_anyZweak_odrZ	appendingÚinternalÚprivateÚ	dllimportÚ	dllexportZexternal_weakZghostÚcommonZlinker_privateZlinker_private_weak© r%   r%   úS/var/www/website-v5/atlas_env/lib/python3.8/site-packages/llvmlite/binding/value.pyr      s"   r   c                   @   s   e Zd ZdZdZdZdS )Ú
Visibilityr   r   r   N)r   r   r   ÚdefaultÚhiddenÚ	protectedr%   r%   r%   r&   r'      s   r'   c                   @   s   e Zd ZdZdZdZdS )ÚStorageClassr   r   r   N)r   r   r   r(   r"   r#   r%   r%   r%   r&   r+   &   s   r+   c                   @   s<   e Zd ZdZedd„ ƒZedd„ ƒZedd„ ƒZdd	„ Zd
S )ÚTypeRefz$A weak reference to a LLVM type
    c                 C   s   t  t j | ¡¡S )z
        Get type name
        )r	   Ú
ret_stringÚlibÚLLVMPY_GetTypeName©Úselfr%   r%   r&   Úname1   s    zTypeRef.namec                 C   s   t j | ¡S )z=
        Returns true is the type is a pointer type.
        )r	   r.   ÚLLVMPY_TypeIsPointerr0   r%   r%   r&   Ú
is_pointer8   s    zTypeRef.is_pointerc                 C   s$   | j std | ¡ƒ‚ttj | ¡ƒS )zh
        Returns the pointed-to type. When the type is not a pointer,
        raises exception.
        zType {} is not a pointer)r4   Ú
ValueErrorÚformatr,   r	   r.   ÚLLVMPY_GetElementTyper0   r%   r%   r&   Úelement_type?   s    zTypeRef.element_typec                 C   s   t  t j | ¡¡S ©N)r	   r-   r.   ÚLLVMPY_PrintTyper0   r%   r%   r&   Ú__str__I   s    zTypeRef.__str__N)	r   r   r   Ú__doc__Úpropertyr2   r4   r8   r;   r%   r%   r%   r&   r,   .   s   


	r,   c                   @   sh  e Zd ZdZdd„ Zdd„ Zedd„ ƒZedd	„ ƒZed
d„ ƒZ	edd„ ƒZ
edd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZejdd„ ƒZedd„ ƒZejdd„ ƒZed d!„ ƒZejd"d!„ ƒZed#d$„ ƒZejd%d$„ ƒZd&d'„ Zed(d)„ ƒZed*d+„ ƒZed,d-„ ƒZed.d/„ ƒZed0d1„ ƒZed2d3„ ƒZed4d5„ ƒZed6d7„ ƒZd8S )9ÚValueRefz&A weak reference to a LLVM value.
    c                 C   s   || _ || _tj | |¡ d S r9   )Ú_kindÚ_parentsr	   Ú	ObjectRefÚ__init__)r1   ÚptrÚkindÚparentsr%   r%   r&   rB   Q   s    zValueRef.__init__c              
   C   s6   t  ¡ �$}t j | |¡ t|ƒW  5 Q R £ S Q R X d S r9   )r	   ÚOutputStringr.   ÚLLVMPY_PrintValueToStringÚstr)r1   Úoutstrr%   r%   r&   r;   V   s    
zValueRef.__str__c                 C   s   | j  d¡S )zV
        The module this function or global variable value was obtained from.
        Úmodule©r@   Úgetr0   r%   r%   r&   rJ   [   s    zValueRef.modulec                 C   s   | j  d¡S )zT
        The function this argument or basic block value was obtained from.
        ÚfunctionrK   r0   r%   r%   r&   rM   b   s    zValueRef.functionc                 C   s   | j  d¡S )zE
        The block this instruction value was obtained from.
        ÚblockrK   r0   r%   r%   r&   rN   i   s    zValueRef.blockc                 C   s   | j  d¡S )zG
        The instruction this operand value was obtained from.
        ÚinstructionrK   r0   r%   r%   r&   rO   p   s    zValueRef.instructionc                 C   s
   | j dkS )NÚglobal©r?   r0   r%   r%   r&   Ú	is_globalw   s    zValueRef.is_globalc                 C   s
   | j dkS )NrM   rQ   r0   r%   r%   r&   Úis_function{   s    zValueRef.is_functionc                 C   s
   | j dkS )NrN   rQ   r0   r%   r%   r&   Úis_block   s    zValueRef.is_blockc                 C   s
   | j dkS )NÚargumentrQ   r0   r%   r%   r&   Úis_argumentƒ   s    zValueRef.is_argumentc                 C   s
   | j dkS )NrO   rQ   r0   r%   r%   r&   Úis_instruction‡   s    zValueRef.is_instructionc                 C   s
   | j dkS )NÚoperandrQ   r0   r%   r%   r&   Ú
is_operand‹   s    zValueRef.is_operandc                 C   s   t tj | ¡ƒS r9   )r
   r	   r.   ÚLLVMPY_GetValueNamer0   r%   r%   r&   r2   �   s    zValueRef.namec                 C   s   t j | t|ƒ¡ d S r9   )r	   r.   ÚLLVMPY_SetValueNamer   )r1   Úvalr%   r%   r&   r2   “   s    c                 C   s   t tj | ¡ƒS r9   )r   r	   r.   ÚLLVMPY_GetLinkager0   r%   r%   r&   Úlinkage—   s    zValueRef.linkagec                 C   s$   t |tƒst| }tj | |¡ d S r9   )Ú
isinstancer   r	   r.   ÚLLVMPY_SetLinkage©r1   Úvaluer%   r%   r&   r^   ›   s    
c                 C   s   t tj | ¡ƒS r9   )r'   r	   r.   ÚLLVMPY_GetVisibilityr0   r%   r%   r&   Ú
visibility¡   s    zValueRef.visibilityc                 C   s$   t |tƒst| }tj | |¡ d S r9   )r_   r'   r	   r.   ÚLLVMPY_SetVisibilityra   r%   r%   r&   rd   ¥   s    
c                 C   s   t tj | ¡ƒS r9   )r+   r	   r.   ÚLLVMPY_GetDLLStorageClassr0   r%   r%   r&   Ústorage_class«   s    zValueRef.storage_classc                 C   s$   t |tƒst| }tj | |¡ d S r9   )r_   r+   r	   r.   ÚLLVMPY_SetDLLStorageClassra   r%   r%   r&   rg   ¯   s    
c                 C   s\   | j std| jf ƒ‚t|ƒ}tj t|ƒt|ƒ¡}|dkrJtd 	|¡ƒ‚tj 
| |¡ dS )z{Only works on function value

        Parameters
        -----------
        attr : str
            attribute name
        úexpected function value, got %sr   zno such attribute {!r}N)rS   r5   r?   rH   r	   r.   Ú"LLVMPY_GetEnumAttributeKindForNamer   Úlenr6   ÚLLVMPY_AddFunctionAttr)r1   ÚattrÚattrnameZattrvalr%   r%   r&   Úadd_function_attributeµ   s     ÿzValueRef.add_function_attributec                 C   s   t tj | ¡ƒS )z)
        This value's LLVM type.
        )r,   r	   r.   ÚLLVMPY_TypeOfr0   r%   r%   r&   ÚtypeÆ   s    zValueRef.typec                 C   s(   | j s| jstd| jf ƒ‚tj | ¡S )zb
        Whether this value (presumably global) is defined in the current
        module.
        z)expected global or function value, got %s)rR   rS   r5   r?   r	   r.   ÚLLVMPY_IsDeclarationr0   r%   r%   r&   Úis_declarationÎ   s
    ÿzValueRef.is_declarationc                 C   s¤   t dƒ}| jr$tj | ¡}t|ƒ}n|| jrj| jdkrJtj | ¡}t|ƒ}q | jdkr tj 	| ¡}t|ƒ}n6| j
r†tj | ¡}t|ƒ}n| jr tj | ¡}t|ƒ}|S )z
        Return an iterator over this value's attributes.
        The iterator will yield a string for each attribute.
        r%   ÚcallZinvoke)ÚiterrS   r	   r.   ÚLLVMPY_FunctionAttributesIterÚ_AttributeListIteratorrW   ÚopcodeÚLLVMPY_CallInstAttributesIterÚLLVMPY_InvokeInstAttributesIterrR   ÚLLVMPY_GlobalAttributesIterÚ_AttributeSetIteratorrV   ÚLLVMPY_ArgumentAttributesIter)r1   ÚitrÚitr%   r%   r&   Ú
attributesÙ   s$    





zValueRef.attributesc                 C   sB   | j std| jf ƒ‚tj | ¡}| j ¡ }|j| d� t	||ƒS )z|
        Return an iterator over this function's blocks.
        The iterator will yield a ValueRef for each block.
        ri   ©rM   )
rS   r5   r?   r	   r.   ÚLLVMPY_FunctionBlocksIterr@   ÚcopyÚupdateÚ_BlocksIterator©r1   r   rE   r%   r%   r&   Úblocksò   s    
zValueRef.blocksc                 C   sB   | j std| jf ƒ‚tj | ¡}| j ¡ }|j| d� t	||ƒS )z‚
        Return an iterator over this function's arguments.
        The iterator will yield a ValueRef for each argument.
        ri   r�   )
rS   r5   r?   r	   r.   ÚLLVMPY_FunctionArgumentsIterr@   rƒ   r„   Ú_ArgumentsIteratorr†   r%   r%   r&   Ú	argumentsÿ   s    
zValueRef.argumentsc                 C   sB   | j std| jf ƒ‚tj | ¡}| j ¡ }|j| d� t	||ƒS )z…
        Return an iterator over this block's instructions.
        The iterator will yield a ValueRef for each instruction.
        zexpected block value, got %s)rN   )
rT   r5   r?   r	   r.   ÚLLVMPY_BlockInstructionsIterr@   rƒ   r„   Ú_InstructionsIteratorr†   r%   r%   r&   Úinstructions  s    
zValueRef.instructionsc                 C   sB   | j std| jf ƒ‚tj | ¡}| j ¡ }|j| d� t	||ƒS )zƒ
        Return an iterator over this instruction's operands.
        The iterator will yield a ValueRef for each operand.
        ú"expected instruction value, got %s)rO   )
rW   r5   r?   r	   r.   ÚLLVMPY_InstructionOperandsIterr@   rƒ   r„   Ú_OperandsIteratorr†   r%   r%   r&   Úoperands  s    ÿ
zValueRef.operandsc                 C   s(   | j std| jf ƒ‚t tj | ¡¡S )NrŽ   )rW   r5   r?   r	   r-   r.   ÚLLVMPY_GetOpcodeNamer0   r%   r%   r&   rx   '  s
    ÿzValueRef.opcodeN)r   r   r   r<   rB   r;   r=   rJ   rM   rN   rO   rR   rS   rT   rV   rW   rY   r2   Úsetterr^   rd   rg   ro   rq   rs   r€   r‡   rŠ   r�   r‘   rx   r%   r%   r%   r&   r>   M   sp   

























r>   c                   @   s,   e Zd ZdZdd„ Zdd„ ZeZdd„ ZdS )Ú_ValueIteratorNc                 C   s6   t j | |¡ || _| jd kr2tdt| ƒjf ƒ‚d S )Nz%s must specify kind attribute)r	   rA   rB   r@   rD   ÚNotImplementedErrorrq   r   )r1   rC   rE   r%   r%   r&   rB   4  s    

ÿz_ValueIterator.__init__c                 C   s$   |   ¡ }|rt|| j| jƒS t‚d S r9   )Ú_nextr>   rD   r@   ÚStopIteration©r1   Úvpr%   r%   r&   Ú__next__<  s    z_ValueIterator.__next__c                 C   s   | S r9   r%   r0   r%   r%   r&   Ú__iter__E  s    z_ValueIterator.__iter__)r   r   r   rD   rB   rš   Únextr›   r%   r%   r%   r&   r”   /  s
   r”   c                   @   s    e Zd Zdd„ ZeZdd„ ZdS )Ú_AttributeIteratorc                 C   s   |   ¡ }|r|S t‚d S r9   )r–   r—   r˜   r%   r%   r&   rš   K  s    z_AttributeIterator.__next__c                 C   s   | S r9   r%   r0   r%   r%   r&   r›   T  s    z_AttributeIterator.__iter__N)r   r   r   rš   rœ   r›   r%   r%   r%   r&   r�   I  s   r�   c                   @   s   e Zd Zdd„ Zdd„ ZdS )rw   c                 C   s   | j  | ¡ d S r9   )Ú_capiÚLLVMPY_DisposeAttributeListIterr0   r%   r%   r&   Ú_disposeZ  s    z_AttributeListIterator._disposec                 C   s   t  t j | ¡¡S r9   )r	   Ú	ret_bytesr.   ÚLLVMPY_AttributeListIterNextr0   r%   r%   r&   r–   ]  s    z_AttributeListIterator._nextN©r   r   r   r    r–   r%   r%   r%   r&   rw   X  s   rw   c                   @   s   e Zd Zdd„ Zdd„ ZdS )r|   c                 C   s   | j  | ¡ d S r9   )rž   ÚLLVMPY_DisposeAttributeSetIterr0   r%   r%   r&   r    c  s    z_AttributeSetIterator._disposec                 C   s   t  t j | ¡¡S r9   )r	   r¡   r.   ÚLLVMPY_AttributeSetIterNextr0   r%   r%   r&   r–   f  s    z_AttributeSetIterator._nextNr£   r%   r%   r%   r&   r|   a  s   r|   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )r…   rN   c                 C   s   | j  | ¡ d S r9   )rž   ÚLLVMPY_DisposeBlocksIterr0   r%   r%   r&   r    n  s    z_BlocksIterator._disposec                 C   s   t j | ¡S r9   )r	   r.   ÚLLVMPY_BlocksIterNextr0   r%   r%   r&   r–   q  s    z_BlocksIterator._nextN©r   r   r   rD   r    r–   r%   r%   r%   r&   r…   j  s   r…   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )r‰   rU   c                 C   s   | j  | ¡ d S r9   )rž   ZLLVMPY_DisposeArgumentsIterr0   r%   r%   r&   r    y  s    z_ArgumentsIterator._disposec                 C   s   t j | ¡S r9   )r	   r.   ÚLLVMPY_ArgumentsIterNextr0   r%   r%   r&   r–   |  s    z_ArgumentsIterator._nextNr¨   r%   r%   r%   r&   r‰   u  s   r‰   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )rŒ   rO   c                 C   s   | j  | ¡ d S r9   )rž   ÚLLVMPY_DisposeInstructionsIterr0   r%   r%   r&   r    „  s    z_InstructionsIterator._disposec                 C   s   t j | ¡S r9   )r	   r.   ÚLLVMPY_InstructionsIterNextr0   r%   r%   r&   r–   ‡  s    z_InstructionsIterator._nextNr¨   r%   r%   r%   r&   rŒ   €  s   rŒ   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )r�   rX   c                 C   s   | j  | ¡ d S r9   )rž   ÚLLVMPY_DisposeOperandsIterr0   r%   r%   r&   r    �  s    z_OperandsIterator._disposec                 C   s   t j | ¡S r9   )r	   r.   ÚLLVMPY_OperandsIterNextr0   r%   r%   r&   r–   ’  s    z_OperandsIterator._nextNr¨   r%   r%   r%   r&   r�   ‹  s   r�   )PÚctypesr   r   r   r   r   r   r   ÚenumÚllvmlite.bindingr	   Úllvmlite.binding.commonr
   r   ÚIntEnumr   r'   r+   rA   r,   r>   r”   r�   rw   r|   r…   r‰   rŒ   r�   ÚLLVMValueRefr.   rG   ÚargtypesZLLVMPY_GetGlobalParentÚLLVMModuleRefÚrestyperZ   r[   rp   ÚLLVMTypeRefr:   r3   r7   r/   r]   r`   rc   re   rf   rh   rj   rl   rr   rv   ÚLLVMAttributeListIteratorry   rz   r{   ÚLLVMAttributeSetIteratorr}   r‚   ÚLLVMBlocksIteratorrˆ   ÚLLVMArgumentsIteratorr‹   ÚLLVMInstructionsIteratorr�   ÚLLVMOperandsIteratorrŸ   r¤   r¦   rª   r¬   r¢   r¥   r§   r©   r«   r­   r’   r%   r%   r%   r&   Ú<module>   s®   $ c		þ









ÿ


