On Nov 12, 2012, at 4:19 AM, <llvmdev-request at cs.uiuc.edu> wrote:
> Date: Mon, 12 Nov 2012 10:58:40 +0100
> From: Duncan Sands <baldrick at free.fr>
> To: llvmdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] Find size of memory pointer is pointing to
> Message-ID: <50A0C850.8050106 at free.fr>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi Sunil, you can do this using the routines in
llvm/Analysis/MemoryBuiltins.h.
These routines are useful to identify memory allocation points and other memory
objects. If you want to determine the size for an arbitrary pointer in a
program, though, the harder problem is propagating the size information from the
allocation to a place where a pointer is used. This requires a (simple)
interprocedural dataflow analysis but will always be limited by imprecise call
graphs and by context-dependent differences.
--Vikram
>
> Ciao, Duncan.
>
> On 11/11/12 21:19, sunil rathee wrote:
>> Hi,
>> Can we find the size of memory a pointer is pointing to in LLVM. For
example
>> type *p = (type *)malloc(sizeof(type)*20);
>> then it should give us size as sizeof(type) * 20.
>>
>> --
>> Sunil Rathee
>> MTech
>> IIT Delhi
>>
>> Not going along with the crowd can help you stand out in the crowd
>>
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>