search for: getfunctiontype

Displaying 20 results from an estimated 46 matches for "getfunctiontype".

2013 May 29
2
[LLVMdev] CloneFunctionInto() Error
...n + 237 14 opt 0x0000000000521f91 Stack dump: 0. Program arguments: opt -load ../../../Release+Asserts/lib/Blocks.so -blocks Aborted (core dumped) ***The code is > std::vector<Type*> ArgTypes; > ValueToValueMapTy VMap; >FunctionType *FTy = FunctionType::get(F.getFunctionType()->getReturnType(), ArgTypes, F.getFunctionType()->isVarArg()); >Function *NewF = Function::Create(FTy, F.getLinkage(), F.getName()); > SmallVector<ReturnInst*, 8> Returns; >CloneFunctionInto(NewF, (Function*) &F, VMap, false, Returns, "_...
2009 Nov 05
3
[LLVMdev] create dummy function
...torial paper - IRBuilder<> builder(block)) So, I believe this is just outdated information? I think it just need some quick attention with getting materials up to date. In the end I got following code, that satisfy my needs: llvm::Constant* c = M.getOrInsertFunction(dummyFunctionName, F.getFunctionType()); llvm::Function* dummy = llvm::cast<llvm::Function>(c); dummy->setLinkage(llvm::Function::ExternalLinkage); dummy->setCallingConv(llvm::CallingConv::C); llvm::BasicBlock* block = llvm::BasicBlock::Create("entry", dummy); // no context needed llvm::IRBuilder b...
2009 Nov 05
2
[LLVMdev] create dummy function
Hello, I have a simple question. How to create "dummy" function which will have no functionality behind (return nothing and do nothing)? Currently I'm trying to do this: llvm::Constant* c = Module.getOrInsertFunction("dummy", FunctionThatNeedsToBeReplaced.getFunctionType()); llvm::Function* dummy = llvm::cast<llvm::Function>(c); This way I create new function that do nothing.Then next step is: FunctionThatNeedsToBeReplaced.replaceAllUsesWith(dummy); This code is doing what I want to do, but it ends up with exception: ERROR: Program used external function &...
2009 Nov 15
0
[LLVMdev] create dummy function
...(block)) > > So, I believe this is just outdated information? I think it just need > some quick attention with getting materials up to date. > > In the end I got following code, that satisfy my needs: > > llvm::Constant* c = M.getOrInsertFunction(dummyFunctionName, > F.getFunctionType()); > llvm::Function* dummy = llvm::cast<llvm::Function>(c); > dummy->setLinkage(llvm::Function::ExternalLinkage); > dummy->setCallingConv(llvm::CallingConv::C); > llvm::BasicBlock* block = llvm::BasicBlock::Create("entry", dummy); > // no context ne...
2013 May 29
0
[LLVMdev] CloneFunctionInto() Error
...Program arguments: opt -load ../../../Release+Asserts/lib/Blocks.so > -blocks > Aborted (core dumped) > > > > ***The code is > > > > std::vector<Type*> ArgTypes; > > > ValueToValueMapTy VMap; > > >FunctionType *FTy = > FunctionType::get(F.getFunctionType()->getReturnType(), > ArgTypes, F.getFunctionType()->isVarArg()); > > >Function *NewF = Function::Create(FTy, F.getLinkage(), F.getName()); > > > SmallVector<ReturnInst*, 8> Returns; > > >CloneFunctionInto(NewF, (Function*) &...
2009 Nov 05
0
[LLVMdev] create dummy function
...; I have a simple question. How to create "dummy" function which will > have no functionality behind (return nothing and do nothing)? > Currently I'm trying to do this: > > llvm::Constant* c = Module.getOrInsertFunction("dummy", > FunctionThatNeedsToBeReplaced.getFunctionType()); > llvm::Function* dummy = llvm::cast<llvm::Function>(c); Hi Oleg, Every function needs a BasicBlock, even if the basic block just contains a return. The only reason to create a function without a basic block is when the function is extern'd and imported via JIT, but I guess it...
2015 Jun 02
2
[LLVMdev] struct type parament
Hi All, I generated the following code with "clang -flto" command. void test(struct StruTyName *a) { ... } Then the type of test function is "void (%struct.StruTyName.100*)" by calling function::getFunctionType API. What's the meaning of number 100? Best, Haopeng
2011 Feb 28
2
[LLVMdev] Extending FunctionType
Hi all, I am trying to extend a FunctionType to include new parameters. In particular, I want to ensure that the main function has been declared with both argsc and argsv. However there seems to be no easy way to accomplish this: llvm::Function::getFunctionType() returns a a reference to a const object, while modifying only the argument list yields an error during verification since the function type does not match its arguments. Is there any approach that I am missing or a simple workaround to this problem? Thanks in advance, and best regards, Gabr...
2016 Mar 01
2
Insert CallInst within a function passing same parameters of the calling function.
...} CallInst::Create(new_function->getFunctionType(), new_function, args, functionName + "__swordomp__", &F.getEntryBlock().front()); } but I am getting the following error: void llvm::Value::setNameImpl(const llvm::Twine&):...
2015 Jun 02
2
[LLVMdev] struct type parament
...>> Hi All, >> >> I generated the following code with "clang -flto" command. >> >> void test(struct StruTyName *a) { >> ... >> } >> >> Then the type of test function is "void (%struct.StruTyName.100*)" by calling function::getFunctionType API. >> >> What's the meaning of number 100? >> >> Best, >> Haopeng >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mail...
2011 Nov 12
1
[LLVMdev] Argument's types mismatch when creating CallInst.
...gt;wrote: > A CallInst in one module can't reference a Function in another module. > Build a declaration of foo in the module where you're building the > call, and call that. > > -Eli > Hmm, before emitting any code i've added this: Function::Create(fooFunction->getFunctionType(),fooFunction->getLinkage(),"foo",myModule); Now i see @foo declaration when dumping myModule, but the error is still same. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111112/60fb08ec/attach...
2013 Feb 11
2
[LLVMdev] How to get type of a call instruction
I need to get the type of a call instruction to typecast a (void*) pointer to the type of the function which is called. How can I achieve that? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130211/6a044cde/attachment.html>
2017 Jun 08
4
DICompileUnit duplication in LLVM 4.0.0?
...ctor<Function *> Functions; for (auto &Fn : M.functions()) { Functions.push_back(&Fn); } for (auto *F : Functions) { if (F->size() > 0) { dbgs() << "duplicating " << F->getName() << "\n"; duplicate(M, *F, F->getFunctionType()); Modified = true; } } return Modified; } char FunctionDuplication::ID = 0; INITIALIZE_PASS(FunctionDuplication, "dupl", "Duplicate every function", false, false) ModulePass *createFunctionDuplicationPass(void) { return new FunctionDuplication...
2011 Feb 28
0
[LLVMdev] Extending FunctionType
...uez wrote: > Hi all, > > I am trying to extend a FunctionType to include new parameters. In > particular, I want to > ensure that the main function has been declared with both argsc and > argsv. However > there seems to be no easy way to accomplish this: > llvm::Function::getFunctionType() returns a > a reference to a const object, while modifying only the argument list > yields an error during verification > since the function type does not match its arguments. Is there any > approach that I am missing or > a simple workaround to this problem? If I understand cor...
2015 Jun 02
2
[LLVMdev] struct type parament
...he following code with "clang -flto" command. >>>> >>>> void test(struct StruTyName *a) { >>>> ... >>>> } >>>> >>>> Then the type of test function is "void (%struct.StruTyName.100*)" by calling function::getFunctionType API. >>>> >>>> What's the meaning of number 100? >>>> >>>> Best, >>>> Haopeng >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> LLVMdev at cs.uiuc.edu...
2013 Feb 25
2
[LLVMdev] Queries regarding function's arguments data type
...ype of each argument of the argument list of the function. 2. Based on its data type like character array or integer array, pointer, int, char, take different action. 3. I have added following code to check its data type. // F is any function basically of type function * FunctionType *FTy = F->getFunctionType(); unsigned int numArgs = FTy->getNumParams(); //Currently just checking data type of the 0th argument. Eventually will be running it in the loop from 0 to numArgs. errs() << "\n1 Argument type int 32 : " << FTy->getParamType(0)->isIntegerTy(32); errs() <<...
2017 Jun 08
2
DICompileUnit duplication in LLVM 4.0.0?
...{ >> Functions.push_back(&Fn); >> } >> >> for (auto *F : Functions) { >> if (F->size() > 0) { >> dbgs() << "duplicating " << F->getName() << "\n"; >> >> duplicate(M, *F, F->getFunctionType()); >> Modified = true; >> } >> } >> >> return Modified; >> } >> >> char FunctionDuplication::ID = 0; >> INITIALIZE_PASS(FunctionDuplication, "dupl", "Duplicate every function", >> false, >>...
2011 Jul 06
2
[LLVMdev] First steps with LLVM and partial evaluation
...t_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (ValueMap.count(I) == 0) // Haven't mapped the argument to anything yet? ArgTypes.push_back(I->getType()); // Create a new function type... FunctionType *FTy = FunctionType::get(F->getFunctionType()->getReturnType(), ArgTypes, F->getFunctionType()->isVarArg()); // Create the new function... Function *NewF = Function::Create(FTy, F->getLinkage(), F->getName()); // Loop over the arguments, copying the names of the mapped argu...
2011 Feb 28
3
[LLVMdev] Extending FunctionType
...z wrote: > > Hi all, > > I am trying to extend a FunctionType to include new parameters. In > particular, I want to > ensure that the main function has been declared with both argsc and argsv. > However > there seems to be no easy way to accomplish this: > llvm::Function::getFunctionType() returns a > a reference to a const object, while modifying only the argument list yields > an error during verification > since the function type does not match its arguments. Is there any approach > that I am missing or > a simple workaround to this problem? > > If I underst...
2013 Feb 25
0
[LLVMdev] Queries regarding function's arguments data type
...s not represent what the type of the actual memory object passed into the function will be. A caller can cast a pointer of one structure type to a different structure type and pass that into a function. > > // F is any function basically of type function * > FunctionType *FTy = F->getFunctionType(); > unsigned int numArgs = FTy->getNumParams(); > > //Currently just checking data type of the 0th argument. Eventually > will be running it in the loop from 0 to numArgs. > errs() << "\n1 Argument type int 32 : " << > FTy->getParamType(0)->isInte...