search for: getlinkage

Displaying 20 results from an estimated 32 matches for "getlinkage".

2011 Feb 28
3
[LLVMdev] Extending FunctionType
...is necessary, since he wants to replace the function. He only needs to create the new function and splice in the body of the old one. Gabriel: look at Function::getBasicBlockList() and iplist<>::splice(iterator, iplist). Something like Function *NewF = Function::Create(NewFnType, OldF->getLinkage()); NewF->getBasicBlockList().splice(NewF->begin(), OldF->getBasicBlockList()); NewF->takeName(OldF); OldF->eraseFromParent(); is probably what you're looking for. (Note: completely untested)
2013 May 29
2
[LLVMdev] CloneFunctionInto() Error
...ped) ***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, "_", 0, 0); Thanks in advance -- *Rasha Salah Omar Msc Student at E-JUST Demonestrator at Faculty of Computers and Informatics Benha University...
2017 Jun 15
4
CloneFunctionInto produces invalid debug info
...y working on a science project and implemented a FunctionPass that clones a function (more precisely a constructor of a struct/class) and adds a parameter. First, we create a new function with a new function type, which includes the newly added parameter: Function *NF = Function::Create(NewFTy, F.getLinkage(), F.getName() + "Cloned", F.getParent()); and after setting up the ValueToValueMapTy, we use the CloneFunctionInto method to clone the function body CloneFunctionInto(NF, &F, Map, true, Returns, "Cloned"); The code seems to work as intended, but when we try to emit deb...
2011 Feb 28
2
[LLVMdev] Extending FunctionType
...n each old argument, since there's no need to worry about preserving the integrity of the old function. >> Gabriel: look at Function::getBasicBlockList() and >> iplist<>::splice(iterator, iplist). Something like >>   Function *NewF = Function::Create(NewFnType, OldF->getLinkage()); >>   NewF->getBasicBlockList().splice(NewF->begin(), >> OldF->getBasicBlockList()); >>   NewF->takeName(OldF); >>   OldF->eraseFromParent(); >> is probably what you're looking for. >> (Note: completely untested) And I did put a disclaimer...
2011 Nov 12
1
[LLVMdev] Argument's types mismatch when creating CallInst.
...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/attachment.html>
2013 Sep 10
1
[LLVMdev] Global Variable Recall
Hi All, I need to call global variable by its name from the following code for(Function::iterator i=F->begin();i!=F->end();++i) { BasicBlock*Bb =&*i; GlobalVariable* GV = new GlobalVariable(type,false, F->getLinkage(),0, "F$"+Bb->getName()); GV->setInitializer(Constant::getNullValue (typ)); GList.push_back(GV); } Could I solve that by mapping the global variables in Stringmap? I need to identify the global variable with its name in the IR to be able to load and store its values....
2017 Jun 08
4
DICompileUnit duplication in LLVM 4.0.0?
...FunctionDuplication::getAnalysisUsage(AnalysisUsage &AU) const { ModulePass::getAnalysisUsage(AU); } Function *FunctionDuplication::duplicate(Module &M, Function &Old, FunctionType *NewTy) const { Function *New = Function::Create(NewTy, Old.getLinkage(), "", &M); New->setAttributes(Old.getAttributes()); New->setCallingConv(Old.getCallingConv()); // Map old arguments to the new arguments. ValueToValueMapTy VMap; for (auto OldFI = Old.arg_begin(), OldFE = Old.arg_end(), NewFI = New->arg_begin();...
2018 May 09
0
lld + ThinLTO + fprofile-generate causes duplicate symbol errors
...nsforms/IPO/FunctionImport.cpp index 246d75caefa2..61790c9fc435 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -765,7 +765,7 @@ void llvm::thinLTOResolveWeakForLinkerModule( return; } - if (!GlobalValue::isWeakForLinker(GV.getLinkage())) + if (GlobalValue::isLocalLinkage(GV.getLinkage())) return; // Check for a non-prevailing def that has interposable linkage // (e.g. non-odr weak or linkonce). In that case we can't simply Peter On Wed, May 9, 2018 at 10:06 AM, Teresa Johnson <tejohnson at google.co...
2018 May 11
1
lld + ThinLTO + fprofile-generate causes duplicate symbol errors
...ex 246d75caefa2..61790c9fc435 100644 > --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp > +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp > @@ -765,7 +765,7 @@ void llvm::thinLTOResolveWeakForLinkerModule( > return; > } > > - if (!GlobalValue::isWeakForLinker(GV.getLinkage())) > + if (GlobalValue::isLocalLinkage(GV.getLinkage())) > return; > // Check for a non-prevailing def that has interposable linkage > // (e.g. non-odr weak or linkonce). In that case we can't simply > > Peter > > On Wed, May 9, 2018 at 10:06 AM, Ter...
2011 Feb 28
0
[LLVMdev] Extending FunctionType
...chanism that updates instructions that use the old function's arguments to use the new function's arguments. > Gabriel: look at Function::getBasicBlockList() and > iplist<>::splice(iterator, iplist). Something like > Function *NewF = Function::Create(NewFnType, OldF->getLinkage()); > NewF->getBasicBlockList().splice(NewF->begin(), OldF->getBasicBlockList()); > NewF->takeName(OldF); > OldF->eraseFromParent(); > is probably what you're looking for. > (Note: completely untested) -- John T.
2013 May 29
0
[LLVMdev] CloneFunctionInto() Error
...ector<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, "_", 0, > 0); > > > Thanks in advance > > -- > *Rasha Salah Omar > Msc Student at E-JUST > Demonestrator...
2018 May 09
2
lld + ThinLTO + fprofile-generate causes duplicate symbol errors
Adding Peter to comment on the linker resolution issue. >From adding save-temps, it looks like lld and gold are giving different resolutions to the symbols, which is presumably creating this issue: (first file is with lld and second is with gold) $ diff a.out.resolution.txt gold/ 4c4 < -r=a.o,__llvm_profile_raw_version,plx --- > -r=a.o,__llvm_profile_raw_version,l 8,9c8,9 <
2017 Jun 08
2
DICompileUnit duplication in LLVM 4.0.0?
...&AU) const { >> ModulePass::getAnalysisUsage(AU); >> } >> >> Function *FunctionDuplication::duplicate(Module &M, Function &Old, >> FunctionType *NewTy) const { >> Function *New = Function::Create(NewTy, Old.getLinkage(), "", &M); >> New->setAttributes(Old.getAttributes()); >> New->setCallingConv(Old.getCallingConv()); >> >> // Map old arguments to the new arguments. >> ValueToValueMapTy VMap; >> for (auto OldFI = Old.arg_begin(), OldFE = Old.arg_e...
2017 Jun 15
2
CloneFunctionInto produces invalid debug info
...d implemented a > FunctionPass that clones a function (more precisely a constructor of a > struct/class) and adds a parameter. > > First, we create a new function with a new function type, which includes > the newly added parameter: > > Function *NF = Function::Create(NewFTy, F.getLinkage(), F.getName() + > "Cloned", F.getParent()); > > > and after setting up the ValueToValueMapTy, we use the CloneFunctionInto > method to clone the function body > > CloneFunctionInto(NF, &F, Map, true, Returns, "Cloned"); > > > The code seems to...
2017 Jun 15
3
CloneFunctionInto produces invalid debug info
...ass that clones a function (more precisely a constructor of a struct/class) and adds a parameter. >>> >>> First, we create a new function with a new function type, which includes the newly added parameter: >>> >>>> Function *NF = Function::Create(NewFTy, F.getLinkage(), F.getName() + "Cloned", F.getParent()); >>> >>> and after setting up the ValueToValueMapTy, we use the CloneFunctionInto method to clone the function body >>> >>>> CloneFunctionInto(NF, &F, Map, true, Returns, "Cloned"); >>...
2011 Mar 06
2
[LLVMdev] how to zero-init a global
Hi! I have a module containing a constant e.g. @input = global %0 zeroinitializer, align 16 when I copy the global into another module I use newGlobal->copyAttributesFrom(global); but the new module now has @input = external global %0, align 16 i.e. the zeroinitializer is missing. how do I set it or copy it from the other global? -Jochen
2011 Mar 06
0
[LLVMdev] how to zero-init a global
...response to your earlier question, not all constants are safe to use in a different module. So simply copying the initializer may be unsafe... Note that linkage and constness don't seem to count either. newGlobal->setConstant(global->isConstant()); newGlobal->setLinkage(global->getLinkage()); All three of these can also be passed to the constructor for newGlobal, by the way. According to the comment on GlobalValue::copyAttributesFrom() (as well as its GlobalVariable override) this seems to be the defining characteristic that qualifies them as "attributes"; it considers an...
2011 Nov 11
0
[LLVMdev] Argument's types mismatch when creating CallInst.
On Fri, Nov 11, 2011 at 12:18 AM, arrowdodger <6yearold at gmail.com> wrote: > Hello. I have an .bc, which defines @foo(%type* arg1, %type* arg2, %type* > arg3). > Firstly, i do this: > > runtimeModule = getLazyIRFileModule("runtime.bc", smd, llctx); > > then this: > > fooFunction = runtimeModule->getFunction("foo"); > myType =
2007 May 25
0
[LLVMdev] Linking two external linkage GlobalValues
Hi, I've been able to link ioquake, but not without a small modification to lib/Linker/LinkModules.cpp:427 where I had to add: } else if (Dest->hasExternalLinkage() && Src->hasExternalLinkage()){ LinkFromSrc = true;//overwrite old value LT = Src->getLinkage();//use src linkage The reason is that two files both had a global function pointer variable (due to #include's): void ( *alEnable)( ALenum capability ); which got translated to: @alEnable = globale void (i32)* null Linking these resulted in an error (lib/Linker/LinkModules.cpp's o...
2011 Feb 28
0
[LLVMdev] Extending FunctionType
On 2/28/11 6:31 AM, Gabriel Rodríguez 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,