[LLVMdev] Distinguishing Pointer Variable and Ordinary Variable

Abhinash Jain omnia at mailinator.com
Sun Sep 1 04:31:47 PDT 2013


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
3.  %c = alloca i32, align 4
4.  %b = alloca i32*, align 8
5.  store i32 0, i32* %retval
6.  store i32 10, i32* %a, align 4
7.  store i32 20, i32* %c, align 4
8.  %0 = load i32* %a, align 4
9.  %1 = load i32** %b, align 8
10.  store i32 %0, i32* %1, align 4
11.  ret i32 0
}


Line 8,9,10 of IR represents  *b=a;

Now I want to recognise whether i32* %1  on line 10 is a pointer variable or
ordinary variable through llvm pass.
So how to solve this issue ???



--
View this message in context: http://llvm.1065342.n5.nabble.com/Distinguishing-Pointer-Variable-and-Ordinary-Variable-tp60881.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list