
    shC              
          S SK r S SKJrJrJrJrJrJrJr  S SK	J
r
  S SKJr  S SKJrJr  S SKJr  S SKJr  \" S/ S	Q5      rS
 rS\4S jr " S S\5      rS rS rS r\S    r\S:  a  SSSSSSSSSS.	rO
SSSSSSSS.rS)S jrS r  " S  S!\
RB                  5      r"\#" / S"Q5      r$\#" / S#Q5      r% " S$ S%\
RB                  5      r& " S& S'\
RB                  5      r'S( r(\" \5      /\
RR                  RT                  l+        \\" \5      \" \5      \" \5      \" \5      /\
RR                  RX                  l+        \" \5      /\
RR                  RZ                  l+        \\
RR                  RZ                  l.        \" \5      /\
RR                  R^                  l+        \" \5      /\
RR                  R`                  l+        \/\
RR                  Rb                  l+        \\
RR                  Rb                  l.        \/\
RR                  Rd                  l+        \
Rf                  \
RR                  Rd                  l.        \
Rf                  \" \5      /\
RR                  Rh                  l+        \
Rf                  /\
RR                  Rj                  l+        \
Rf                  \
Rl                  /\
RR                  Rn                  l+        \\
RR                  Rn                  l.        \
Rf                  \
Rl                  \/\
RR                  Rp                  l+        \\
RR                  Rp                  l.        \
Rf                  \
Rl                  /\
RR                  Rr                  l+        \\
RR                  Rr                  l.        \
Rf                  \
Rl                  /\
RR                  Rt                  l+        \\
RR                  Rt                  l.        \
Rf                  \
Rl                  /\
RR                  Rv                  l+        \\
RR                  Rv                  l.        \\" \5      /\
RR                  Rx                  l+        \
Rz                  \
RR                  Rx                  l.        \
Rz                  /\
RR                  R|                  l+        \\
RR                  R|                  l.        \
Rz                  /\
RR                  R~                  l+        \\
RR                  R~                  l.        \
Rz                  \\\\\\\\\/
\
RR                  R                  l+        \
R                  \
RR                  R                  l.        \
R                  /\
RR                  R                  l+        \
R                  \" \5      /\
RR                  R                  l+        \
R                  \/\
RR                  R                  l+        \
R                  \
R                  /\
RR                  R                  l+        \
R                  \
R                  \\" \5      /\
RR                  R                  l+        \
R                  \
RR                  R                  l.        \
R                  /\
RR                  R                  l+        \\
RR                  R                  l.        \
R                  /\
RR                  R                  l+        \\
RR                  R                  l.        \
R                  /\
RR                  R                  l+        \
R                  /\
RR                  R                  l+        \
Rf                  \
RR                  R                  l.        / \
RR                  R                  l+        \\
RR                  R                  l.        g)*    N)POINTERc_char_p
c_longlongc_intc_size_tc_void_p	string_at)ffi)llvm_version_info)_decode_string_encode_string)
namedtuple)opaque_pointers_enabledTriple)ArchSubArchVendorOSEnvObjectFormatc                      [         R                  " 5        n [         R                  R                  U 5        [	        U 5      sSSS5        $ ! , (       d  f       g= f)z
Return a target triple suitable for generating code for the current process.
An example when the default triple from ``get_default_triple()`` is not be
suitable is when LLVM is compiled for 32-bit but the process is executing
in 64-bit mode.
N)r
   OutputStringlibLLVMPY_GetProcessTriplestrouts    l/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/llvmlite/binding/targets.pyget_process_tripler      s7     
			s'',3x 
		   *A


