P4C
The P4 Compiler
Loading...
Searching...
No Matches
TableSummary Class Reference
Inheritance diagram for TableSummary:
[legend]

Classes

struct  PlacedTable
 

Public Types

enum  PlacementResult {
  SUCC , FAIL_ON_ADB , FAIL_ON_MEM , FAIL_ON_IXBAR ,
  FAIL
}
 
- Public Types inherited from P4::Visitor
typedef Visitor_Context Context
 

Public Member Functions

 TableSummary (int pipe_id, const DependencyGraph &dg, const PhvInfo &phv, State::state_t &state)
 
void addPlacementError (cstring msg)
 
void addPlacementWarnError (cstring msg)
 
void clear_table_alloc_info ()
 
void clearPlacementErrors ()
 
void FinalizePlacement ()
 set state to FINAL_PLACEMENT, or ALT_FINALIZE_TABLE if alt-phv-alloc is enabled.
 
std::map< int, int > findBytesOnIxbar (const PHV::FieldSlice &slice) const
 
const IR::MAU::Table * get_table_replay_problematic_table () const
 
PlacementResult get_table_replay_result () const
 
State::state_t getActualState () const
 
cstring getActualStateStr () const
 
StageUseEstimate getAllStagesResources () const
 
int getNumInvoked () const
 
std::map< int, PlacedTable * > & getPlacedTables ()
 
const ordered_map< cstring, bool > & getPlacementError ()
 
const ordered_map< cstring, ordered_set< int > > & getTableAlloc (void) const
 
bool is_table_replay ()
 
cstring ixbarUsagesStr (const PhvInfo *phv=nullptr) const
 
int maxStages () const
 
int maxStages (gress_t gress) const
 
int placementErrorCount ()
 
void printPlacedTables () const
 
void resetPlacement ()
 set state to INITIAL, or ALT_INITIAL if alt-phv-alloc is enabled.
 
void set_table_replay_result (PlacementResult result)
 
void setAllStagesResources (const StageUseEstimate &use)
 
void setPlacementError (const ordered_map< cstring, bool > &tpe)
 
void setPrevState ()
 
const ordered_set< int > stages (const IR::MAU::Table *tbl, bool internal=false) const
 
void stop_table_replay_fitting () const
 
- Public Member Functions inherited from P4::Inspector
const IR::Nodeapply_visitor (const IR::Node *, const char *name=0) override
 
profile_t init_apply (const IR::Node *root) override
 
virtual void loop_revisit (const IR::Node *)
 
virtual void postorder (const IR::Node *)
 
virtual bool preorder (const IR::Node *)
 
virtual void revisit (const IR::Node *)
 
void revisit_visited ()
 
bool visit_in_progress (const IR::Node *n) const
 
void visitAgain () const override
 
void visitOnce () const override
 
- Public Member Functions inherited from P4::Visitor
virtual bool check_global (cstring)
 
virtual void clear_globals ()
 
virtual Visitorclone () const
 
virtual ControlFlowVisitorcontrolFlowVisitor ()
 
virtual void end_apply (const IR::Node *root)
 
virtual void erase_global (cstring)
 
template<class T >
const T * findContext () const
 
template<class T >
const T * findContext (const Context *&c) const
 
template<class T >
const T * findOrigCtxt () const
 
template<class T >
const T * findOrigCtxt (const Context *&c) const
 
virtual Visitorflow_clone ()
 
virtual void flow_merge (Visitor &)
 
virtual bool flow_merge_closure (Visitor &)
 
virtual void flow_merge_global_from (cstring)
 
virtual void flow_merge_global_to (cstring)
 
const ContextgetChildContext () const
 
int getChildrenVisited () const
 
const ContextgetContext () const
 
int getContextDepth () const
 
const IR::NodegetCurrentNode () const
 
template<class T >
const T * getCurrentNode () const
 
const IR::NodegetOriginal () const
 
template<class T >
const T * getOriginal () const
 
template<class T >
const T * getParent () const
 
virtual bool has_flow_joins () const
 
profile_t init_apply (const IR::Node *root, const Context *parent_context)
 
bool isInContext (const IR::Node *n) const
 
virtual const char * name () const
 
template<class T >
void parallel_visit (const IR::Vector< T > &v, const char *name, int cidx)
 
template<class T >
void parallel_visit (const IR::Vector< T > &v, const char *name=0)
 
template<class T >
void parallel_visit (IR::Vector< T > &v, const char *name, int cidx)
 
template<class T >
void parallel_visit (IR::Vector< T > &v, const char *name=0)
 
void print_context () const
 
const VisitorsetCalledBy (const Visitor *visitor)
 
void setName (const char *name)
 
void visit (const IR::Node &n, const char *name, int cidx)
 
void visit (const IR::Node &n, const char *name=0)
 
void visit (const IR::Node *&n, const char *name, int cidx)
 
void visit (const IR::Node *&n, const char *name=0)
 
void visit (const IR::Node *const &n, const char *name, int cidx)
 
void visit (const IR::Node *const &n, const char *name=0)
 
void visit (IR::Node &n, const char *name, int cidx)
 
void visit (IR::Node &n, const char *name=0)
 
void visit (IR::Node *&, const char *=0, int=0)
 
template<class T , typename = std::enable_if_t<Util::has_SourceInfo_v<T> && !std::is_pointer_v<T>>, class... Args>
void warn (const int kind, const char *format, const T &node, Args &&...args)
 The const ref variant of the above.
 
template<class T , typename = std::enable_if_t<Util::has_SourceInfo_v<T>>, class... Args>
void warn (const int kind, const char *format, const T *node, Args &&...args)
 
bool warning_enabled (int warning_kind) const
 

Static Public Member Functions

static void addTablePtr (const IR::MAU::Table *ptr)
 Add table pointer into tblName2IRptr map.
 
static void clearTblName2IRptr ()
 Reset the the tblName2IRptr map.
 
static cstring getTableIName (const IR::MAU::Table *tbl)
 
static cstring getTableName (const IR::MAU::Table *tbl)
 
static std::set< const IR::MAU::Table * > getTablePtr (const cstring t_name)
 
- Static Public Member Functions inherited from P4::Visitor
static cstring demangle (const char *)
 
static bool warning_enabled (const Visitor *visitor, int warning_kind)
 

Static Public Attributes

static constexpr int FIRST_ALT_RETRY_ENHANCED_TP_INVOCATION = 2
 
static constexpr int NUM_LOGICAL_TABLES_PER_STAGE = 16
 

Friends

std::ostream & operator<< (std::ostream &out, const PlacedTable &pl)
 
std::ostream & operator<< (std::ostream &out, const TableSummary &ts)
 
std::ostream & operator<< (std::ostream &out, ordered_map< int, const IR::MAU::Table * > &order)
 
std::ostream & operator<< (std::ostream &out, PlacementResult result)
 

Additional Inherited Members

- Public Attributes inherited from P4::Visitor
const Visitorcalled_by = nullptr
 
cstring internalName
 
SplitFlowVisit_base *& split_link
 
SplitFlowVisit_basesplit_link_mem = nullptr
 
- Protected Member Functions inherited from P4::Visitor
virtual void init_join_flows (const IR::Node *)
 
virtual bool join_flows (const IR::Node *)
 
virtual void post_join_flows (const IR::Node *, const IR::Node *)
 
void visit_children (const IR::Node *, std::function< void()> fn)
 
- Protected Attributes inherited from P4::Visitor
bool dontForwardChildrenBeforePreorder = false
 
bool joinFlows = false
 
bool visitDagOnce = true
 

Member Function Documentation

◆ getTableIName()

cstring TableSummary::getTableIName ( const IR::MAU::Table * tbl)
static
Returns
the compiler-generated internal name for tables. Other passes should use this name, instead of externalName returned by getTableName(), to track tables.

◆ getTableName()

cstring TableSummary::getTableName ( const IR::MAU::Table * tbl)
static
Returns
the P4 name for tables with an external name (non-gateways).
the compiler-generated name otherwise.

◆ getTablePtr()

std::set< const IR::MAU::Table * > TableSummary::getTablePtr ( const cstring t_name)
static
Returns
the IR pointer to the table named as @t_name

◆ maxStages()

int TableSummary::maxStages ( ) const
inline
Returns
the maximum number of stages used by the program.

◆ stages()

const ordered_set< int > TableSummary::stages ( const IR::MAU::Table * tbl,
bool internal = false ) const
Returns
the set of stages to which table t has been allocated. optional internal flag can be used to retrieve the information from the internalTableAlloc map.