search for: existingmoduleprovid

Displaying 20 results from an estimated 98 matches for "existingmoduleprovid".

Did you mean: existingmoduleprovider
2010 Jan 09
4
[LLVMdev] Using a function from another module
...m trying to use a function defined in one LLVM module from another module (in the JIT) but for some reason it's not working out. My sequence of activity is roughly like this: 1) Create moduleA 2) Create moduleB with "func()" 3) execEng = ExecutionEngine::create( new ExistingModuleProvider(moduleB)); 4) execute "func()" (this works fine) 4) add "func()" to moduleA as a declaration (no code blocks) with External linkage. 5) execEng->addModuleProvider(new ExistingModuleProvider(moduleA)); 6) run a function in moduleA that calls "func()"...
2008 Dec 19
2
[LLVMdev] strange behaviour after extracting optimization pass code
...vm-function in a llvm-module and put it into a separate function for better readability. The original code looks like follows (and works as expected): ----------------------------- std::string functionName = "main"; llvm::Module* mod = some arbitrary valid modulepointer; llvm::ExistingModuleProvider mp(mod); llvm::FunctionPassManager fpm(&mp); fpm.add(new llvm::TargetData(mod)); fpm.add(llvm::createInstructionCombiningPass()); fpm.add(llvm::createReassociatePass()); fpm.add(llvm::createGVNPass()); fpm.add(llvm::createCFGSimplificationPass()); fpm.run(*f); //...ge...
2005 Apr 11
2
[LLVMdev] JIT and array pointers
...alue *pbuff = ?? // -> %pbuff = external global [4096 x uint] Value *ptr = new GetElementPtrInst (pbuff, c0, c0, "ptr", b); // -> %ptr = getelementptr [4096 x uint]* %buff, int 0, int 0 new StoreInst (c2, ptr, b); // -> store uint 2, uint* %ptr new ReturnInst (b); ExistingModuleProvider *mp = new ExistingModuleProvider (m); ExecutionEngine *ee = ExecutionEngine::create (mp, false); cout << "constructed module:\n\n" << *m << "\n\n"; vector <GenericValue> args; GenericValue ret = ee->runFunction (f, args); printf ("b...
2008 Aug 19
7
[LLVMdev] Please help with LLVM C++ integration
...an error("Tied to execute an unknown external function"), where I am wrong? Thanks in advance. Kirill. int some_test_func( int ){ std::cout << "!!!!" << std::endl; return 8848; } int _tmain(int argc, _TCHAR* argv[]){ Module *M = new Module("test"); ExistingModuleProvider* MP = new ExistingModuleProvider(M); ExecutionEngine* EE = ExecutionEngine::create(MP, false); std::vector<const Type *> func_args; func_args.push_back(Type::Int32Ty); FunctionType * func_type = FunctionType::get(Type::Int32Ty, func_args, false); Function * my_function = Function::Cre...
2008 Dec 19
0
[LLVMdev] strange behaviour after extracting optimization pass code
...am doing wrong. > Basically all I've done is extracting code for optimization of a > llvm-function in a llvm-module and put it into a separate function > for better readability. The original code looks like follows (and > works as expected): Hi Ralf, Your problem is that the ExistingModuleProvider takes ownership of the Module, deleting it when it goes out of scope. You would see the same behavior if you just offset the code with an unnamed block as shown below. The fix is simply to leave the 'mp' variable in the caller so it doesn't go out of scope before you're do...
2007 Nov 08
3
[LLVMdev] Newbie JITter
...dynamically generated assembler source to machine code, and I have that all working, copied from the llc tool and the JIT example. I have two questions: 1. What optimization passes, if any, should I run on the module before I pass it to the ExecutionEngine. 2. Do I need to retain the Module/ExistingModuleProvider, once I've built the ExecutionEngine and have a Function object. Or is there some simpler way to store/call the native code block? An unrelated question: I want to dump the native assembler form of the code generated by the JIT. Currently I dump it using some code I adapted from llc,...
2004 Aug 13
3
[LLVMdev] is this code really JITed and/or optimized ? ..
...and > see what happens. If you're not getting the JIT, try stepping through the > LLVM program to see where it makes the execution engine and decides which > one to use... (thanks for quick reply) hm, here is the part of my code starting LLVM function: /////////////////////////// ExistingModuleProvider* MP = new ExistingModuleProvider(M); ExecutionEngine* EE = ExecutionEngine::create( MP, true ); // Call the `foo' function with no arguments: std::vector<GenericValue> noargs; GenericValue gv = EE->runFunction(FooF, noargs); /////////////////////////// for LLVM developers n...
2010 Jan 10
0
[LLVMdev] Using a function from another module
...in one LLVM module from another module > (in the JIT) but for some reason it's not working out. My sequence of > activity is roughly like this: > > 1) Create moduleA > 2) Create moduleB with "func()" > 3) execEng = ExecutionEngine::create( > new ExistingModuleProvider(moduleB)); > 4) execute "func()" (this works fine) > 4) add "func()" to moduleA as a declaration (no code blocks) with External > linkage. > 5) execEng->addModuleProvider(new ExistingModuleProvider(moduleA)); > 6) run a function in moduleA that c...
2008 Feb 28
1
[LLVMdev] Are multiple execution engines allowed?
...instances of ExecutionEngines, so that the state from the first test doesn't alter the second state. Right now I'm doing something along the lines of: Module *emptyModule = new Module("emptyModule"); ExecutionEngine executionEngine = ExecutionEngine::create(emptyModule); ExistingModuleProvider moduleProvider = new ExistingModuleProvider(module from disk); executionEngine->addModuleProvider(); ////tests executionEngine->removeModuleProvider delete executionEngine ExecutionEngine executionEngine = ExecutionEngine::create(empty...
2006 Apr 13
2
[LLVMdev] standalone llvm
...*AsmString = "; ModuleID = 'test'\n\ \n\ implementation ; Functions:\n\ \n\ int %add1(int %AnArg) {\n\ EntryBlock:\n\ %addresult = add int 1, %AnArg ; <int> [#uses=1]\n\ ret int %addresult\n\ }\n\ "; M = ParseAssemblyString(AsmString, NULL); ExistingModuleProvider* MP = new ExistingModuleProvider(M); ExecutionEngine* EE = ExecutionEngine::create(MP, false); std::cout << "We just constructed this LLVM module:\n\n" << *M; Function *F = M->getNamedFunction("add1"); assert(F!=NULL); int (*add1)(int); add1 = (...
2004 Nov 26
2
[LLVMdev] Running specific passes
...of some analysis, I need to change the program and then invoke Mem2Reg pass. That pass, in turn, requires other analysis, so I must use PassManager. Here's the code I ended up with: bool runOnFunction(llvm::Function& m) { visit(m); ExistingModuleProvider mp(m.getParent()); FunctionPassManager pm(&mp); ..... //m.add(createPromoteMemoryToRegister()); pm.run(m); There are several problems, though: 1. This looks inefficient -- the analyses necessary for Mem2Reg will be run again, even if they are...
2007 Jul 15
2
[LLVMdev] JIT Leaks?
...Function *F = cast<Function>(M->getOrInsertFunction("F", Type::Int32Ty, (Type*)0)); BasicBlock *BB = new BasicBlock("BB",F); new ReturnInst( ConstantInt::get(Type::Int32Ty,1), BB ); std::vector<GenericValue> Args(0); ExistingModuleProvider *MP = new ExistingModuleProvider(M); ExecutionEngine *EE = ExecutionEngine::create(MP, false); GenericValue GV = EE->runFunction(F, Args); delete EE; } } The memory goes up, and OS X leaks command returns pages of: Leak: 0x011036b0 size=16 0x00000000...
2010 Jan 10
2
[LLVMdev] Using a function from another module
...nother module >> (in the JIT) but for some reason it's not working out.  My sequence of >> activity is roughly like this: >> >>   1) Create moduleA >>   2) Create moduleB with "func()" >>   3) execEng = ExecutionEngine::create( >>          new ExistingModuleProvider(moduleB)); >>   4) execute "func()" (this works fine) >>   4) add "func()" to moduleA as a declaration (no code blocks) with External >>      linkage. >>   5) execEng->addModuleProvider(new ExistingModuleProvider(moduleA)); >>   6) run a functi...
2005 Apr 11
0
[LLVMdev] JIT and array pointers
...bal [4096 x uint] pbuff = BuffGV; > Value *ptr = new GetElementPtrInst (pbuff, c0, c0, "ptr", b); > // -> %ptr = getelementptr [4096 x uint]* %buff, int 0, int 0 > new StoreInst (c2, ptr, b); > // -> store uint 2, uint* %ptr > new ReturnInst (b); > > ExistingModuleProvider *mp = new ExistingModuleProvider (m); > ExecutionEngine *ee = ExecutionEngine::create (mp, false); Tell the EE that buffGV -> buff: ee->addGlobalMapping(BuffGV, buff); Then you should be good to go! -Chris > cout << "constructed module:\n\n" << *m <<...
2008 Aug 19
0
[LLVMdev] Please help with LLVM C++ integration
...t; > Thanks in advance. > Kirill. > > int some_test_func( int ){ > std::cout << "!!!!" << std::endl; > return 8848; > } > > int _tmain(int argc, _TCHAR* argv[]){ > > Module *M = new Module("test"); > ExistingModuleProvider* MP = new ExistingModuleProvider(M); > ExecutionEngine* EE = ExecutionEngine::create(MP, false); > > std::vector<const Type *> func_args; > func_args.push_back(Type::Int32Ty); > FunctionType * func_type = FunctionType::get(Type::Int32Ty, > f...
2008 Aug 19
0
[LLVMdev] Please help with LLVM C++ integration
.... > Thanks in advance. > Kirill. > > int some_test_func( int ){ > std::cout << "!!!!" << std::endl; > return 8848; > } > > int _tmain(int argc, _TCHAR* argv[]){ > > Module *M = new Module("test"); > ExistingModuleProvider* MP = new ExistingModuleProvider(M); > ExecutionEngine* EE = ExecutionEngine::create(MP, false); > > std::vector<const Type *> func_args; > func_args.push_back(Type::Int32Ty); > FunctionType * func_type = FunctionType::get(Type::Int32Ty, func_a...
2008 Mar 04
1
[LLVMdev] [PATCH] Prefer to use *.opt ocaml executables as they are more efficient.
I noticed that the ocaml compilation isn't using the .opt executables if they're available. We might gain a slight optimization in ocaml compile time by optionally using them with this patch. --- autoconf/configure.ac | 18 +++++ configure | 195 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 188 insertions(+), 25 deletions(-) -------------- next part
2008 Mar 04
0
[LLVMdev] [PATCH] Cleanup the c and ocaml binding documentation.
...); > > /* Operations on integer types */ > @@ -546,13 +552,13 @@ LLVMValueRef > LLVMBuildShuffleVector(LLVMBuilderRef, LLVMValueRef V1, > > /* Encapsulates the module M in a module provider, taking ownership > of the > * module. > - * See the constructor > llvm::ExistingModuleProvider::ExistingModuleProvider. > + * See the constructor > [llvm::ExistingModuleProvider::ExistingModuleProvider]. > */ > LLVMModuleProviderRef > LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M); > > /* Destroys the module provider MP as well as the contained module. &...
2008 Dec 19
1
[LLVMdev] strange behaviour after extracting optimization pass code
...function in a llvm-module and put it into a separate function for better readability. The original code looks like follows (and works as expected): ----------------------------- std::string functionName = "main"; llvm::Module* mod = some arbitrary valid modulepointer; llvm::ExistingModuleProvider mp(mod); llvm::FunctionPassManager fpm(&mp); fpm.add(new llvm::TargetData(mod)); fpm.add(llvm::createInstructionCombiningPass()); fpm.add(llvm::createReassociatePass()); fpm.add(llvm::createGVNPass()); fpm.add(llvm::createCFGSimplificationPass()); fpm.run(*f);...
2008 Mar 04
1
[LLVMdev] [PATCH] Cleanup the c and ocaml binding documentation.
--- bindings/ocaml/llvm/llvm.ml | 2 +- bindings/ocaml/llvm/llvm.mli | 2 +- bindings/ocaml/llvm/llvm_ocaml.c | 2 +- include/llvm-c/Core.h | 32 +++++++++++++++++++------------- 4 files changed, 22 insertions(+), 16 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 316a84e85ed2363551149e65a227c8e7c8192624.diff Type: