[llvm-dev] Tracing global variables use in llvm

suyog sarda via llvm-dev llvm-dev at lists.llvm.org
Sun Jun 12 05:04:08 PDT 2016


Hi Arun,

You can do it by iterating over arguments to function call and
dyn_cast<GlobalVariable> each of them to check if it is a global variable.

Regards,
Suyog
On 12 Jun 2016 15:03, "ARUN TEWATIA via llvm-dev" <llvm-dev at lists.llvm.org>
wrote:

I am trying to write a custom analysis pass. Below is a llvm-ir snippet
from my module.

1 @my_string = common global i8* null, align 8
2 %tmp1 = load i8*, i8** @my_string, align 8
3 call void @copy_string(i8* %tmp1, i8* %tmp2, i8* %tmp3)

I wish to make a check, if one of the function parameters passed is a
global variable or not? For instance in above example code, I wish to check
if %tmp1 is a global variable or not?

Could you suggest the best way to achieve this?

Thanks in advance.

-- 
*Arun Tewatia*

_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160612/297affee/attachment.html>


More information about the llvm-dev mailing list