search for: addfunct

Displaying 4 results from an estimated 4 matches for "addfunct".

Did you mean: addfunc
2005 Mar 15
1
[LLVMdev] Dynamic Creation of a simple program
...cally create a program at run time using the LLVM classes. I am wondering if there are some examples available. For example, for a very simple "Hello World" program, I will have something like this (pseudo code): Module M = new Module(); Function FMain = new Function("main"); M.addFunction(FMain); BasicBlock B = new BasicBlock(); FMain.add(B); // maybe adding here a symboltable CallInst CIPrintf = new CallInst("printf", "Hello World", B); ... Something like that (although obviously not accurate). Once I have this program, I can apply some analyses to it wi...
2018 Sep 06
2
Replacing a function from one module into another one
...llvm::Function *fOld, llvm::Function *fNew) { llvm::Function::arg_iterator DestI = fOld->arg_begin(); for (llvm::Function::const_arg_iterator J = fNew->arg_begin(); J != fNew->arg_end(); ++J) { DestI->setName(J->getName()); VMap[&*J] = &*DestI++; } void addFunction(llvm::Module *oMod, llvm::Module *nMod, std::string nFName, std::string oFName) { llvm::Function *fNew = nMod->getFunction(nFName); llvm::Function *fOld = oMod->getFunction(oFName); fOld->dropAllReferences(); fOld->deleteBody(); llvm::ValueToValueMapTy VMap; populateVMa...
2018 Sep 06
2
Replacing a function from one module into another one
Hi Philip, Thanks for the reference, I was able to follow it and copy the code that I saw necessary, but I still have some issues (references are still not updated). I created the function: void populateVMap(llvm::ValueToValueMapTy &VMap, llvm::Function *fOld, llvm::Function *fNew) { llvm::Function::arg_iterator DestI = fOld->arg_begin(); for (llvm::Function::const_arg_iterator J =
2013 Jul 12
14
[LLVMdev] [Proposal] Parallelize post-IPO stage.
...} +class ModPartScheme { +public: + typedef SetVector<Function*> PartitionTy; + typedef PartitionTy::iterator iterator; + typedef PartitionTy::const_iterator const_iterator; + + ModPartScheme() {} + ModPartScheme(const ModPartScheme &That) : Partition(That.Partition) {} + + void AddFunction(Function *F) { Partition.insert(F); } + + iterator begin() { return Partition.begin(); } + iterator end() { return Partition.end(); } + const_iterator begin() const { return Partition.begin(); } + const_iterator end() const { return Partition.end(); } + int size() { return Partition.size();...