Shen Liu
2015-Jul-17 14:57 UTC
[LLVMdev] For a pointer to pointer ?How to fast get the pointee pointer?
Hi all, i am coding to analyze an IR with multi-level pointers, and i am eager to know whether there exists a way to find the pointee pointer directly, if only given an upper level pointer. For example, in the following demo, C code: int i = 10; int *p = &i; int **pp; *pp = &p; IR code: %i = alloca i32, align 4 %p = alloca i32*, align 8 %pp = alloca i32**, align 8 store i32 10, i32* %i, align 4 store i32* %i, i32** %p, align 8 %0 = bitcast i32** %p to i32* If I know the value of *pp *already, Is there a fast method for me to find pointer *p *directly? And if not must I consider AA case here? Thanks! Best Regards, Shen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150717/81e3e5c5/attachment.html>
Daniel Berlin
2015-Jul-17 15:05 UTC
[LLVMdev] For a pointer to pointer ?How to fast get the pointee pointer?
This is a statically undecidable problem, so yes, you must consider AA, and there can be nothing that provides an exact answer in all cases. There is nothing in LLVM that will help you, but folks have developed datastructures that can give fast answers to points-to and pointed-by queries: http://helloqirun.github.io/papers/pldi2014_xiao.pdf
Shen Liu
2015-Jul-17 15:12 UTC
[LLVMdev] For a pointer to pointer ?How to fast get the pointee pointer?
Got it, thank you Daniel, Have a nice day! On Fri, Jul 17, 2015 at 11:05 AM, Daniel Berlin <dberlin at dberlin.org> wrote:> This is a statically undecidable problem, so yes, you must consider > AA, and there can be nothing that provides an exact answer in all > cases. > > There is nothing in LLVM that will help you, but folks have developed > datastructures that can give fast answers to points-to and pointed-by > queries: > http://helloqirun.github.io/papers/pldi2014_xiao.pdf >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150717/a9fc3585/attachment.html>