Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overlay attributes in the compiler (overlaycall, overlaydata) #28

Open
edward-jones opened this issue Nov 4, 2021 · 1 comment
Open
Assignees

Comments

@edward-jones
Copy link
Contributor

Opening a discussion from feedback on the Clang/LLVM patches.

https://reviews.llvm.org/D109372
https://reviews.llvm.org/D109371

Currently the naming of the attributes matches the spec, using separate attributes __attribute__((overlaycall)) and __attribute__((overlaydata)) for functions and global data respectively. There are a couple of possible changes that are worth discussing though:

  • Renaming the attributes to overlay_call and overlay_data, or alternatively maybe something like overlay_function and overlay_data.
  • Merging the attributes into a single overlay attribute.

The former change is mainly concerning readability. As far as I'm aware it's generally not consistent in GCC/Clang whether attributes include an underscore, but in generally snake case is acceptable and considered easier to read. Also I'm not sure whether overlay_function would be better than overlay_call because it's more explicit that the function exists in an overlay.

The second change is something which I implemented in a previous version of the Clang patch. It is possible to use a single overlay attribute and then differentiate entirely on what kind of Decl the attribute is applied to rather than using separate attributes. This makes the interface a bit simpler, but I can think of a couple of disadvatages:

  • Diagnostics would either be less precise, or would have to differentiate functions vs data anyway
  • Users might mistakenly believe that the attribute is a type attribute and then misunderstand the semantics when applying it to a global function pointer.
@edward-jones
Copy link
Contributor Author

Updated the attribute names in #32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants