[LLVMdev] setOnlyReadsMemory / setDoesNotAccessMemory

Nyx mcheva at cs.mcgill.ca
Fri Jul 24 11:46:24 PDT 2009


Hello,

I'm in a situation where my code is calling many native functions.
Sometimes, these calls are simply calls to static "accessor" methods that
read a variable in some class object (object pointer as input, member
variable value returned as output). I was wondering if using the
setOnlyReadsMemory method on the native function objects could help LLVM
generate optimized code (because it would then know the function has no side
effects), and say, eliminating redundant calls to the same accessor
function.

Also, I would like to know what setDoesNotAccessMemory means exactly. Is it
used to mean that a function accesses no memory (neither read nor write)
outside of its stack frame? I'm just puzzled as to the meaning of the flags
these two methods set on a function, and whether they are useful or not for
LLVM to perform optimizations (and if they are, what optimization pass makes
use of them).

Thank you for your help,

- Maxime
-- 
View this message in context: http://www.nabble.com/setOnlyReadsMemory---setDoesNotAccessMemory-tp24649914p24649914.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list