search for: ninst

Displaying 7 results from an estimated 7 matches for "ninst".

Did you mean: inst
2018 Sep 02
2
Replacing a function from one module into another one
...nstruction call, defined in the main function of the oldModule, who is a calling function to foo2, I'll name it *oInst *(original Instruction) 2. The "new" instruction call, defined in the main function of the refModule, who is a calling function to foo3, I'll name it *nInst* (new Instruction) 3. The foo2 function definition, defined in the oldModule, I'll name it *oFunc *(original Function) 4. The foo3 function definition, defined in the refModule, I'll name it *nFunc* (new Function) 5. I have the parameters (or arguments?) of both functions,...
2018 Sep 02
2
Replacing a function from one module into another one
...function of >> the oldModule, who is a calling function to foo2, I'll name it >> *oInst *(original Instruction) >> 2. The "new" instruction call, defined in the main function of the >> refModule, who is a calling function to foo3, I'll name it *nInst* (new >> Instruction) >> 3. The foo2 function definition, defined in the oldModule, I'll name >> it *oFunc *(original Function) >> 4. The foo3 function definition, defined in the refModule, I'll name >> it *nFunc* (new Function) >> 5. I...
2018 Sep 03
2
Replacing a function from one module into another one
Thank you Ahmad, I figured out that, although the type of both p(oInst) and p(nInst) were the same, I had to: for (unsigned int i = 0; i < callOInst->getNumArgOperands(); i++) { callOInst->getArgOperand(i)->mutateType(callNInst->getArgOperand(i)->getType()); } that solves the issue at the calling instruction in the main function, but now I see that *linkModules...
2018 Sep 04
2
Replacing a function from one module into another one
...*i *position. I'm really thankful for the quick responses and for the attention received. Regards, Daniel Moya El lun., 3 de sep. de 2018 a la(s) 18:42, Philip Pfaffe ( philip.pfaffe at gmail.com) escribió: > Hi Daniel, > > CloneFunctionInto wants to tell you about the new ReturnInstructions it > produced, you're expected to pass a vector for this purpose. You're free to > ignore these values, though, but you still have to pass that > vector: SmallVector<ReturnInst*, 8> Returns; > > For the argument remapping, you're supposed to pre-populate th...
2018 Sep 06
2
Replacing a function from one module into another one
...en I have this code: llvm::Function *fNew = nMod->getFunction(nFName); llvm::Function *fOld = oMod->getFunction(oFName); fOld->dropAllReferences(); fOld->deleteBody(); llvm::ValueToValueMapTy VMap; populateVMap(VMap, fOld, fNew); bool ModuleArg = true; llvm::SmallVector<llvm::ReturnInst*, 8> Returns; llvm::CloneFunctionInto(fOld, fNew, VMap, ModuleArg, Returns); if (fNew->hasPersonalityFn()) fOld->setPersonalityFn(llvm::MapValue(fNew->getPersonalityFn(), VMap)); But after running the code, I still get the error: *Use still stuck around after Def is destroyed* Whic...
2018 Aug 27
3
Replacing a function from one module into another one
Hello LLVM Developers, I'm trying to replace a function defined in one module into another module (different files). The first issue I ran into was that llvm::Function does not have a method "moveBefore" or "moveAfter" as the llvm::BasicBlock or llvm::Instruction do, so I figured I would just move the BasicBlocks of the replacing function into the function that was being
2018 Sep 06
2
Replacing a function from one module into another one
...me) { llvm::Function *fNew = nMod->getFunction(nFName); llvm::Function *fOld = oMod->getFunction(oFName); fOld->dropAllReferences(); fOld->deleteBody(); llvm::ValueToValueMapTy VMap; populateVMap(VMap, fOld, fNew); bool ModuleArg = true; llvm::SmallVector<llvm::ReturnInst*, 8> Returns; llvm::CloneFunctionInto(fOld, fNew, VMap, ModuleArg, Returns); if (fNew->hasPersonalityFn()) fOld->setPersonalityFn(llvm::MapValue(fNew->getPersonalityFn(), VMap)); } void replaceFunctions(std::string oldFuncName, std::string newFuncName) { llvm::SMDiagnostic o...