[PATCH] D90275: [clang][IR] Add support for leaf attribute

Gulfem Savrun Yeniceri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 3 12:20:29 PST 2020


gulfem marked an inline comment as done.
gulfem added a comment.

In D90275#2371343 <https://reviews.llvm.org/D90275#2371343>, @jdoerfert wrote:

> The more I think about it, the more I think we should never create a `leaf`/`nocallback` definition. Only declarations should carry that attribute.
>
> I'm also still not convinced `nocallback` is a good name. @efriedma @aqjune @fhahn @reames What are your thoughts on the name. My earlier idea was `inaccesiblecodeonly`, as it matches the `inaccisblememonly` idea. I'm not married to it, `nocallback` is just not great IMHO as direct calls back into the caller TU are also forbidden and there is already `!callback`.

We are totally fine to rename it to something else, and we do see the potential confusion with the existing callback attribute that we have.
If I understand correctly, `inaccessiblememonly` functions may only access memory that is not accessible by the **current** compilation unit (current compilation unit means the compilation unit that inaccessiblememonly function is defined).
If we use `inaccesiblecodeonly`, it implies that leaf functions may only access code that is not accessible by the compilation unit that they are defined.
But, leaf attribute does not enforce any rule for accessing code in the leaf attribute function's compilation. 
It only enforces that leaf function does not access any code in its `caller's translation unit`.
That's is why I'm not sure whether `inaccesiblecodeonly` is a good name for that.
Please let me know if I'm missing anything about inaccessiblememonly attribute.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90275/new/

https://reviews.llvm.org/D90275



More information about the cfe-commits mailing list