search for: getnamedfunction

Displaying 18 results from an estimated 18 matches for "getnamedfunction".

2004 Dec 21
3
[LLVMdev] Help with code
Hi, I have this call instruction to printf inserted which is causing an assertion failure. Any pointers to where I am wrong : Code Dump : Function *printFn=M.getNamedFunction(std::string("printf")); Constant *str=ConstantArray::get("Value : %d\n"); std::vector<Value *> Args(2); std::vector<Constant *> GEPIndices(2); GEPIndices[0]=Constant::getNullValue(Type::LongTy); GEPIndices[1]=Constant::getNullValue(Type::LongTy); Args[0]=ConstantExpr...
2006 Mar 23
0
[LLVMdev] Re: LLVM JIT questions
...o > what I want? As you probably know, ParseAssemblyString isn't the most efficient way to do this. That said, if you really want to use it, and if you know what functions you're parsing, you should be able to get away with something like this (pseudo code): 1. Function *F = M->getNamedFunction("add1"); 2. F->setName(""); // now it won't conflict 3. ParseAssemblyString(.., M); 4. Function *F2 = M->getNamedFunction("add1"); 5. F->replaceAllUsesWith(F2); // Everything using the old one uses the new one 6. F->eraseFromParent(); // also, take...
2004 Dec 21
0
[LLVMdev] Help with code
On Tue, Dec 21, 2004 at 03:45:33PM -0700, Sriraman Tallam wrote: > I have this call instruction to printf inserted which is causing > an assertion failure. Any pointers to where I am wrong : > > Function *printFn=M.getNamedFunction(std::string("printf")); std::string() is unnecessary here as it's implicit. > Constant *str=ConstantArray::get("Value : %d\n"); > std::vector<Value *> Args(2); > std::vector<Constant *> GEPIndices(2); > GEPIndices[0]=Constant::getNullValue(Type::Lon...
2006 May 05
2
[LLVMdev] ExecutionEngine blew the stack ?
On Fri, 5 May 2006, Simon Burton wrote: > This leads me to my next question: as I make more and more functions > with the EE, it slows down. I am re-using the Module, ExistingModuleProvider, > and ExecutionEngine, and pumping the parser like so: > M = ParseAssemblyString(AsmString, M); > ISTM that there should be a way of creating multiple modules/EEs but I ran > into trouble
2006 May 05
0
[LLVMdev] ExecutionEngine blew the stack ?
...ultiple modules/EEs but I ran > > into trouble when I tried that (some time ago). > > Can you quantify what you mean? How does it "slow down"? It slows in the construction phase, so one of these calls: M = ParseAssemblyString(AsmString, M); verifyModule( *M ) M->getNamedFunction(name); EE->getPointerToFunction It feels like there is a linear name lookup going on somewhere. (will be able to do report more thorough timings later) Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 02 6249 6940 http://arrowtheory.com
2006 May 05
1
[LLVMdev] ExecutionEngine blew the stack ?
On Fri, 5 May 2006 16:43:13 +1000 Simon Burton <simon at arrowtheory.com> wrote: > > It slows in the construction phase, so one of these calls: > M = ParseAssemblyString(AsmString, M); > verifyModule( *M ) > M->getNamedFunction(name); > EE->getPointerToFunction > > It feels like there is a linear name lookup going on somewhere. it's verifyModule (of course). As the module grows, it takes longer to verify. So, I will disable this for now. Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canber...
2006 Apr 13
2
[LLVMdev] standalone llvm
...ult\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 = (int (*)(int))EE->getPointerToFunction(F); std::cout << "Got:" << add1(55) << "\n"; // <----------- Bombs here <--------------- return 0; } -- Simon Burton, B.Sc. Licensed...
2004 Dec 21
3
[LLVMdev] Help with code
...po. On Tue, 21 Dec 2004, Misha Brukman wrote: > On Tue, Dec 21, 2004 at 03:45:33PM -0700, Sriraman Tallam wrote: > > I have this call instruction to printf inserted which is causing > > an assertion failure. Any pointers to where I am wrong : > > > > Function *printFn=M.getNamedFunction(std::string("printf")); > > std::string() is unnecessary here as it's implicit. > > > Constant *str=ConstantArray::get("Value : %d\n"); > > std::vector<Value *> Args(2); > > std::vector<Constant *> GEPIndices(2); > > GEPIndices[0]...
2006 Apr 13
0
[LLVMdev] standalone llvm
On Thu, 13 Apr 2006, Simon Burton wrote: > > Is it possible to get llvm to generate native machine code > without using gcc and friends ? Do I use lli ? LLVM only needs llvm-gcc to translate from C/C++ to LLVM IR. If you already have code in LLVM IR form (e.g. because you're generating it on the fly or you have your own front-end) you don't need llvm-gcc. > I'd like to
2006 Apr 13
0
[LLVMdev] Re: standalone llvm
Simon Burton <simon at arrowtheory.com> writes: > I'm trying to take assembly and create machine code I can execute. > How close am I ? Your test case is not complete. Besides, which version of llvm are you using? What are the commands for compiling and linking your test case? How it bombs? Do you #include "llvm/ExecutionEngine/JIT.h" ? -- Oscar
2004 Apr 14
0
[LLVMdev] FunctionPassManager Issue
.../Pass.cpp 9 Feb 2004 00:59:07 -0000 1.55 @@ -91,8 +91,6 @@ void FunctionPassManager::add(FunctionPass *P) { PM->add(P); } void FunctionPassManager::add(ImmutablePass *IP) { PM->add(IP); } bool FunctionPassManager::run(Function &F) { - Function *mF = MP->getModule()->getNamedFunction(F.getName()); - assert((&F == mF) && "ModuleProvider does not contain this function!"); MP->materializeFunction(&F); return PM->run(F); } -Chris > Chris Lattner wrote: > > >On Wed, 14 Apr 2004, Alex Li wrote: > > > > > >>I&...
2007 May 17
8
[LLVMdev] Antw.: 2.0 Pre-release tarballs online
...he parent BasicBlock's iterator the only solution? * The same goes for BasicBlock::getNext()/Prev(). Is iterating through the parent Function's iterator the only solution? * CallInst's constructors do not accept vectors anymore, but a double pointer (!) instead. Why? * Module::getNamedFunction() is now called Module::getFunction(). * llvm/Transforms/Utils/Cloning.h's CloneFunctionInto() needs a DenseMap as its third argument instead of an STL map. * Pass's constructor now needs an intptr_t as explained in the updated "Write your first pass"-document. * In my o...
2006 Apr 14
2
[LLVMdev] Re: standalone llvm
...ule: " << verifyModule( *M ) << "\n"; 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 = (int (*)(int))EE->getPointerToFunction(F); std::cout << "Got:" << add1(55) << "\n"; return 0; }
2006 Apr 13
4
[LLVMdev] standalone llvm
Is it possible to get llvm to generate native machine code without using gcc and friends ? Do I use lli ? I'd like to directly create executable code that i can stick in memory somewhere and jump into (call). (I'm looking to use llvm in a BSD licensed project). Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Australia Ph. 61 02 6249 6940 http://arrowtheory.com
2007 May 18
0
[LLVMdev] Antw.: 2.0 Pre-release tarballs online
...k's iterator the only solution? > * The same goes for BasicBlock::getNext()/Prev(). Is iterating through the > parent Function's iterator the only solution? > * CallInst's constructors do not accept vectors anymore, but a double > pointer (!) instead. Why? > * Module::getNamedFunction() is now called Module::getFunction(). > * llvm/Transforms/Utils/Cloning.h's CloneFunctionInto() needs a > DenseMap as its third argument instead of an STL map. > * Pass's constructor now needs an intptr_t as explained in the updated > "Write your first pass"-docum...
2004 Jul 21
0
[LLVMdev] GC questions.
Ok, that makes sense :). , Tobias On Wed, 21 Jul 2004, Chris Lattner wrote: > On Wed, 21 Jul 2004, Tobias Nurmiranta wrote: > > > void *llvm_gc_read(void *ObjPtr, void **FieldPtr) { > > > return *FieldPtr; > > > } > > > > Hm, but doesn't FieldPtr need to be calculated target-specific in those > > cases? > > For the field pointer, one
2004 Jul 21
2
[LLVMdev] GC questions.
On Wed, 21 Jul 2004, Tobias Nurmiranta wrote: > > void *llvm_gc_read(void *ObjPtr, void **FieldPtr) { > > return *FieldPtr; > > } > > Hm, but doesn't FieldPtr need to be calculated target-specific in those > cases? For the field pointer, one could use the getelementptr instruction: %pairty = { sbyte, sbyte, int* } %pairPtr = ... %fieldptr = getelementptr
2004 Jul 22
2
[LLVMdev] GC questions.
...GCWriteInt; --- > Function *GCRootInt, *GCReadInt, *GCWriteInt; 61c60 < X("lowergc2", "Lower GC intrinsics, for GCless code generators"); --- > X("lowergc", "Lower GC intrinsics, for GCless code generators"); 103d101 < GCRootValueInt = M.getNamedFunction("llvm.gcroot_value"); 106c104,105 < if (!GCRootInt && !GCRootValueInt && !GCReadInt && !GCWriteInt) return false; --- > if (!GCRootInt && !GCReadInt && !GCWriteInt) return false; > 108a108 > 112c112 < GCRead = M.getOrInsertF...