[LLVMdev] [LLVMDEV]How could I get function name in this situation?
John Criswell
criswell at illinois.edu
Wed Jan 26 13:33:06 PST 2011
On 1/26/11 3:28 PM, songlh at cs.wisc.edu wrote:
>> On 1/26/11 3:06 PM, songlh at cs.wisc.edu wrote:
>>>> [snip]
>>>> -- John T.
>>> Sorry, I am asking the second question.
>>> "
>>> how to determine, within an LLVM pass, what the
>>> possible target(s) of an indirect function call might be?
>> There are at least two solutions.
>>
>> The first is to use the CallGraph analysis pass. It constructs a
>> conservative call graph, meaning that any indirect function call is
>> assumed to call any address-taken function. For some applications, this
>> is good enough, and for others, it isn't.
>>
>> If you need more precise results, you can use DSA. It is part of the
>> poolalloc project. It is a points-to analysis that attempts to build a
>> more accurate call-graph. In some cases, it probably works well; in
>> other cases, it may not do any better than the LLVM CallGraph analysis.
>>
>> You can get DSA by doing the following check-out:
>>
>> svn co https://llvm.org/svn/llvm-project/poolalloc/trunk poolalloc
>>
>> Directions on configuring it and examples of how to use it can be found
>> in the SAFECode project: http://safecode.cs.illinois.edu.
>>
>> If you want to use DSA, please let me know, and I can point you to an
>> example in SAFECode or the Poolalloc source code that uses the
>> DSCallGraph interface.
>>
>> -- John T.
>>
> Could you please point me the DSA example in poolalloc project? I just
> check that code out.
Line 914 of lib/PoolAllocate/TransformFunctionBody.cpp. You basically
get the DSGraph of the function, then get the DSCallGraph from the
DSGraph, and then query the DSCallGraph for the call instruction.
Note that you should use dsa-td (the Top-Down DSA pass).
-- John T.
> Thanks a lot!
>
> linhai
>
>>> "
>>>
>>> thanks a lot!
>>>
>>> Linhai
>>
>
More information about the llvm-dev
mailing list