Displaying 20 results from an estimated 700 matches similar to: "[LLVMdev] get the address in memory where an instruction lives"
2013 Sep 24
2
[LLVMdev] get the address in memory where an instruction lives
Hi,
i want to get the address in memory of an instruction pointer and use it as
a key in my tables.
i iterate over the instructions in LLVM IR like this:
for (Module::iterator fi = Mod->begin(), fi_end = Mod->end(); fi != fi_end;
++fi) {
for (inst_iterator I = inst_begin(fi), E = inst_end(fi); I != E; ++I) {
Instruction *ii = dyn_cast<Instruction>(&*I);
2013 Aug 29
2
[LLVMdev] unique id for a llvm Instruction
what if another pointer points to the same instruction?
Is this possible to happen?
Eirini
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130829/ad6ba4bb/attachment.html>
2013 Aug 29
0
[LLVMdev] unique id for a llvm Instruction
>
>
> what if another pointer points to the same instruction?
>
You can have many pointers to the same instruction. However, the address in
memory where that instruction lives is unique. Instruction pointers (or
Value pointers) are thus commonly used as keys in hash tables or similar.
Instructions or Values are almost never copied, so that you won't find the
same instruction at
2013 Oct 17
1
[LLVMdev] get the value of a Constant in LLVM IR
Hello,
i parse the llvm IR (llvm-3.3 version) and when i meet a constant, i want
to get it's value.
eg i32 5, i want to get the 5.
I am interested in ConstantInt-ConstantFP-ConstantArray-ConstantStruct
subclasses.
Things are a bit easier with ConstantInt and ConstantFP constants but how
could i get the value of a ConstantArray?
The
2004 Apr 23
0
[LLVMdev] subtle problem with inst_iterator
On Fri, 23 Apr 2004, Vladimir Prus wrote:
> Yea, I've noticed that. However, it looks like inst_iterator is iterator over
> pointers. Oh, wait a minite, that's the current code:
>
> inline IIty operator*() const { return BI; }
> inline IIty operator->() const { return operator*(); }
>
> So operator* works as if value_type is Instruction*, but operator->
2004 Apr 27
2
[LLVMdev] subtle problem with inst_iterator
Chris Lattner wrote:
> > inline IIty operator*() const { return BI; }
> > inline IIty operator->() const { return operator*(); }
> >
> > So operator* works as if value_type is Instruction*, but operator-> works
> > as if value_type is Instruction. Hmm ;-)
>
> Yeah, fishy huh? :)
Yea, a bit. I've decided that before changing that I'd better
2013 Jul 01
1
[LLVMdev] Problem with building llvm and running project
Hello,
i am new to LLVM and i want to create my own project with a cpp
file which calls
llvm functions and then run it. I download clang
source, llvm source and compiler-rt source.
I tried to configure and build llvm using this http://llvm.org/docs/GettingStarted.html#getting-started-with-llvm but it failed because .h files included on top of the Hello.cpp couldn't found. Can you tell me
2011 Aug 29
0
[LLVMdev] insertions with inst_iterators?
On Aug 29, 2011, at 12:38 PM, ret val wrote:
> I am looping through all instructions in a Function and depending on
> what I found I may or may not insert code. Despite the fact that I'm
> only actually inserting *before* instruction I have a infinite loop
> when I do something like below. For awhile it was simple enough to
> just increment i enough times but now I need
2012 Feb 16
0
[LLVMdev] Wrong AliasAnalysis::getModRefInfo result
Something must be wrong, more probable on my side. So the C source code is
unchanged, I just did another experiment to first extract all the GEPs in
the code, and call AliasAnalysis::alias on each pair of GEPs. Here is the
code:
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
TargetData &TD = getAnalysis<TargetData>();
for (Module::iterator it = M.begin();
2018 Aug 08
2
Error Calling eraseFromParent()
Hi. Thanks. I changed the code but the problem exists. This is my new code
which is again very simple:
...
bool runOnFunction(Function &F) override {
vector<Instruction *> dels;
dels.clear();
for (inst_iterator It = inst_begin(&F), Ie = inst_end(&F); It != Ie;) {
Instruction *I = &*(It++);
if (auto* op = dyn_cast<BinaryOperator>(I)) {
IRBuilder<NoFolder>
2011 Aug 23
2
[LLVMdev] write IR on file
hi
how can i write IRinstruction on a file.txt? when i use {for(inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I,count++) IRcodefile << std::basic_ostream(*I) <<"\n" } i get error.
is there any way that i can write it on file?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2004 Apr 23
2
[LLVMdev] subtle problem with inst_iterator
Hello, I think there's a rather subtle problem with the inst_iterator. It
declares its iterator category as std::bidirectional_iterator_tag but C++
standard requirements for forward iterator (which are included in
requirements for bidirection iterator), say that the type of expression
*r;
should be T&, where 'r' is the iterator and T is its value type. The
inst_iterator,
2007 Nov 23
1
[LLVMdev] how to dump a Instruction in gdb?
On Nov 23, 2007 5:29 PM, Duncan Sands <baldrick at free.fr> wrote:
> Hi,
>
> > I want to know how to dump the a instruction in gdb. I can dump a
> Module
> > use M.dump(), also is there any such print function which can be used in
> gdb
> > for a single instruction and its operand?
>
> you can dump most things in LLVM the same way as for a module: if I
2004 Apr 23
2
[LLVMdev] subtle problem with inst_iterator
Chris Lattner wrote:
> On Fri, 23 Apr 2004, Vladimir Prus wrote:
> > and since result of *it is considered to be rvalue it can't be accepted
> > by this operator. The complete discussion is in
> >
> > http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm
> >
> > I'd suggest to apply the following patch which makes operator* return
>
2011 May 07
1
[LLVMdev] def-use chain for Instruction
Hello all,
I am a LLVM newer who want to obtain the use-def chain for all instruction
of a sample code, for this purpose i use the following code.
///////////////sample code://///////////////////////
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define ARRAY_SIZE 5
int main() {
int x, y, holder;
int k,z,f,i;
z=0;
f=0;
k=0;
for(x = 0; x < ARRAY_SIZE;
2004 Apr 23
0
[LLVMdev] subtle problem with inst_iterator
On Fri, 23 Apr 2004, Vladimir Prus wrote:
> and since result of *it is considered to be rvalue it can't be accepted by
> this operator. The complete discussion is in
>
> http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1385.htm
>
> I'd suggest to apply the following patch which makes operator* return
> reference to pointer. It makes my code compile and the rest
2010 Apr 21
0
[LLVMdev] How to delete a instruction?
lucefe wrote:
> I did a simple test just now, but I alse failed.
>
> I delete several ordered instructions from end to begin,
> but after deleting the first instruction(the last instruction of F),
> the program crashed.
> My test code is below (F is a function only containing several
> sequential instructions):
>
> for (inst_iterator inst == --inst_end(F); inst !=
2010 Feb 26
0
[LLVMdev] a question of the simple constant propagation pass
Hi,
I copied the code from LLVM2.6 below.
line 81 removes 'I' from the worklist. But 'I' is already
removed from the list at line 67 when it is popped from the list.
Could the loop (line 73-75) insert this I into the worklist again?
In the case where 'I' can be constant-folding, Line 80 says 'I' is
a dead instruction. Can 'I' appears in its def-use chain?
2013 Sep 15
0
[LLVMdev] Are instr_iterators invalidated when function inlining is performed?
I just realised I forgot to reply to this. Thanks for advise, it's good to know.
Thanks,
Dan Liew.
On 30 August 2013 16:25, David Blaikie <dblaikie at gmail.com> wrote:
> On Fri, Aug 30, 2013 at 7:53 AM, Daniel Liew <daniel.liew at imperial.ac.uk> wrote:
>> Hi,
>>
>> I'm trying to write a small piece of code that inlines all calls to a
>> particular
2010 Apr 21
2
[LLVMdev] How to delete a instruction?
I did a simple test just now, but I alse failed.
I delete several ordered instructions from end to begin,
but after deleting the first instruction(the last instruction of F), the
program crashed.
My test code is below (F is a function only containing several sequential
instructions):
for (inst_iterator inst == --inst_end(F); inst != inst_begin(F); --inst) {
Instruction * i = &*inst;