P4C
The P4 Compiler
Loading...
Searching...
No Matches
BFN::ActionSynthesisPolicy Class Reference

#include <action_synthesis_policy.h>

Inheritance diagram for BFN::ActionSynthesisPolicy:
[legend]

Public Member Functions

 ActionSynthesisPolicy (const std::set< cstring > *skip, P4::ReferenceMap *refMap, P4::TypeMap *typeMap)
 
- Public Member Functions inherited from P4::ActionSynthesisPolicy

Detailed Description

This class implements a policy suitable for the SynthesizeActions pass:

  • do not synthesize actions for the controls whose names are in the specified set. For example, we expect that the code in the deparser will not use any tables or actions.
  • do not combine statements with data dependencies (except on Hash.get) into a single action
  • do not combine uses of externs (other than Hash and Register write-after-read) into one action The hash exceptions above are because a common idiom is to use a hash function to hash some data and use the result as the index into a table execute method. We prefer keeping that in one action as we can do it directly; if split it requires extra PHV (to hold the hash value) and an extra stage.

It would probably be better to allow ActionSynthesis to combine stuff as much as possible and later split actions that don't work in a sinlge cycle. We don't yet have a general action splitting/rewriting pass, however, and this is simpler for now.