Advertisement
Guest User

Untitled

a guest
Feb 10th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.43 KB | None | 0 0
  1. from rpython.jit.backend.llsupport.llmodel import AbstractLLCPU
  2. from rpython.rtyper.lltypesystem import rffi, lltype
  3. from rpython.rtyper.lltypesystem.rffi import str2constcharp
  4. from rpython.translator.tool.cbuild import ExternalCompilationInfo
  5.  
  6. class LLVM_CPU(AbstractLLCPU):
  7.     def __init__(self, rtyper, stats, opts=None, translate_support_code=False, gcdescr=None):
  8.         AbstractLLCPU.__init__(self, rtyper, stats, opts, translate_support_code, gcdescr)
  9.  
  10.         self.initialise_api()
  11.         if not self.InitializeNativeTarget(None):
  12.             raise Exception
  13.  
  14.  
  15.  
  16.     def initialise_api(self):
  17.         header_files = ["Core","ExecutionEngine","Target","Analysis","BitWriter","DataTypes","BitReader","Comdat","DebugInfo","Disassembler","DisassemblerTypes","Error","ErrorHandling","ExternC","IRReader","Initialization","LinkTimeOptimizer","Linker","Object","Orc","OrcBindings","Remarks","Support","TargetMachine","Types"]
  18.         llvm_c = ["llvm-c/"+f+".h" for f in header_files]
  19.         cflags = ["-I/usr/lib/llvm/11/include  -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS","-L/usr/lib/llvm/11/lib64"]
  20.         info = ExternalCompilationInfo(includes=llvm_c, libraries=["LLVM-11"], include_dirs=["/usr/    lib/llvm/11/lib64"], compile_extra=cflags, link_extra=cflags)
  21.  
  22.         self.InitializeNativeTarget = rffi.llexternal("LLVMInitializeNativeTarget", [self.Void], self.Bool, compilation_info=info)
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement