Esempio n. 1
0
 def new(module, force_interpreter=False):
     core.check_is_module(module)
     _util.check_is_unowned(module)
     ret = _core.LLVMCreateExecutionEngine(module.ptr, int(force_interpreter))
     if isinstance(ret, str):
         raise llvm.LLVMException(ret)
     return ExecutionEngine(ret, module)
Esempio n. 2
0
 def new(module, force_interpreter=False):
     core.check_is_module(module)
     _util.check_is_unowned(module)
     ret = _core.LLVMCreateExecutionEngine(module.ptr,
                                           int(force_interpreter))
     if isinstance(ret, str):
         raise llvm.LLVMException, ret
     return ExecutionEngine(ret, module)
Esempio n. 3
0
    def test_enginebuilder_basic(self):
        module = self.make_test_module()
        ee = EngineBuilder.new(module).create()

        with self.assertRaises(LLVMException):
            # Ensure the module is owned.
            _util.check_is_unowned(module)

        self.run_foo(ee, module)
Esempio n. 4
0
 def add(self, pass_obj):
     '''Add a pass to the pass manager.
     
     pass_obj --- Either a Pass instance, a string name of a pass
     '''
     if isinstance(pass_obj, Pass):
         _util.check_is_unowned(pass_obj)
         _core.LLVMAddPass(self.ptr, pass_obj.ptr)
         pass_obj._own(self) # PassManager owns the pass
     elif _util.isstring(pass_obj):
         self._add_pass(pass_obj)
     else:
         raise llvm.LLVMException("invalid pass_id (%s)" % pass_obj)
Esempio n. 5
0
 def create(self, tm=None):
     '''
     tm --- Optional. Provide a TargetMachine.  Ownership is transfered
            to the returned execution engine.
     '''
     if tm:
         _util.check_is_unowned(tm)
         ret = _core.LLVMEngineBuilderCreateTM(self.ptr, tm.ptr)
     else:
         ret = _core.LLVMEngineBuilderCreate(self.ptr)
     if isinstance(ret, str):
         raise llvm.LLVMException(ret)
     engine = ExecutionEngine(ret, self._module)
     if tm:
         tm._own(owner=engine)
     return engine
Esempio n. 6
0
    def create(self, tm=None):
        """
        tm --- Optional. Provide a TargetMachine.  Ownership is transfered
               to the returned execution engine.
        """
        if not self.__has_mattrs and FORCE_DISABLE_AVX:
            self.mattrs("-avx")

        if tm:
            _util.check_is_unowned(tm)
            ret = _core.LLVMEngineBuilderCreateTM(self.ptr, tm.ptr)
        else:
            ret = _core.LLVMEngineBuilderCreate(self.ptr)
        if isinstance(ret, str):
            raise llvm.LLVMException(ret)
        engine = ExecutionEngine(ret, self._module)
        if tm:
            tm._own(owner=llvm.DummyOwner)
        return engine
Esempio n. 7
0
 def new(module):
     core.check_is_module(module)
     _util.check_is_unowned(module)
     obj = _core.LLVMCreateEngineBuilder(module.ptr)
     return EngineBuilder(obj, module)
Esempio n. 8
0
 def new(module):
     core.check_is_module(module)
     _util.check_is_unowned(module)
     obj = _core.LLVMCreateEngineBuilder(module.ptr)
     return EngineBuilder(obj, module)