[llvm-dev] Checking for write access in/directly
D B via llvm-dev
llvm-dev at lists.llvm.org
Thu Dec 10 06:58:09 PST 2015
I'm currently working on a ModulePass that modifies GlobalVariables. I
have searched the documentation over and over again but I could not find
a solution to my problem.
What would be the best way to check whether my GlobalVariable is
*really* constant? By that I mean I want to know if there is write
access (directly or via pointer); I need to know that the value of my
GlobalVariable will never change throughout the program.
I would also like to know if a variable my GlobalVariable was assigned
to is used in a memory-accessing statement such as m/c/realloc, memcpy, etc.
My "workaround" so far is that I recursively check all users and uses
that might write (StoreInsts, ...), I also follow assignments (GEP,
LoadInsts, ...) and into function calls (by parsing the argument list).
While this works it is excrutiatingly slow and I can't imagine there
wouldn't be an easier way to achieve the same goal.
Am I missing something?
More information about the llvm-dev