Displaying 20 results from an estimated 1000 matches similar to: "[LLVMdev] Distinguishing Pointer Variable and Ordinary Variable"
2013 Sep 01
0
[LLVMdev] Distinguishing Pointer Variable and Ordinary Variable
Check it's type to see if it's a pointer or not?
On 1 September 2013 12:31, Abhinash Jain <omnia at mailinator.com> wrote:
> C Code :-
> int main()
> {
> int a=10,c;
> int *b;
> c=20;
> *b=a;
> return 0;
> }
>
> IR of above code :-
> define i32 @main() #0 {
> entry:
> 1. %retval = alloca i32, align 4
> 2. %a = alloca i32, align 4
2013 Sep 01
2
[LLVMdev] Distinguishing Pointer Variable and Ordinary Variable
Sorry I have actually edited the post.
I did check its type by using
isa<PointerType>(cast<AllocaInst>(instr->getOperand(1))->getAllocatedType())
but it is only detecting i32** %b on line 8 of IR as a pointer type.
Whereas I also want to detect the i32* %1 on line 11 of IR as a pointer
type. So how can I do this??
--
View this message in context:
2013 Sep 01
0
[LLVMdev] Distinguishing Pointer Variable and Ordinary Variable
Hi,
On 1 September 2013 15:47, Abhinash Jain <omnia at mailinator.com> wrote:
> Sorry I have actually edited the post.
This is primarily an e-mail list; the vast majority of us won't see
any edits (on some web mirror?).
> I did check its type by using
> isa<PointerType>(cast<AllocaInst>(instr->getOperand(1))->getAllocatedType())
> but it is only detecting
2010 Jul 21
1
[LLVMdev] How to recognize pointer variable & ordinary variable
Your last statement is correct. But still my stand does not change. I want
to differentiate ordinary local variable & pointer variables.
Let's have a program,
int a,b,c,*ptr;
I want to extract only the local variables. That's what my question was. I
think it is clear now. cast<PointerType>(A->getType()
>
> )->getElementType() is not working. I am also getting error
2010 Jul 21
2
[LLVMdev] How to recognize pointer variable & ordinary variable
How to recognize pointer variable & ordinary variable? I have tried with
"isa<PointerType>(V->getType())", but failed.
--
regards,
soumya prasad ukil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100722/8a751551/attachment.html>
2010 Jul 21
0
[LLVMdev] How to recognize pointer variable & ordinary variable
Hi Soumya_Prasad_Ukil,
> How to recognize pointer variable & ordinary variable? I have tried with
> "isa<PointerType>(V->getType())", but failed.
I'm not sure what you are asking, but if you are asking whether an
alloca instruction A represents local memory of pointer type, you
can use A->getAllocatedType(). You can also use
2013 Jun 18
3
[LLVMdev] Getting the memory address of all operands on an expression
> in LLVM IR, the operands of most expression are registers, so don't have a
memory address.
Yes I agree with your this statement,
But before becoming part of the expressions, the registers will actually
fetch some value from memory, through Load operations.
as shown in example "r3=r1+r2" will be the expression, where registers such
as r1 and r2 contains (fetch) the values from
2013 Jul 26
2
[LLVMdev] LLVM ERROR : Invalid instruction
@Jim Grosbach,
Is there anyway to resolve it???
--
View this message in context: http://llvm.1065342.n5.nabble.com/LLVM-ERROR-Invalid-instruction-tp59856p59865.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
2013 Jun 10
3
[LLVMdev] Getting the memory address of all operands on an expression
How to get memory address of all operands which constitutes an expression ?
eg. a=b+c; (want to know the memory address of b and c)...... Since I want
this at run time, So at assembly level this expression will become something
like as follows:-
Load r1, M[b]
Load r2, M[c]
r3=r1+r2
store M[a],r3
Now what i want to do is that, at every store instruction, I should get the
memory address of all
2013 Jun 18
0
[LLVMdev] Getting the memory address of all operands on an expression
On Mon, Jun 17, 2013 at 11:49 PM, Abhinash Jain <omnia at mailinator.com>wrote:
>
> But before becoming part of the expressions, the registers will actually
> fetch some value from memory, through Load operations.
>
This is not true; the virtual registers need not be loaded from memory. You
may find <
2013 Oct 19
2
[LLVMdev] Name of Virtual Registers
How can I get the name of the virtual Registers present on an instruction.
eg. %add18 = add nsw i32 %mul17, %37
in this case I want to extract the name of the virutal registers as "add18",
"mul17","37".
This can easily be done in the case of store Instruction
eg. store i32 %add20, i32* %t, align 4
in this case functions like
2006 Apr 12
6
distinguishing mapped urls from ordinary action urls
I want to present different view depending on the url.
example below:
http://myapp/start/show?url=xZq
http://myapp/xZq
both addresses are controlled by a single controller and the same action.
the second url is only mapped in routes.rb
how can I distinguished the mapped url and present a slightly different view
in it?
Sabon
-------------- next part --------------
An HTML attachment was
2013 Jul 25
2
[LLVMdev] Passing String to an external function in llvm
Hi All,
On my llvm pass I have some variable named "expr" which is being declared as
:-
string expr; // or char *expr; //
Now I want to pass this "expr" to some external function.
How can I do this??
Similarly, How can I pass variable "var" to an external function which is
being decalred as :-
Vector<int> var;
Any help will be
2013 Jul 26
2
[LLVMdev] LLVM ERROR : Invalid instruction
#include <string>
#include <string.h>
#include <iostream>
#include <stdio.h>
using namespace std;
void foo(string str)
{
}
int main()
{
string str="aa";
foo(str);
return 0;
}
1. clang++ -c -emit-llvm foo.cpp -o foo.ll
2. llc -march=cpp -o foo.ll.cpp foo.ll (at the execution of this command
its giving an error as "Invalid Instruction")
May I know why
2013 Jul 25
2
[LLVMdev] Passing String to an external function in llvm
I did some computation through llvm pass, and store those computed values on
string. eg. :-
stringstream lhs;
lhs << instr->getOperand(1); // 'instr' is some instruction
string lhsvar=lhs.str();
Now I want to pass this 'lhsvar' to the external function, so how can i do
this???
This is just the part of a code to make you understand. if you say I can
even provide the
2008 Apr 21
2
[LLVMdev] newbie question for type comparison
On Apr 21, 2008, at 15:07, John Criswell wrote:
>> 1. For getting ALL struct allocation, when I use
>>
>> if( (AI = dyn_cast<AllocaInst>(&*i)))
>> if(AI->getOperand(0)->getType()->getTypeID() ==
>> Type::StructTyID) {
>>
>> to get all alloca instructions allocating a structure, it does not
>> work. In my gdb
2013 Jul 25
2
[LLVMdev] Passing String to an external function in llvm
I have one file named hashtable.cpp whose link is
"http://pastebin.com/Cq2Qy50C"
and one llvm pass named testing.cpp whose link is
"http://pastebin.com/E3RemxLF"
Now on this testing.cpp pass I have computed the string named "expr" which I
want to pass to the function named hashtable(string) in hashtable.cpp (on
line 106 of testing.cpp)
> looking at simple
2013 Jul 25
2
[LLVMdev] Passing String to an external function in llvm
Thanx for the response.
%x = alloca i32, align 4
%y = alloca i32, align 4
%a = alloca i32, align 4
%t = alloca i32, align 4
1. %10 = load i32* %x, align 4
2. %11 = load i32* %y, align 4
3. %div = sdiv i32 %10, %11
4. %12 = load i32* %a, align 4
5. %mul4 = mul nsw i32 %div, %12
6. store i32 %mul4, i32* %t, align 4
a. %mul4 = mul nsw i32 %div, %12
b. %div = sdiv i32 %10, %11
c. %10 =
2013 Jul 25
1
[LLVMdev] Passing String to an external function in llvm
> OK - seems you might want to take a few steps back & understand how
> C++ code is written/structured generally (and/or take a look at other
> parts of the compiler). You'll need a header file with the declaration
> of your function & you can include that header file in the
> hashtable.cpp and testing.cpp - if that sentence doesn't make sense to
> you yet, please
2008 Apr 21
3
[LLVMdev] newbie question for type comparison
Hi John,
Thank you a lot. That clarifies some my confusions. What I want to do
is to use both methods, get ALL struct allocation and a SPECIFIC struct
allocation, at different situations. Here, I've got a couple of more
questions.
1. For getting ALL struct allocation, when I use
if( (AI = dyn_cast<AllocaInst>(&*i)))