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

Public Member Functions

 StrengthReductionPolicy (bool enableSubConstToAddTransform, bool enableNarrowingCastToSliceTransform)
 

Public Attributes

bool enableNarrowingCastToSliceTransform = false
 
bool enableSubConstToAddTransform = true
 

Member Data Documentation

◆ enableNarrowingCastToSliceTransform

bool P4::StrengthReductionPolicy::enableNarrowingCastToSliceTransform = false

Replace narrowing casts with slices. i.e. replaces (bit<n>)(expr) with expr[n-1:0] when n is smaller than the width of expr.

◆ enableSubConstToAddTransform

bool P4::StrengthReductionPolicy::enableSubConstToAddTransform = true

Enable the subtract constant to add negative constant transform. Replaces a - constant with a + (-constant).