P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::ChooseErrorRepresentation Class Referenceabstract

#include <convertErrors.h>

Inheritance diagram for P4::ChooseErrorRepresentation:
[legend]

Public Member Functions

virtual IR::IndexedVector< IR::SerEnumMember > * assignValues (IR::Type_Error *type, unsigned width) const
 
virtual bool convert (const IR::Type_Error *type) const =0
 If true this type has to be converted.
 
virtual unsigned errorSize (unsigned errorCount) const =0
 

Detailed Description

Policy function: given a number of error values should return the size of a Type_Bits type used to represent the values. This class is lefted from enum conversion path.

Member Function Documentation

◆ assignValues()

IR::IndexedVector< IR::SerEnumMember > * P4::ChooseErrorRepresentation::assignValues ( IR::Type_Error * type,
unsigned width ) const
virtual

This function allows backends to override the values for the error constants. Default values for error constants is a sequence of numbers starting with 0.

◆ errorSize()

virtual unsigned P4::ChooseErrorRepresentation::errorSize ( unsigned errorCount) const
pure virtual

errorCount is the number of different error values. The returned value is the width of Type_Bits used to represent the error. Obviously, we must have 2^(return) >= errorCount.