P4C
The P4 Compiler
Loading...
Searching...
No Matches
MauBacktracker Class Reference

#include <mau_backtracker.h>

Inheritance diagram for MauBacktracker:
[legend]

Public Member Functions

 MauBacktracker (State::state_t &state= *(new State::state_t), TableSummary *table_summary=nullptr)
 
void clear ()
 
bool didFirstRoundFit () const
 
bool disableMetadataInitialization () const
 
const TableSummaryget_table_summary () const
 
const ordered_map< cstring, ordered_set< int > > & getInternalTablesInfo () const
 
const ordered_map< cstring, std::pair< cstring, cstring > > & getMergedGatewaysInfo () const
 
bool happensBefore (const IR::MAU::Table *t1, const IR::MAU::Table *t2) const
 
bool hasTablePlacement () const
 
ordered_set< int > inSameStage (const IR::MAU::Table *t1, const IR::MAU::Table *t2) const
 
int numStages () const
 
std::string printTableAlloc () const
 Prints the table allocation received by MauBacktracker by means of the backtrack trigger.
 
ordered_set< int > stage (const IR::MAU::Table *t, bool internal=false) const
 
- Public Member Functions inherited from P4::Backtrack
virtual bool never_backtracks ()
 
- Public Member Functions inherited from P4::Visitor
virtual const IR::Nodeapply_visitor (const IR::Node *n, const char *name=0)=0
 
virtual bool check_clone (const Visitor *a)
 
virtual bool check_global (cstring)
 
virtual void clear_globals ()
 
virtual Visitorclone () const
 
virtual ControlFlowVisitorcontrolFlowVisitor ()
 
virtual void end_apply ()
 
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
 
virtual profile_t init_apply (const IR::Node *root)
 
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
 

Additional Inherited Members

- Public Types inherited from P4::Visitor
typedef Visitor_Context Context
 
- Static Public Member Functions inherited from P4::Visitor
static cstring demangle (const char *)
 
static bool warning_enabled (const Visitor *visitor, int warning_kind)
 
- 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)
 
virtual void visitAgain () const
 
virtual void visitOnce () const
 
- Protected Attributes inherited from P4::Visitor
bool dontForwardChildrenBeforePreorder = false
 
bool joinFlows = false
 
bool visitDagOnce = true
 

Detailed Description

Copyright (C) 2024 Intel Corporation

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0 When backtracking, this class contains members that save the generated table placement (without container conflicts) for use by the second round of PHV allocation

Constructor & Destructor Documentation

◆ MauBacktracker()

MauBacktracker::MauBacktracker ( State::state_t & state = *(new State::state_t),
TableSummary * table_summary = nullptr )
inlineexplicit

Constructor takes mutually exclusive to be able to clear it before every PHV allocation pass

Member Function Documentation

◆ clear()

void MauBacktracker::clear ( )

Clear the MauBacktracker state. Only use when backtracking to a point where everything should be reset. We pass state back through this object in many cases – don't clear in those cases.

◆ didFirstRoundFit()

bool MauBacktracker::didFirstRoundFit ( ) const
inline
Returns
firstRoundFit.

◆ disableMetadataInitialization()

bool MauBacktracker::disableMetadataInitialization ( ) const
inline
Returns
metaInitDisable.

◆ get_table_summary()

const TableSummary * MauBacktracker::get_table_summary ( ) const
inline
Returns
the Table Summary pointer

◆ getInternalTablesInfo()

const ordered_map< cstring, ordered_set< int > > & MauBacktracker::getInternalTablesInfo ( ) const
inline
Returns
tables structure

◆ getMergedGatewaysInfo()

const ordered_map< cstring, std::pair< cstring, cstring > > & MauBacktracker::getMergedGatewaysInfo ( ) const
inline
Returns
merged gateways structure

◆ hasTablePlacement()

bool MauBacktracker::hasTablePlacement ( ) const
Returns
true if the MauBacktracker class has any information about table placement (found in the tables map

◆ inSameStage()

ordered_set< int > MauBacktracker::inSameStage ( const IR::MAU::Table * t1,
const IR::MAU::Table * t2 ) const
Returns
the stage number(s) if tables t1 and t2 are placed in the same stage
an empty set if tables are not in the same stage

◆ numStages()

int MauBacktracker::numStages ( ) const
Returns
the number of stages in the table allocation

◆ stage()

ordered_set< int > MauBacktracker::stage ( const IR::MAU::Table * t,
bool internal = false ) const
Returns
the stages in which table t was placed. Use internalTables mapping when internal flag is set.