search for: returninst

Displaying 20 results from an estimated 130 matches for "returninst".

2008 Apr 16
2
[LLVMdev] Problems in removing a cloned instruction.
...tructions, and copy them over. for (BasicBlock::const_iterator II = BB->begin(), IE = BB->end(); II != IE; ++II) { const Instruction *NwInst = cast<Instruction>((II)); Instruction *NewInst = II->clone(); if(ReturnInst *RI = dyn_cast<ReturnInst>(NewInst)) { cerr << "\n Return Found : " << *RI<< "\n"; Instruction *NewRInst = new ReturnInst(); // creating a new return instruction Value *v = NULL;...
2008 Apr 16
0
[LLVMdev] Problems in removing a cloned instruction.
...{ > const Instruction *NwInst = cast<Instruction>((II)); What's this for? You don't seem to use it anywhere? > Instruction *NewInst = II->clone(); Why do you clone the instruction here already? Can't you wait until you know that II is not a ReturnInst? AFAIK you can simply dyn_cast II instead of NewInst in the next line. This saves you from having to cleanup NewInst below if you're not going to use it. > if(ReturnInst *RI = dyn_cast<ReturnInst>(NewInst)) > { > cerr << "\n Ret...
2008 Sep 12
3
[LLVMdev] CPP API User-level Question: Returning multiple values
...LLVM to mimic the way the LLVM-GCC inserts instructions to generate AMD64 ABI compliant code. I'm trying to create ret i64 %mrv, double %double_mrv37 which is basically what LLVM-GCC puts out. However if I use lcc -march=cpp to get the API code I need it has the following line: ReturnInst::Create(int64_t93, label_return); with no reference to the double. I also can't find anything in the doxygen docs for a version of ReturnInst::Create( ) that takes two values for returning, nor could I find anything by generating an intentionally bad call and letting my gen-compiler list t...
2008 Sep 12
2
[LLVMdev] CPP API User-level Question: Returning multiple values
...info. Unfortunately for the time being we are using (for the most part) the 2.3 release (with a couple of patches that Dave Greene has applied). The first-class aggregates is one of the things we don't yet have in the LLVM we're working with. I'll look again to see if there's a ReturnInst::Create( ) which I can pass an array of llvm::Value *'s to, but I don't recall having seen one. Unfortunately it's all going to change once we do bring our LLVM up to date with changes made to trunk since the LLVM2.3 release, but do we need to get it working with the LLVM we have...
2008 Sep 12
0
[LLVMdev] CPP API User-level Question: Returning multiple values
Hi Tony, I just checked LLVM 2.3 and ReturnInst has these: static ReturnInst* Create(Value * const* retVals, unsigned N, Instruction *InsertBefore) static ReturnInst* Create(Value * const* retVals, unsigned N, BasicBlock *InsertAtEnd) which are what you're looking for. In LL...
2013 Oct 10
2
[LLVMdev] Are there implicit rules or conventions for an llvm frontend to generate llvm IR?
...anguage reference(http://llvm.org/docs/LangRef.html#switch-instruction) page, are there additional rules for a regular llvm frontend to generate llvm IRs? There are a few cases that I got from clang/llvm-gcc/dragonegg when compiling *C* source code into llvm IR: 1. It seems that there is ONLY ONE ReturnInst(and NO InvokeInst) for such llvm IR; is it legal to add other *ReturnInst*s when transforming? 2. Is it possible for a frontend to generate a function whose CFG is something like: bb0 / \ bb1 bb2 / \ / \ bb3 bb4 bb5 \...
2013 Oct 10
0
[LLVMdev] Are there implicit rules or conventions for an llvm frontend to generate llvm IR?
...m.org/docs/LangRef.html#switch-instruction) page, are > there additional rules for a regular llvm frontend to generate llvm IRs? > > There are a few cases that I got from clang/llvm-gcc/dragonegg when > compiling *C* source code into llvm IR: > > 1. It seems that there is ONLY ONE ReturnInst(and NO InvokeInst) for such > llvm IR; is it legal to add other *ReturnInst*s when transforming? An LLVM function can have multiple ReturnInsts as long as each one terminates a basic block. There is a transform (UnifyExitNodes, IIRC) that will take a function with multiple ReturnInsts and cr...
2013 Oct 10
1
[LLVMdev] Are there implicit rules or conventions for an llvm frontend to generate llvm IR?
...) >> page, are >> there additional rules for a regular llvm frontend to generate llvm IRs? >> >> There are a few cases that I got from clang/llvm-gcc/dragonegg when >> compiling *C* source code into llvm IR: >> >> >> 1. It seems that there is ONLY ONE ReturnInst(and NO InvokeInst) for such >> llvm IR; is it legal to add other *ReturnInst*s when transforming? >> > > An LLVM function can have multiple ReturnInsts as long as each one > terminates a basic block. There is a transform (UnifyExitNodes, IIRC) that > will take a function wi...
2008 Sep 12
0
[LLVMdev] CPP API User-level Question: Returning multiple values
...MD64 ABI compliant > code. I'm trying to create > > ret i64 %mrv, double %double_mrv37 This is LLVM 2.3 MRV syntax. > > > which is basically what LLVM-GCC puts out. However if I use lcc > -march=cpp to get the API code I need it has the following line: > > ReturnInst::Create(int64_t93, label_return); > > with no reference to the double. I also can't find anything in the > doxygen docs for a version of ReturnInst::Create( ) that takes two > values for returning, nor could I find anything by generating an > intentionally bad call and letting...
2015 Oct 10
2
[RFC] Clean up the way we store optional Function data
...iscusses a new way of managing optional data that makes llvm::Function cleaner, more consistent, and a little smaller. What do we do currently? ======================== Prefix and prologue data are attached to Functions via DenseMaps in LLVMContextImpl: typedef DenseMap<const Function *, ReturnInst *> FunctionDataMapTy; FunctionDataMapTy PrefixDataMap; FunctionDataMapTy PrologueDataMap; To attach prefix data to a Function, we create an orphan ReturnInst: RI = ReturnInst::Create(F->getContext(), PrefixData); PrefixDataMap[F] = RI; Personalities are stored as ``optional...
2011 May 18
1
[LLVMdev] function terminators
...return statements and exit statements cause >> control exit out of function. > there is no "exit" statement. > > I am looking for something similar to basic block >> terminators. Thanks. > Control can leave a function either (1) due to a return instruction > (ReturnInst); or (2) due to a function call (CallInst or InvokeInst). > A function call can return normally, unwind an exception or never > return (eg: infinite loop or causing the program to exit). To add to what Duncan said, there is also the unwind instruction (which is similar to the ReturnInst)....
2013 Jan 11
0
[LLVMdev] modifiy the address of GlobalVariable emitted by JIT
Hi everyone, I am building a binary translator, and try to do block chaining. LLVM version : 3.1 my machine : x86-32 bit, Linux Before each *LLVM IR returnInst constantValue*, I insert a call instruction & a returnInst which looks like %x = call @G ; ret %x; then remove the *LLVM IR returnInst constantValue* The initializer of @G is a function which has prototype int f(struct MyType* ); and the content in terms of LLVM IR is define internal i32...
2015 Mar 15
3
[LLVMdev] Explicit constructors with more than one argument
Hi, Some LLVM classes (e.g. ReturnInst) have explicit constructors with at least two parameters (with no default arguments). Why is that? E.g. what are they trying to prevent? -- Gaby -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150314/4d4c...
2018 Sep 03
2
Replacing a function from one module into another one
...on, but now I see that *linkModules* does not work for me (it's a mess to bring all the other unnecessary functions from the reference module) so what I need is to directly move one function from one module to another one. I'm still facing the issue with the *llvm::SmallVectorImpl< llvm::ReturnInst *> &Returns *argument for the *CloneFunctionInto, *can anyone please give an example of use of that function? I guess that's the only way because otherwise if I move the blocks from foo3 in the refModule to the oldModule, the references of the moved block still point to the arguments of...
2018 Sep 04
2
Replacing a function from one module into another one
...n the *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 02
2
Replacing a function from one module into another one
...apparently does not match the *p(nFunc)*. I also looked into the *CloneFunctionInto *function, but I didn't understand the arguments of it, and there's really no documentation or examples that I could find on the internet. Specifically, I have troubles with *llvm::SmallVectorImpl< llvm::ReturnInst *> &Returns *argument, I don't know how to initialize it, it doesn't have a 0 argument constructor and if I try: llvm::SmallVectorImpl< llvm::ReturnInst *> ReturnsArg = llvm::SmallVectorImpl< llvm::ReturnInst *>(2); // Just as an example It says that constructor is prot...
2011 Sep 16
2
[LLVMdev] How to duplicate a function?
...cBlockList().splice(NF->begin(), F.getBasicBlockList()); llvm::Value *Globals = --NF->arg_end(); Globals->setName("IOCallIDs"); // Now, exploit all return instructions. for (Function::iterator BI = NF->begin(), BE = NF->end(); BI != BE; ++BI) { if (ReturnInst *RI = llvm::dyn_cast<llvm::ReturnInst>(BI->getTerminator())) { // Don't support functions that have multiple return values. assert(RI->getNumOperands() < 2); // Insert a new load instruction to return. ////////////////////////////////////////...
2018 Sep 06
2
Replacing a function from one module into another one
...*, then 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...
2011 May 18
2
[LLVMdev] function terminators
Hi All, Does llvm provide a way to determine instructions that cause control to leave functions? For example, return statements and exit statements cause control exit out of function. I am looking for something similar to basic block terminators. Thanks. George -------------- next part -------------- An HTML attachment was scrubbed... URL:
2011 May 18
0
[LLVMdev] function terminators
...leave functions? For example, return statements and exit statements cause > control exit out of function. there is no "exit" statement. I am looking for something similar to basic block > terminators. Thanks. Control can leave a function either (1) due to a return instruction (ReturnInst); or (2) due to a function call (CallInst or InvokeInst). A function call can return normally, unwind an exception or never return (eg: infinite loop or causing the program to exit). Ciao, Duncan.