<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=GB2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi, all<br>
<br>
When I read the document of IR on llvm.org,<br>
I found two instructions, "ptrtoint" and load.<br>
<br>
Load, I think, is : when after allocating some<br>
bytes in memory and storing some data into it, we could<br>
use load to get the data, like this:<br>
<font color="#009900"><br>
%0 = alloca i32<br>
store i32 5, i32* %0<br>
%1 = load i32* %0</font><br>
so, the type of %1 is i32, and the value is 5, right?<br>
<br>
And "ptrtoint" is:we cast it from ptr to int? Just like<br>
"&" in c++ ? When we are doing like this:<br>
<font color="#009900"><br>
%0 = alloca i32<br>
store i32 5, i32* %0<br>
%1 = ptrtoint i32* %0 to i32</font><br>
No doubt, the type of %1 is i32. But what is the value of %1?<br>
Is it just like "load", loading the value stored, or becoming a
"var"<br>
to store the address(not the real value stored in memory)?<br>
<br>
If I want to get the value stored in memory, I should use load,<br>
and if I want to get the addr of the ptr, use ptrtoint, am I right?<br>
<br>
Could anyone tell me the difference between them clearly?<br>
<br>
Best Regards<br>
<br>
Weixue<br>
</body>
</html>