Displaying 20 results from an estimated 64 matches for "op_end".
2005 Jul 12
0
[LLVMdev] Getting started with LLVM Passes
...ould 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: " << j << "\n...
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
-------------- next part ----...
2009 Sep 28
4
[LLVMdev] Printing Function Arguments
...hing 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 infinite register s...
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 the I->getSrcTy()...
2011 Sep 22
2
[LLVMdev] How to const char* Value for function argument
...lt;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);
newcall->takeNam...
2007 Sep 24
0
[LLVMdev] RFC: Tail call optimization X86
...nt();
+ BasicBlock::iterator BI = &I;
+ assert(BI != BB->end() && "Woohooa");
+ ++BI;
+ if (BI != BB->end()) {
+ ReturnInst *RI = dyn_cast<ReturnInst>(BI);
+ if (RI) {
+ if (RI->getReturnValue()==0 ||
+ std::find(RI->op_begin(), RI->op_end(),
+ (Value*)&I) != RI->op_end()) {
+ IsNextInstRet=true;
+ }
+ }
+ }
+ return IsNextInstRet;
+}
+
Some stylistic nitpicks. Please write the comments as:
/// IsNextInstructionReturn - Check whether..
+ assert(BI != BB->end() && "Woohooa&...
2007 Sep 23
2
[LLVMdev] RFC: Tail call optimization X86
The patch is against revision 42247.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tailcall-src.patch
Type: application/octet-stream
Size: 62639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070923/4770302f/attachment.obj>
2018 May 21
0
Getting variable names from LLVM Pass
...v 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 have to implement th...
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: "<<"[ "...
2018 May 24
1
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?
> >
>
> If the source language is something clang know...
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 only once, but then, I...
2011 Sep 22
0
[LLVMdev] How to const char* Value for function argument
...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()));
c...
2007 May 21
1
[LLVMdev] Simplifing the handling of pre-legalize vector nodes
...to be aware of the new kinds of ValueTypes so that they could handle them
properly, but once that's done, it would allow vector nodes to be handled
consistently between pre-legalize and post-legalize, without obscure
constructs like
... blahblah->getNumOperands()-2 ...
... *(blahblah->op_end()-1) ...
to get the vector length and/or element type in the pre-legalize form.
It would make -view-legalize-dags and earlier DAG drawings a lot easier to
read in DAGS with vector nodes, because they wouldn't need to be edges from
each vector node up to the common element type node and vector...
2016 Apr 23
2
[IndVarSimplify] Narrow IV's are not eliminated resulting in inefficient code
...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 addrec are guaranteed to have no
> overflow.
> // Always p...
2004 Oct 12
1
[LLVMdev] Re: Hide visible string in variable (Chris Lattner)
...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 tried op_xor, but I...
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
2015 Sep 13
3
RFC: faster simplifyInstructionsInBlock/SimplifyInstructions pass
...// Loop over all of the values that the instruction uses. If there are
// instructions being used, add them to the worklist, because they might
// go dead after this one is removed.
SmallVector<Instruction *, 8> Operands;
for (User::op_iterator OI = I->op_begin(), E = I->op_end(); OI != E; ++OI)
if (Instruction *Used = dyn_cast<Instruction>(*OI))
Operands.push_back(Used);
// Remove the instruction.
I->eraseFromParent();
// Only add the operands to the worklist if their uses are now empty,
// to avoid needlessly revisiting instructi...
2008 Apr 29
0
[LLVMdev] [PATCH] use-diet for review
...entPtrInst(Ptr, Idx, Name, InsertBefore);
}
What is the magic "2"?
+GetElementPtrInst::GetElementPtrInst(const GetElementPtrInst &GEPI)
+ : Instruction(reinterpret_cast<const Type*>(GEPI.getType()),
GetElementPtr,
+ OperandTraits<GetElementPtrInst>::op_end(this) -
GEPI.getNumOperands(),
+ GEPI.getNumOperands()) {
+ Use *OL = OperandList;
+ Use *GEPIOL = GEPI.OperandList;
+ for (unsigned i = 0, E = NumOperands; i != E; ++i)
+ OL[i].init(GEPIOL[i], this);
+}
Please just move methods like this out of line when possible.
+DEFINE_T...
2009 Sep 06
3
[LLVMdev] Graphviz and LLVM-TV
...essor/successor instructions (inputs/outputs), to register
> their connectivity (edges). Right?
Well the GraphTraits in DataFlow.h are really simple, LLVM's graph
algorithms expect
a child_begin()/child_end(), so DataFlow.h only maps
child_begin/child_end to use_begin/use_end, and op_begin/op_end for the
Def-Use, and Use-Def graphs respectively.
That however doesn't know of any basicblock boundaries, it enumerates
*all* uses of a value, so I think that writing out a full DFG is easier
than writing out a partial one.
>
>
> thanks,
> Ioannis
>
>
>
> PS: By the way...