p4c
p4c copied to clipboard
Add pure/localState/packetStata annotations
- add annotations in appropriate places in v1mode.p4 and psa.p4
- fix resolveReferences to look at parameters
In the interests of moving things forward here, if @pure
and @noSideEffects
are the only two annotations that we really have good use cases for taking advantage of in compiler optimization passes, would it be better to only add those two, and leave out all of the others?
I apologize if I introduced confusion by describing the other kinds of annotations -- just my over-exuberance in looking for other broader kinds of categories that extern functions/methods fit into, regardless of whether they enabled compiler optimizations.
The parts of these changes that add the @pure
annotation, and changes to v1model.p4 and psa.p4 architectures to add @pure
and @noSideEffects
annotations, have been merged with this commit: https://github.com/p4lang/p4c/commit/301411d7ee4cc22d381a923037f840f575635aa2
As of this writing, there is currently no PR that makes the rest of these changes. I do not know if such a thing is of interest, either, until and unless there is a known compiler optimization use case for additional similar annotations.
@ChrisDodd @mihaibudiu Does it seem reasonable to close this, since @pure
and @noSideEffects
have been in the P4 spec and p4c implementation for a couple of years now, and no one seems interested in pursuing other annotations like packetState
since then?
I have no problem closing this, but it is Chris' PR.