P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
P4::SimplifyBitwise Class Reference
Inheritance diagram for P4::SimplifyBitwise:

Public Member Functions

const IR::Node * preorder (IR::AssignmentStatement *as) override
 

Detailed Description

The purpose of this pass is to simplify the translation of the p4-16 translation of the following p4_14 primitive: modify_field(hdr.field, parameter, mask);

This gets translated to the following p4_16: hdr.field = hdr.field & ~mask | parameter & mask;

which in term could be further simplified to a vector of simple assignments over slices. This extensions could be folded to any combinations of Binary Ors and Binary Ands as long as the masks never have any collisions.

Precondition
none
Todo
: Extend the optimization to handle multiple combinations of masks