P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::ReferenceMap Class Referencefinal

Class used to encode maps from paths to declarations. More...

#include <referenceMap.h>

Inheritance diagram for P4::ReferenceMap:
[legend]

Public Member Functions

void clear ()
 Clear the reference map.
 
void dbprint (std::ostream &cout) const override
 
const IR::IDeclarationgetDeclaration (const IR::Path *path, bool notNull=false) const override
 
const IR::IDeclarationgetDeclaration (const IR::This *pointer, bool notNull=false) const override
 
bool isUsed (const IR::IDeclaration *decl) const
 
bool isV1 () const
 
cstring newName (std::string_view base) override
 Generate a name from base that fresh for the program.
 
void setAnyOrder (bool anyOrder)
 
void setDeclaration (const IR::Path *path, const IR::IDeclaration *decl)
 Sets declaration for path to decl.
 
void setDeclaration (const IR::This *pointer, const IR::IDeclaration *decl)
 Sets declaration for pointer to decl.
 
void setIsV1 (bool isv1)
 Set boolean indicating whether map is for a P4_14 program to isV1.
 
void usedName (cstring name)
 Indicate that name is used in the program.
 
- Public Member Functions inherited from P4::ProgramMap
bool checkMap (const IR::Node *node) const
 
void clear ()
 
void updateMap (const IR::Node *node)
 
void validateMap (const IR::Node *node) const
 
- Public Member Functions inherited from P4::IHasDbPrint
void print () const
 
- Public Member Functions inherited from P4::NameGenerator
- Public Member Functions inherited from P4::DeclarationLookup

Additional Inherited Members

- Protected Member Functions inherited from P4::ProgramMap
 ProgramMap (std::string_view kind)
 
- Protected Attributes inherited from P4::ProgramMap
const IR::P4Program * fake = new IR::P4Program()
 
cstring mapKind
 
const IR::P4Program * program = nullptr
 

Detailed Description

Class used to encode maps from paths to declarations.

Member Function Documentation

◆ dbprint()

void P4::ReferenceMap::dbprint ( std::ostream & cout) const
overridevirtual

Implements P4::IHasDbPrint.

◆ getDeclaration() [1/2]

const IR::IDeclaration * P4::ReferenceMap::getDeclaration ( const IR::Path * path,
bool notNull = false ) const
overridevirtual

Looks up declaration for path. If notNull is false, then failure to find a declaration is an error.

Implements P4::DeclarationLookup.

◆ getDeclaration() [2/2]

const IR::IDeclaration * P4::ReferenceMap::getDeclaration ( const IR::This * pointer,
bool notNull = false ) const
overridevirtual

Looks up declaration for pointer. If notNull is false, then failure to find a declaration is an error.

Implements P4::DeclarationLookup.

◆ isUsed()

bool P4::ReferenceMap::isUsed ( const IR::IDeclaration * decl) const
inline
Returns
@true if decl is used in the program.

◆ isV1()

bool P4::ReferenceMap::isV1 ( ) const
inline
Returns
@true if this map is for a P4_14 program

◆ newName()

cstring P4::ReferenceMap::newName ( std::string_view base)
overridevirtual

Generate a name from base that fresh for the program.

Implements P4::NameGenerator.