search for: newinst

Displaying 20 results from an estimated 64 matches for "newinst".

Did you mean: netinst
2008 Apr 16
2
[LLVMdev] Problems in removing a cloned instruction.
...isTerminal =false; // Loop over all instructions, 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...
2008 Apr 16
0
[LLVMdev] Problems in removing a cloned instruction.
...for (BasicBlock::const_iterator II = BB->begin(), IE = BB->end(); > II != IE; ++II) > { > 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. >...
2013 Jul 25
2
[LLVMdev] Error for AllocaInst and Instruction
Hi, For the following code const Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext()); AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb); Bb->getInstList().push_back(newInst); It gives me the error " error: no matching constructor for initialization of 'llvm::AllocaInst' AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb);...
2005 May 11
3
[LLVMdev] Question About inserting Instruction?
...dead BB. Actually, I can insert the legal instructions to dummy/dead BB, however, I really want to insert some illegal instructions/any thing into those BB since those instructions have no chance to be executed. I am not sure if it could be done or not. For example, Correct way: Instruction *NewInst = new LoadInst(...); NewBB->getInstList().push_back(NewInst); what I need just put some junk data in the BB, not instructions. From assemble code level, it looks like the following, a piece of code from correct instructions by disassemble object code. :00000009 0533709283...
2012 Apr 12
1
Console to RHEL6.1 container
...setup a basic Fedora container. Is there something similar or docs with virtmgr ? We started out making a copy of the root fs and using that copy as the root for the container. I made a couple of tweaks to the container rootfs: 1. ensured that /dev/ptmx is a symlink to pts/ptmx 2. Added 'newinstance' option to the devpts mount in fstab The container xml file is attached. If devpts entry in container's fstab has the 'newinstance' option, I get a brief "domain test01 started" message on the stdout. When I run 'virsh consle test01', I only see a few messag...
2005 Nov 22
3
[LLVMdev] Cloning BasicBlock
Hi , I am trying to clone a BasicBlock. I want both to co-exist and I have introduced a conditional branch to the original or the cloned BB. I tried mapping the original instruction and the clone as below : Instruction *NewInst = II->clone(); if (II->hasName()) NewInst->setName(II->getName()); NewBB->getInstList().push_back(NewInst); ValueMap[II] = NewInst; what I got from this is , --> eventhough I have set the same name , a new name is set for the clone....
2011 Jan 24
3
[LLVMdev] How to change the type of an Instruction?
..., %2 ; <i16> [#uses=2] //Old Instruction Value* Op0 = I->getOperand(0); Value* Op1 = I->getOperand(1); Value* V0 = new Value(Type::getInt16Ty(Op0->getContext()), Op0->getValueID()); Value* V1 = new Value(Type::getInt16Ty(Op1->getContext()), Op1->getValueID()); Instruction* newInst = BinaryOperator::CreateNSWAdd(V0, V1, "test"); errs() << "NewInst:\n" << *newInst << "\n"; But I get something like this: %test = add nsw i16 <badref>, <badref> ; <i16> [#uses=0] What I am doing wrong? Best, Douglas On Fri,...
2009 Jan 22
0
[LLVMdev] replacing instructions
...pe generated by the old and new instructions is identical (or maybe even similar), you shouldn't have any problems. For example, replacing an add instruction that adds two i32's with a call instruction that returns an i32 should be as simple as: Instruction * OldInst = ... ; Instruction * NewInst = CallInst::Create (...); OldInst->replaceAllUsesWith (NewInst); This sort of code may not work if OldInst and NewInst are not SSA virtual registers of the same type (for example, if OldInst is a pointer to an array of i32 and NewInst is a pointer to a structure). In that case, not only must t...
2006 Dec 21
1
iplots/JGR on OS X 10.4.8
...registerAboutHandler(MRJApplicationUtils.java:64) at org.rosuda.util.PlatformMac.registerHandlers(PlatformMac.java:43) at org.rosuda.util.PlatformMac.<init>(PlatformMac.java:20) at org.rosuda.iplots.PlatformMac.<init>(PlatformMac.java:16) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:494) at java....
2009 Jan 22
3
[LLVMdev] replacing instructions
Hello everyone, is there any way to replace an instruction inside LLVM that is more elegant than creating a new one, replacing uses and deleting the old one if I only want to modify the type? It is generally not a big deal, but the issue gets really messy if I am in the middle of iterating over uses and start deleting some of them... I hope I could describe my problem well enough ;) Regards,
2005 Jan 17
2
[LLVMdev] CloneBasicBlock doesn't change parent of cloned instructions
It seems the CloneBasicBlock function defined in Transforms/Utils/Cloning.h doesn't change the parent BasicBlock of the contained instructions when it has cloned them -- Is this a bug or a feature? m.
2005 Jan 17
0
[LLVMdev] CloneBasicBlock doesn't change parent of cloned instructions
...en Ofstad wrote: > It seems the CloneBasicBlock function defined in Transforms/Utils/Cloning.h > doesn't change the parent BasicBlock of the contained instructions when it > has cloned them -- Is this a bug or a feature? I'm not sure I understand. This code: Instruction *NewInst = II->clone(); .. NewBB->getInstList().push_back(NewInst); Is enough to ensure that the 'Parent' field of NewInst points to NewBB. These links are automatically set when the instruction is inserted into the basic block (the push_back). -Chris -- http://nondot.org/sabre...
2005 Nov 22
0
[LLVMdev] Cloning BasicBlock
...my code clones all BB in a function and the CFG, then takes backedges and interconnects the backedges of the original and cloned versions, adding conditional branches at those join points.) Andrew Lenharth > I tried mapping the original instruction and the clone as below : > Instruction *NewInst = II->clone(); > if (II->hasName()) > NewInst->setName(II->getName()); > NewBB->getInstList().push_back(NewInst); > ValueMap[II] = NewInst; > what I got from this is , > --> eventhough I have set the same name , a new name is set > for t...
2013 Jul 30
2
[LLVMdev] Instruction insertion By Module Pass
Hi, I need to insert new instruction into every basic block like x=1 or while loop I tried this code, but it doesn't work Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext()); AllocaInst* newInst = new AllocaInst(Int32Type,"flag", Bb); Bb->getInstList().push_back(newInst); the error: void llvm::SymbolTableListTraits<llvm::Instruction, llvm::BasicBlock>::addNodeToList(ValueSubClass *) [ValueSubClass = llvm::Instruction, ItemParentClass = llvm::BasicBlock]: Assertion `V-&...
2005 Nov 23
1
[LLVMdev] Cloning BasicBlock
...e, my code clones all BB in a function and the CFG, then takes backedges and interconnects the backedges of the original and cloned versions, adding conditional branches at those join points.) Andrew Lenharth > I tried mapping the original instruction and the clone as below : > Instruction *NewInst = II->clone(); > if (II->hasName()) > NewInst->setName(II->getName()); > NewBB->getInstList().push_back(NewInst); > ValueMap[II] = NewInst; > what I got from this is , > --> eventhough I have set the same name , a new name is set > for the clone. > origina...
2011 Jan 24
0
[LLVMdev] How to change the type of an Instruction?
...rotected. In any event, Value is pure base. Constructing one this way will never get you what you want. If the ValueID indicates an Instruction, go through Instruction to create one. > Value* V1 = new Value(Type::getInt16Ty(Op1->getContext()), > Op1->getValueID()); > Instruction* newInst = BinaryOperator::CreateNSWAdd(V0, V1, "test"); > errs() << "NewInst:\n" << *newInst << "\n"; > > > But I get something like this: > > %test = add nsw i16 <badref>, <badref> ; <i16> [#uses=0] The two instructions V...
2013 Mar 05
5
[LLVMdev] LLVM load instruction query
HI, I am creating a pass that will pass loaded value by load instruction to an external function. I don't know how to do it.Please Help.
2013 Mar 05
0
[LLVMdev] LLVM load instruction query
Try : INITIALIZE a1 if you didnt. if (cpProf EXISTS){ CallInst* newInst = CallInst::Create(cpProf,a1,""); if (BB->getTerminator() && CI) BB->getInstList().insert((Instruction*)CI, newInst); On Tue, Mar 5, 2013 at 1:04 PM, Anshul Garg <gargaa24 at gmail.com> wrote: > CallInst* newInst = CallInst::Create(cpProf,a1,""...
2011 Jan 21
0
[LLVMdev] How to change the type of an Instruction?
...ce, > given the instruction "%3 = add i32 %1, %2" I would like to alter the > instruction to "%3 = add i16 %1, %2". Is there any way to do this? > No. Instead you create a new Instruction, in this case with BinaryOperator::CreateAdd, then OldInst->replaceAllUsesWith(NewInst) to update all the users, then OldInst->eraseFromParent() since it's now dead code. Also, all values have types immutably assigned at creation, so you'll need to insert casts (trunc instructions in your case) to cast %1 and %2 from i32 to i16 for the smaller add. Nick -------------- ne...
2011 Jan 24
3
[LLVMdev] How to change the type of an Instruction?
...alue is pure base. Constructing one this way will never get > you what you want. If the ValueID indicates an Instruction, go through > Instruction to create one. > > > Value* V1 = new Value(Type::getInt16Ty(Op1->getContext()), >> Op1->getValueID()); >> Instruction* newInst = BinaryOperator::CreateNSWAdd(V0, V1, "test"); >> errs() << "NewInst:\n" << *newInst << "\n"; >> >> >> But I get something like this: >> >> %test = add nsw i16 <badref>, <badref> ; <i16> [#uses=0]...