Atriplec                    [         R                  " 5        n[         R                  " 5        n[         R                  " 5        n[         R                  " 5        n[         R                  R                  U R	                  S5      XX45        [        U5      nSnU R                  S5       H)  nUR                  U5      (       d  M  U[        U5      S n  O   [        X[        U5      [        U5      [        U5      [        U 5      5      sSSS5        sSSS5        sSSS5        sSSS5        $ ! , (       d  f       O= fSSS5        O! , (       d  f       O= fSSS5        O! , (       d  f       O= fSSS5        g! , (       d  f       g= f)z2
Return a tuple of the parts of the given triple.
utf8 -N)r
   r   r   LLVMPY_GetTriplePartsencoder   split
startswithlenr   get_object_format)r!   archvendorosenvsubarch_strs          r   get_triple_partsr2      s    
			t&"c&6&6&8C%%fmmF&;&*B	=4yLL%Dt$$s4yz* & dS[#b'#h 1& 9; '9&8  
	&8&8  
		sf   E9EEA&D+	AD+		E	E	E9+
D95E<	E
EE	E9
E-	)E99
Fc                   "    \ rS rSrSrSS jrSrg)
FeatureMap1   zy
Maps feature name to a boolean indicating the availability of the feature.
Extends ``dict`` to add `.flatten()` method.
c                    ^ U(       a  [        U R                  5       5      O[        U R                  5       5      nSSS.mSR                  U4S jU 5       5      $ )a(  
Args
----
sort: bool
    Optional.  If True, the features are sorted by name; otherwise,
    the ordering is unstable between python session due to hash
    randomization.  Defaults to True.

Returns a string suitable for use as the ``features`` argument to
``Target.create_target_machine()``.

+r%   )TF,c              3   R   >#    U  H  u  pS R                  TU   U5      v   M     g7f)z{0}{1}N)format).0kvflag_maps      r   	<genexpr>%FeatureMap.flatten.<locals>.<genexpr>F   s,      .$,DA !Q77$,s   $')sorteditemsiterjoin)selfsortiteratorr>   s      @r   flattenFeatureMap.flatten7   sL     ,06$**,'T$**,5Gc*xx .$,. . 	.     N)T)__name__
__module____qualname____firstlineno____doc__rH   __static_attributes__rK   rJ   r   r4   r4   1   s    
.rJ   r4   c                  `   [         R                  " 5        n [        5       n[         R                  R	                  U 5      (       d  UsSSS5        $ SSS.n[        U 5      nU(       a-  UR                  S5       H  nU(       d  M  X$S      XSS '   M     UsSSS5        $ ! , (       d  f       g= f)a?  
Returns a dictionary-like object indicating the CPU features for current
architecture and whether they are enabled for this CPU.  The key-value pairs
are the feature name as string and a boolean indicating whether the feature
is available.  The returned value is an instance of ``FeatureMap`` class,
which adds a new method ``.flatten()`` for returning a string suitable for
use as the "features" argument to ``Target.create_target_machine()``.

If LLVM has not implemented this feature or it fails to get the information,
this function will raise a RuntimeError exception.
NTF)r7   r%   r8   r      )r
   r   r4   r   LLVMPY_GetHostCPUFeaturesr   r(   )r   outdictr>   contentfeats        r   get_host_cpu_featuresrX   J   s     
			s,ww0055 
	 E*c(c*4(0a(9GH% +  
		s   0B0BB
B-c                      [         R                  " 5        n [         R                  R                  U 5        [	        U 5      sSSS5        $ ! , (       d  f       g= f)zJ
Return the default target triple LLVM is configured to produce code for.
N)r
   r   r   LLVMPY_GetDefaultTargetTripler   r   s    r   get_default_tripler[   c   s7     
			s--c23x 
		r    c                      [         R                  " 5        n [         R                  R                  U 5        [	        U 5      sSSS5        $ ! , (       d  f       g= f)za
Get the name of the host's CPU, suitable for using with
:meth:`Target.create_target_machine()`.
N)r
   r   r   LLVMPY_GetHostCPUNamer   r   s    r   get_host_cpu_namer^   l   s7    
 
			s%%c*3x 
		r       UnknownCOFFDXContainerELFGOFFMachOSPIRVWasmXCOFF)	r   rS                        )r   rS   ri   rj   rk   rl   rm   c                 ~    U c
  [        5       n [        R                  R                  [	        U 5      5      n[
        U   $ )zn
Get the object format for the given *triple* string (or the default
triple if omitted).
A string is returned
)r[   r
   r   LLVMPY_GetTripleObjectFormatr   _object_formats)r!   ress     r   r+   r+      s5     ~#%
''
.
.~f/E
FC3rJ   c                 d    [        [        R                  R                  [	        U 5      5      5      $ )z=
Create a TargetData instance for the given *layout* string.
)
TargetDatar
   r   LLVMPY_CreateTargetDatar   )layouts    r   create_target_datarx      s#     cgg55nV6LMNNrJ   c                   B    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
rg)ru      zo
A TargetData provides structured access to a data layout.
Use :func:`create_target_data` to create instances.
c                     U R                   (       a  g[        R                  " 5        n[        R                  R	                  X5        [        U5      sS S S 5        $ ! , (       d  f       g = f)Nz<dead TargetData>)_closedr
   r   r    LLVMPY_CopyStringRepOfTargetDatar   rE   r   s     r   __str__TargetData.__str__   s?    <<&3GG44T?s8  s   *A
A*c                 :    U R                   R                  U 5        g N)_capiLLVMPY_DisposeTargetDatarE   s    r   _disposeTargetData._dispose   s    

++D1rJ   c                 @    [         R                  R                  X5      $ )z!
Get ABI size of LLVM type *ty*.
)r
   r   LLVMPY_ABISizeOfTyperE   tys     r   get_abi_sizeTargetData.get_abi_size   s     ww++D55rJ   c                     [         R                  R                  XU5      nUS:X  a$  [        SR	                  U[        U5      5      5      eU$ )z<
Get byte offset of type's ty element at the given position
zQCould not determined offset of {}th element of the type '{}'. Is it a structtype?)r
   r   LLVMPY_OffsetOfElement
ValueErrorr:   r   )rE   r   positionoffsets       r   get_element_offsetTargetData.get_element_offset   sL    
 //(CR< %%+VHc"g%>@ @ rJ   c                 @    [         R                  R                  X5      $ )z.
Get minimum ABI alignment of LLVM type *ty*.
)r
   r   LLVMPY_ABIAlignmentOfTyper   s     r   get_abi_alignmentTargetData.get_abi_alignment   s     ww00::rJ   c                     [         (       a  [        S5      e[        R                  R	                  X5      nUS:X  a  [        SU< 35      eU$ )z9
Get ABI size of pointee type of LLVM pointer type *ty*.
/Cannot get pointee type in opaque pointer mode.r   Not a pointer type: )r   RuntimeErrorr
   r   LLVMPY_ABISizeOfElementTyperE   r   sizes      r   get_pointee_abi_sizeTargetData.get_pointee_abi_size   sJ     #"  ' ( (ww224<2:2?@@rJ   c                     [         (       a  [        S5      e[        R                  R	                  X5      nUS:X  a  [        SU< 35      eU$ )zF
Get minimum ABI alignment of pointee type of LLVM pointer type *ty*.
r   r   r   )r   r   r
   r    LLVMPY_ABIAlignmentOfElementTyper   s      r   get_pointee_abi_alignment$TargetData.get_pointee_abi_alignment   sJ     #"  ' ( (ww77A2:2?@@rJ   rK   N)rL   rM   rN   rO   rP   r   r   r   r   r   r   r   rQ   rK   rJ   r   ru   ru      s*    
26
;

rJ   ru   )defaultstaticpicdynamicnopic)r   
jitdefaultsmallkernelmediumlargec                   ~    \ rS rSrSr\S 5       r\S 5       r\S 5       r	\S 5       r
\S 5       rS r   SS	 jrS
rg)Target   r$   c                 8    [        5       nU R                  U5      $ )z2
Create a Target instance for the default triple.
)r[   from_triple)clsr!   s     r   from_default_tripleTarget.from_default_triple   s    
 $%v&&rJ   c                    [         R                  " 5        n[         R                  R                  UR	                  S5      U5      nU(       d  [        [        U5      5      eU " U5      nXl        UsSSS5        $ ! , (       d  f       g= f)z;
Create a Target instance for the given triple (a string).
r#   N)r
   r   r   LLVMPY_GetTargetFromTripler'   r   r   _triple)r   r!   outerrtargets       r   r   Target.from_triple   sd    
 6WW77f8M8>@F"3v;//[F#N  s   AA::
Bc                 V    [         R                  R                  U 5      n[        U5      $ r   )r
   r   LLVMPY_GetTargetNamer   rE   ss     r   nameTarget.name  s!    GG((.a  rJ   c                 V    [         R                  R                  U 5      n[        U5      $ r   )r
   r   LLVMPY_GetTargetDescriptionr   r   s     r   descriptionTarget.description  s!    GG//5a  rJ   c                     U R                   $ r   )r   r   s    r   r!   Target.triple  s    ||rJ   c                 N    SR                  U R                  U R                  5      $ )Nz<Target {0} ({1})>)r:   r   r   r   s    r   r   Target.__str__  s    #**499d6F6FGGrJ   c	                    SUs=::  a  S::  d   e   eU[         ;   d   eU[        ;   d   eU R                  n	[        R                  S:X  a  US:X  a  U	S-  n	[
        R                  R                  U [        U	5      [        U5      [        U5      U[        U5      [        U5      [        U5      [        U5      [        U5      5
      n
U
(       a  [        U
5      $ [        S5      e)a  
Create a new TargetMachine for this target and the given options.

Specifying codemodel='default' will result in the use of the "small"
code model. Specifying codemodel='jitdefault' will result in the code
model being picked based on platform bitness (32="small", 64="large").

The `printmc` option corresponds to llvm's `-print-machineinstrs`.

The `jit` option should be set when the target-machine is to be used
in a JIT engine.

The `abiname` option specifies the ABI. RISC-V targets with hard-float
needs to pass the ABI name to LLVM.
r   rj   ntr   z-elfzCannot create target machine)RELOC	CODEMODELr   r.   r   r
   r   LLVMPY_CreateTargetMachiner   intTargetMachiner   )rE   cpufeaturesoptreloc	codemodelprintmcjitabinamer!   tms              r   create_target_machineTarget.create_target_machine  s    $ C}1}}}~~I%%% 77d?yL8fFWW//0>v0F0>s0C0>x0H030>u0E0>y0I03G03C0>w0G
2  $$=>>rJ   rK   N)r$   r$   ri   r   r   FFr$   )rL   rM   rN   rO   r   classmethodr   r   propertyr   r   r!   r   r   rQ   rK   rJ   r   r   r      s    G
 ' '   ! ! ! !  H 68@L@B)?rJ   r   c                   \    \ rS rSrS rS rS rS rS rSS jr	\
S 5       r\
S	 5       rS
rg)r   iD  c                 :    U R                   R                  U 5        g r   )r   LLVMPY_DisposeTargetMachiner   s    r   r   TargetMachine._disposeF  s    

..t4rJ   c                 B    [         R                  R                  X5        g)zG
Register analysis passes for this target machine with a pass manager.
N)r
   r   LLVMPY_AddAnalysisPasses)rE   pms     r   add_analysis_passes!TargetMachine.add_analysis_passesI  s     	((2rJ   c                 B    [         R                  R                  X5        g)z
Set whether this target machine will emit assembly with human-readable
comments describing control flow, debug information, and so on.
N)r
   r   #LLVMPY_SetTargetMachineAsmVerbosity)rE   verboses     r   set_asm_verbosityTargetMachine.set_asm_verbosityO  s    
 	33DBrJ   c                 "    U R                  USS9$ )zm
Represent the module as a code object, suitable for use with
the platform's linker.  Returns a byte string.
T
use_object)_emit_to_memoryrE   modules     r   emit_objectTargetMachine.emit_objectV  s    
 ##Ft#<<rJ   c                 4    [        U R                  USS95      $ )zx
Return the raw assembler of the module, as a string.

llvm.initialize_native_asmprinter() must have been called first.
Fr   )r   r   r   s     r   emit_assemblyTargetMachine.emit_assembly]  s     d226e2LMMrJ   c                    [         R                  " 5        n[         R                  R                  X[	        U5      U5      nU(       d  [        [        U5      5      e SSS5        [         R                  R                  W5      n[         R                  R                  U5      n [        XV5      [         R                  R                  U5        $ ! , (       d  f       Nw= f! [         R                  R                  U5        f = f)zReturns bytes of object code of the module.

Args
----
use_object : bool
    Emit object code or (if False) emit assembly code.
N)r
   r   r    LLVMPY_TargetMachineEmitToMemoryr   r   r   LLVMPY_GetBufferStartLLVMPY_GetBufferSizer	   LLVMPY_DisposeMemoryBuffer)rE   r   r   r   mbbufptrbufszs          r   r   TargetMachine._emit_to_memorye  s     699$:=j/:@BB "3v;// 	   ..r2,,R0	3V+GG..r2   GG..r2s   AC$
C 
C!D c                 R    [        [        R                  R                  U 5      5      $ r   )ru   r
   r   LLVMPY_CreateTargetMachineDatar   s    r   target_dataTargetMachine.target_data{  s    #''@@FGGrJ   c                     [         R                  " 5        n[         R                  R                  X5        [	        U5      sS S S 5        $ ! , (       d  f       g = fr   )r
   r   r   LLVMPY_GetTargetMachineTripler   r~   s     r   r!   TargetMachine.triple  s5    3GG11$<s8  r    rK   N)F)rL   rM   rN   rO   r   r   r   r   r   r   r   r  r!   rQ   rK   rJ   r   r   r   D  sL    53C=N3, H H  rJ   r   c                  J    [         R                  R                  5       S:X  a  gg)z?
Returns True if SVML was enabled at FFI support compile time.
r   FT)r
   r   LLVMPY_HasSVMLSupportrK   rJ   r   has_svmlr    s     ww$$&!+rJ   r   )Or.   ctypesr   r   r   r   r   r   r	   llvmlite.bindingr
   llvmlite.binding.initfinir   llvmlite.binding.commonr   r   collectionsr   llvmliter   r   r   r   r2   dictr4   rX   r[   r^   llvm_version_majorrr   r+   rx   	ObjectRefru   	frozensetr   r   r   r   r  r   r   argtypesr&   rT   restyperZ   r]   rq   rv   LLVMTargetDataRefr}   r   LLVMTypeRefr   r   r   r   r   r   LLVMTargetRefr   r   r   LLVMTargetMachineRefr   r  r   LLVMPassManagerRefr   LLVMModuleRefr   LLVMMemoryBufferRefr   r   r   r  r
  rK   rJ   r   <module>r     s   	) ) ) ! 7 B " -	H < 
=	;S ;&. .22 'q)  
O O	 O> >B 	>?   !	V?S]] V?r?CMM ?D -4H,=+>   (*2GH4E*1(*;WX=N*1(*;*=   & /6h.?-@ ! ! *,1 ! ! )29(2C1D % % .*1(*;)<   &19
 $ $ -/4 $ $ ,,4:   (*-*?*?   ' H5 ( ( 1 -     ) *-)>)>),):   %'1   $+.+@+@+.??+0+2   ' *4   &.1.C.C.1oo.? ! ! *,6 ! ! ) 140E0E030A # # ,.8 # # + 695J5J58__5F ( ( 13= ( ( 0/79J.K " " +-0->-> " " *),):):(;   %'/   $030A0A/B # # ,.6 # # + 			'/ " " +* .1-E-E " " *030H0H/I # # ,252J2J29(2C2E % % . e8% + + 4 -     ) 	H	5 ( ( 1 473J3J ( ( 0*-*A*A)B   &(0   %),)@)@(A   %'/   $/2/F/F.G " " + 3 & & / 251F1F & & .)+   &(-   %rJ   