Reputation: 301
How can I get all the variables (from bytecode file or IR file) with const modifier or the variables that are not changed due execution? I need to make list for further use.
Upvotes: 2
Views: 2315
Reputation: 273366
I'm not sure you can get what you want directly because const
is a C/C++ semantic that's useful for Clang but much less so for LLVM. Only some const
promises are preserved (for example the readonly
attribute on pointer function arguments - see the language reference for details).
LLVM IR level "constants" are something entirely different, and usually refer to actually constant (compile-time known) values that can be efficiently uniqued, etc. Read this documentation for the full scoop.
Upvotes: 1