[LLVMdev] Functions: sret and readnone
Stephan
stephan.reiter at gmail.com
Fri Nov 6 05:22:36 PST 2009
Hey Duncan,
> That said, maybe there
> is some special AA query method that I don't know about that asks "do you
> write any global state".
>From my limited understanding of the analysis framework, this method
could be "getModRefBehavior". It returns a value of the ModRefBehavior
enumeration type, which contains members such as DoesNotAccessMemory
or OnlyReadsMemory. In my case AccessesArguments is the correct one, I
guess.
Directly from the header:
// AccessesArguments - This function accesses function arguments in
well
// known (possibly volatile) ways, but does not access any other
memory.
So, there should be a way for optimization passes to know that the
only memory such a function touches is memory, which is accessible via
the pointers that are passed to it as arguments. In the particular
case of my sample function: a pointer to a value on the stack.
Best,
Stephan
More information about the llvm-dev
mailing list