search for: op_begin

Displaying 20 results from an estimated 73 matches for "op_begin".

2005 Jul 12
0
[LLVMdev] Getting started with LLVM Passes
...ter values, etc..). Would you suggest having LLVM add code after each instruction to get this, or is there another way to do this? I've tried writing some code, as follows (where i is an inst_iterator, but the results are not what I would have expected: for (User::op_iterator j = i->op_begin(), f = i->op_end(); j != f; + +j) { std::cerr << "Operand: " << (j->getUser())->getOperand(0) << "\n"; } or for (User::op_iterator j = i->op_begin(), f = i->op_end(); j != f; + +j) { std::cerr << "Operand: " <<...
2008 Apr 29
0
[LLVMdev] [PATCH] use-diet for review
..., but I have a few questions already. Is there a header missing? I don't see DECLARE_TRANSPARENT_OPERAND_ACCESSORS defined anywhere. Also, what affect does this macro have on doxygen? In User.h: +public: + template <unsigned Idx> Use &Op() { + return OperandTraits<User>::op_begin(this)[Idx]; + } + template <unsigned Idx> const Use &Op() const { + return OperandTraits<User>::op_begin(const_cast<User*>(this))[Idx]; + } + Use *allocHungoffUses(unsigned) const; + void dropHungoffUses(Use *U) { + if (OperandList == U) { + OperandList = 0; +...
2005 Jul 11
2
[LLVMdev] Getting started with LLVM Passes
... here is some generally useful information I should have cc'd to llvmdev in the first place ... -Chris -- http://nondot.org/sabre/ http://llvm.cs.uiuc.edu/ ---------- Forwarded message ---------- Date: Sun, 10 Jul 2005 21:41:55 -0500 (CDT) From: Chris Lattner <sabre at nondot.org> To: Sean Peisert <peisert at gmail.com> Subject: Re: [LLVMdev] Getting started with LLVM
2018 May 21
2
Getting variable names from LLVM Pass
Hi, I want to retrieve the variable names used in a statement, I tried the following snippet, but it only gives me the variable named in llvm bitcode. I need the variable name in source code. for (auto op = I.op_begin(); op != I.op_end(); op++) { Value* v = op->get(); StringRef name = v->getName(); } Is there specific documentation I can refer to implement this? Thanks -- *Ridwan Shariffdeen* Graduate Student | National University of Singapore -----------...
2009 Sep 28
4
[LLVMdev] Printing Function Arguments
...you look at something like: %a = add i32 %x, %y it's common to think "Well, I've got the Instruction* which is on the right hand side, how do I get the %a on the left hand side"? The answer is that the whole thing is actually: %I->getName() = I->getOpcode() I->op_begin()..I->op_end() There is only the Instruction *I. It _is_ the value that it produces. There is no register it's being stored into, that Instruction* is itself the definition of the register! Note that registers are immutable (being a static single assignment form) and that we have an inf...
2008 Apr 29
5
[LLVMdev] [PATCH] use-diet for review
Hi all, I have reported more than enough about the space savings achieved and the associated costs, here comes the current patch for review. Since this one is substantially smaller than the previous one, I did not cut it in pieces. The front part is about headers and the rest the .cpp and other files. Cheers, Gabor -------------- next part -------------- An embedded and charset-unspecified
2009 Sep 28
0
[LLVMdev] Printing Function Arguments
Hi Nick, I parsed your message again carefully and did some experiments. I guess the: for (User::op_iterator i = I->op_begin(), e = I->op_end(); i != e; ++i) { } iterates over the operands of the instruction "I", which are as you said, *other* instructions. But if I want to get other information about the instruction, say the type of the operands, then I still need to figure out how to do that, e.g. via t...
2011 Sep 22
2
[LLVMdev] How to const char* Value for function argument
...lt;CallInst>(cast<Value>(I)); if (!call) continue; Function* callee = call->getCalledFunction(); if (!callee && !callee->isDeclaration()) continue; if (callee->getName() != func2.getName()) continue; SmallVector<Value*, 16> callargs(call->op_begin(), call->op_end()); callargs.insert(callargs.begin(), ConstantInt::get(Type::getInt32Ty(context), call->getNumArgOperands())); callargs.insert(callargs.begin(), callee->getName()); CallInst* newcall = CallInst::Create(launch, callargs, "", call);...
2018 May 21
0
Getting variable names from LLVM Pass
...llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, > > I want to retrieve the variable names used in a statement, I tried the following snippet, > but it only gives me the variable named in llvm bitcode. I need the variable name in source code. > > for (auto op = I.op_begin(); op != I.op_end(); op++) { > Value* v = op->get(); > StringRef name = v->getName(); > } > > Is there specific documentation I can refer to implement this? > If the source language is something clang knows about, you may ha...
2002 Oct 27
0
[LLVMdev] Compile error in PreSelection.cpp
PreSelection.cpp uses the form "++(ConstantExpr*)->op_begin()" in a couple of places: gcc2 considers this to be an illegal use of a constant reference (the temporary iterator) as an lvalue. Fix is to use "(ConstantExpr*)->op_begin() + 1" instead. -- Casey Carter Casey at Carter.net ccarter at uiuc.edu AIM: cartec69 -------------- ne...
2002 Oct 27
0
[LLVMdev] Followup on Casey's patches
...o option to tell bison what to name > the outputs. Applied. > Statistic.cpp uses std::stable_sort without including <algorithm>. Applied. > Timer.cpp uses std::greater without including <functional>. Applied. > PreSelection.cpp uses the form "++(ConstantExpr*)->op_begin()" in a > couple of places: gcc2 considers this to be an illegal use of a constant > reference (the temporary iterator) as an lvalue. Fix is to use > "(ConstantExpr*)->op_begin() + 1" instead. Applied. > Another "big unsigned constant for 32-bit architecture&qu...
2006 Mar 03
1
[LLVMdev] printing constants
Sir, I am using the op_begin and op_end iterator for iterating over the operands as mentioned below. for (User::op_iterator operand=j->op_begin(),operand_end=j->op_end();operand!=operand_end;++operand){ Value *v=operand->get(); const Type *t=v->getType(); cerr<<endl<<" operand: "<<&q...
2018 May 24
1
Getting variable names from LLVM Pass
...gt; wrote: > > > > Hi, > > > > I want to retrieve the variable names used in a statement, I tried the > following snippet, > > but it only gives me the variable named in llvm bitcode. I need the > variable name in source code. > > > > for (auto op = I.op_begin(); op != I.op_end(); op++) { > > Value* v = op->get(); > > StringRef name = v->getName(); > > } > > > > Is there specific documentation I can refer to implement this? > > > > If the source language is so...
2009 Sep 28
0
[LLVMdev] Printing Function Arguments
Hi Nick, Perhaps I am confused. What is the best way to extract information from instructions ? Is it via the, say: for (User::op_iterator i = I->op_begin(), e = I->op_end(); i != e; ++i) .... I am not sure what happens next, e.g. to the variable 'i', you should know what part of the instruction this is and cast it to the necessary type. For example, I am parsing the 'inttoptr' instruction. In that case the loop iterates on...
2011 Sep 22
0
[LLVMdev] How to const char* Value for function argument
...edFunction(); if (!callee && !callee->isDeclaration()) continue; if (callee->getName() != func2.getName()) continue; SmallVector<Value*, 16> callargs(call->op_begin(), call->op_end()); callargs.insert(callargs.begin(), ConstantInt::get(Type::getInt32Ty(context), call->getNumArgOperands()));...
2008 Jul 23
0
[LLVMdev] GEP::getIndexValid() with other iterators
...Value* const *Idx, unsigned NumIdx); + + static const Type *getIndexedType(const Type *Ptr, + uint64_t const *Idx, unsigned NumIdx); + static const Type *getIndexedType(const Type *Ptr, Value *Idx); inline op_iterator idx_begin() { return op_begin()+1; } -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: Digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080723/deee3d06/attachment.sig>
2016 Apr 23
2
[IndVarSimplify] Narrow IV's are not eliminated resulting in inefficient code
...// If we found some loop invariants, fold them into the recurrence. > if (!LIOps.empty()) { > // NLI + LI + {Start,+,Step} --> NLI + {LI+Start,+,Step} > LIOps.push_back(AddRec->getStart()); > > SmallVector<const SCEV *, 4> AddRecOps(AddRec->op_begin(), > AddRec->op_end()); > - AddRecOps[0] = getAddExpr(LIOps); > + AddRecOps[0] = getAddExpr(LIOps, Flags); > > // Build the new addrec. Propagate the NUW and NSW flags if both the > // outer add and the inner...
2004 Oct 12
1
[LLVMdev] Re: Hide visible string in variable (Chris Lattner)
...some progress. Thanks again. But I am still stuck in some problems. Constant *Cstr = GV->getInitializer(); After that, I tried to use a. for(unsigned i=0;i<Cstr->getNumOperands();++i){ Cstr->getOperand(i); } b. for(User::op_iterator I=Cstr->op_begin(),E=Cstr->op_end(); I!=E;++I){ std::cerr<<*I; } From either a or b, I could get each element of Global Variable. Supposedly, I will use my arithmetic like XOR etc to encode/hide the string. But I cannot use XOR, I mean I tried (*I)^0x33, it doesn't work. I...
2008 Jul 23
2
[LLVMdev] GEP::getIndexValid() with other iterators
On Jul 22, 2008, at 11:54 PM, Matthijs Kooijman wrote: > Hi Chris, > > >> I'd prefer to not turn this into a template. Why not just define a >> version that takes an array of uint64_t's or something like that? > because I want to be able to pass in iterators. I could define a > version that > takes std<uint64_t>::iterators, but next thing we know, we
2016 Apr 20
2
[IndVarSimplify] Narrow IV's are not eliminated resulting in inefficient code
​Hi, Would you be able to kindly check and assist with the IndVarSimplify / SCEV problem I got in the latest LLVM, please? Sometimes IndVarSimplify may not eliminate narrow IV's when there actually exists such a possibility. This may affect other LLVM passes and result in inefficient code. The reproducing test 'indvar_test.cpp' is attached. The problem is with the second