This is an archive of the discontinued LLVM Phabricator instance.

Adding a new [[clang::impossible_enum]] attribute to clang
Needs ReviewPublic

Authored by beanz on Dec 22 2014, 3:34 PM.

Details

Reviewers
alexr
Summary

This attribute provides a way to instruct the compiler that a given enum value is never valid. This specification can allow large segments of code to be dead stripped.

One hypothetical use of this is my RFC on stripping intrinsics for un-used targets in LLVM (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-December/079818.html).

In this case the attribute would allow us to remove the code and constant data for unusable attributes without needing to litter around #ifdefs.

Disclaimer: This idea came from Alex Rosenberg... Beware.

Diff Detail

Event Timeline

beanz updated this revision to Diff 17576.Dec 22 2014, 3:34 PM
beanz retitled this revision from to Adding a new [[clang::impossible_enum]] attribute to clang.
beanz updated this object.
beanz edited the test plan for this revision. (Show Details)
beanz added reviewers: alexr, aaron.ballman.
beanz added a subscriber: Unknown Object (MLST).
rnk added a subscriber: rnk.Dec 22 2014, 4:10 PM

This is an interesting idea, but I kind of want to hold off on it. I think TableGen is just making the wrong tradeoff between code size and performance in Intrinsics.gen here.

aaron.ballman resigned from this revision.Oct 13 2015, 5:55 AM
aaron.ballman removed a reviewer: aaron.ballman.