![]() |
P4C
The P4 Compiler
|
#include <typeMap.h>
Public Member Functions | |
void | addSubstitutions (const TypeVariableSubstitution *tvs) |
void | clear () |
void | cloneExpressionProperties (const IR::Expression *to, const IR::Expression *from) |
bool | contains (const IR::Node *element) |
void | dbprint (std::ostream &out) const override |
bool | equivalent (const IR::Type *left, const IR::Type *right, bool strict=false) const |
const IR::Type * | getCanonical (const IR::Type *type) |
const IR::Type * | getSubstitution (const IR::ITypeVar *var) |
const TypeVariableSubstitution * | getSubstitutions () const |
const IR::Type * | getType (const IR::Node *element, bool notNull=false) const |
const IR::Type * | getTypeType (const IR::Node *element, bool notNull) const |
bool | implicitlyConvertibleTo (const IR::Type *from, const IR::Type *to) const |
bool | isCompileTimeConstant (const IR::Expression *expression) const |
bool | isLeftValue (const IR::Expression *expression) const |
void | setCompileTimeConstant (const IR::Expression *expression) |
void | setLeftValue (const IR::Expression *expression) |
void | setStrictStruct (bool value) |
void | setType (const IR::Node *element, const IR::Type *type) |
size_t | size () const |
bool | typeIsEmpty (const IR::Type *type) const |
True is type occupies no storage. | |
int | widthBits (const IR::Type *type, const IR::Node *errorPosition, bool max) const |
![]() | |
bool | checkMap (const IR::Node *node) const |
void | clear () |
void | updateMap (const IR::Node *node) |
void | validateMap (const IR::Node *node) const |
![]() | |
void | print () const |
Public Attributes | |
bool | strictStruct |
Additional Inherited Members | |
![]() | |
ProgramMap (std::string_view kind) | |
![]() | |
const IR::P4Program * | fake = new IR::P4Program() |
cstring | mapKind |
const IR::P4Program * | program = nullptr |
Maps nodes to their canonical types. Not all Node objects have types. The type of each node is maintained in the typeMap. Objects that have a type in the map:
|
overridevirtual |
Implements P4::IHasDbPrint.
bool P4::TypeMap::equivalent | ( | const IR::Type * | left, |
const IR::Type * | right, | ||
bool | strict = false ) const |
Check deep structural equivalence; defined between canonical types only.
strict | If true use strict equivalence checks, irrespective of the strictStruct flag, else use the strictStruct flag value. |
bool P4::TypeMap::implicitlyConvertibleTo | ( | const IR::Type * | from, |
const IR::Type * | to ) const |
This is the same as equivalence, but it also allows some legal implicit conversions, such as a tuple type to a struct type, which is used when initializing a struct with a list expression.
int P4::TypeMap::widthBits | ( | const IR::Type * | type, |
const IR::Node * | errorPosition, | ||
bool | max ) const |
The width in bits of this type. If the width is not well-defined this will report an error and return -1. max indicates whether we want the max width or min width.
bool P4::TypeMap::strictStruct |
If true we require structs to have the same name to be equivalent, if false only that the have the same fields.