[llvm] r185735 - Extend 'readonly' and 'readnone' to work on function arguments as well as

Nick Lewycky nicholas at mxc.ca
Fri Jul 5 18:08:25 PDT 2013


Chandler Carruth wrote:
>
> On Fri, Jul 5, 2013 at 5:29 PM, Nick Lewycky <nicholas at mxc.ca
> <mailto:nicholas at mxc.ca>> wrote:
>
>     +  bool onlyReadsMemory(unsigned n) const {
>     +    return AttributeSets.hasAttribute(n, Attribute::ReadOnly) ||
>     +           AttributeSets.hasAttribute(n, Attribute::ReadNone);
>     +  }
>     +  void setOnlyReadsMemory(unsigned n) {
>     +    addAttribute(n, Attribute::ReadOnly);
>     +  }
>     +
>
>
> It seems weird interface wise to only expose this in the 'or' form. I
> know the only user you have today expects that form, but interface wise
> it would seem cleaner to either expose the attribute semantics directly,
> or to expose an OR of the attributes and the readnone separately (as
> readnone is essentially a strict subset of readonly).

This is how the readnone/readonly function attributes already worked, I 
just added 'parameter n' variants. I can't think of any clients who are 
interested in seeing that something is readonly-but-not-readnone.

Nick



More information about the llvm-commits mailing list