Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from rpython.jit.backend.llsupport.llmodel import AbstractLLCPU
- from rpython.rtyper.lltypesystem import rffi, lltype
- from rpython.rtyper.lltypesystem.rffi import str2constcharp
- from rpython.translator.tool.cbuild import ExternalCompilationInfo
- class LLVM_CPU(AbstractLLCPU):
- def __init__(self, rtyper, stats, opts=None, translate_support_code=False, gcdescr=None):
- AbstractLLCPU.__init__(self, rtyper, stats, opts, translate_support_code, gcdescr)
- self.initialise_api()
- if not self.InitializeNativeTarget(None):
- raise Exception
- def initialise_api(self):
- 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"]
- llvm_c = ["llvm-c/"+f+".h" for f in header_files]
- 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"]
- info = ExternalCompilationInfo(includes=llvm_c, libraries=["LLVM-11"], include_dirs=["/usr/ lib/llvm/11/lib64"], compile_extra=cflags, link_extra=cflags)
- self.InitializeNativeTarget = rffi.llexternal("LLVMInitializeNativeTarget", [self.Void], self.Bool, compilation_info=info)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement