19#ifndef BF_P4C_COMMON_EXTRACT_MAUPIPE_H_
20#define BF_P4C_COMMON_EXTRACT_MAUPIPE_H_
24#include "backends/tofino/bf-p4c/arch/arch.h"
25#include "backends/tofino/bf-p4c/arch/fromv1.0/mirror.h"
26#include "backends/tofino/bf-p4c/arch/fromv1.0/resubmit.h"
27#include "backends/tofino/bf-p4c/device.h"
28#include "backends/tofino/bf-p4c/lib/assoc.h"
29#include "backends/tofino/bf-p4c/logging/source_info_logging.h"
30#include "backends/tofino/bf-p4c/mau/mau_visitor.h"
31#include "backends/tofino/bf-p4c/midend/param_binding.h"
32#include "frontends/common/options.h"
33#include "frontends/common/resolveReferences/referenceMap.h"
34#include "frontends/p4/externInstance.h"
35#include "frontends/p4/typeMap.h"
45const IR::BFN::Pipe *extract_maupipe(
const IR::P4Program *,
BFN_Options &options);
76 IR::MAU::StatefulAlu *>
97 void postorder(
const IR::Expression *)
override { visitAgain(); }
98 void postorder(
const IR::GlobalRef *)
override;
99 void updateAttachedSalu(
const IR::Declaration_Instance *,
const IR::GlobalRef *);
102 explicit InitializeStatefulAlus(
AttachTables &s) : self(s) {}
127 IR::MAU::StatefulAlu *>
129 bool preorder(
const IR::MAU::Primitive *prim)
override;
130 void end_apply()
override;
133 explicit InitializeRegisterParams(
AttachTables &s) : self(s) {}
148 class InitializeStatefulInstructions :
public MauInspector {
153 void postorder(
const IR::Expression *)
override { visitAgain(); }
154 void postorder(
const IR::GlobalRef *gref)
override;
157 explicit InitializeStatefulInstructions(
AttachTables &s) : self(s) {}
173 bool preorder(IR::MAU::Table *)
override;
174 bool preorder(IR::MAU::Action *)
override;
175 void postorder(IR::MAU::Table *)
override;
176 void postorder(IR::Expression *)
override { visitAgain(); }
177 void postorder(IR::GlobalRef *)
override;
179 const IR::MAU::StatefulAlu *findAttachedSalu(
const IR::Declaration_Instance *ext);
183 : self(s), refMap(refMap), typeMap(typeMap) {}
185 bool findSaluDeclarations(
const IR::Declaration_Instance *ext,
186 const IR::Declaration_Instance **reg_ptr,
187 const IR::Type_Specialized **regtype_ptr =
nullptr,
188 const IR::Type_Extern **seltype_ptr =
nullptr);
191 static bool isSaluActionType(
const IR::Type *);
196 : refMap(rm), typeMap(tm), converted(con), stateful_selectors(ss) {
197 addPasses({
new InitializeStatefulAlus(*
this),
new InitializeRegisterParams(*
this),
198 new InitializeStatefulInstructions(*
this),
199 new DefineGlobalRefs(*
this, refMap, typeMap)});
200 stop_on_error =
false;
217 const IR::ToplevelBlock *toplevel =
nullptr;
233 sourceInfoLogging(sourceInfoLogging) {
234 arch =
new ParseTna(refMap, typeMap);
238 cstring getPipelineName(
const IR::P4Program *program,
int index);
240 bool preorder(
const IR::P4Program *program)
override;
Definition extract_maupipe.h:69
Definition extract_maupipe.h:212
bool preorder(const IR::P4Program *program) override
Definition extract_maupipe.cpp:1977
must be applied to IR::BFN::Pipe
Definition extract_maupipe.h:205
ProcessBackendPipe(P4::ReferenceMap *refMap, P4::TypeMap *typeMap, IR::BFN::Pipe *rv, DeclarationConversions &converted, StatefulSelectors ss, ParamBinding *bindings)
Definition extract_maupipe.cpp:1927
Definition bf-p4c-options.h:28
Definition mau_visitor.h:29
Definition mau_visitor.h:45
Definition ir/pass_manager.h:40
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition ordered_map.h:32
Definition param_binding.h:32
Pass that collects source information.
Definition source_info_logging.h:39
The pass creates SALU VLIW instructions.
Definition mau/stateful_alu.h:161
The namespace encapsulating Barefoot/Intel-specific stuff.
Definition add_t2na_meta.cpp:21
assoc::map< const IR::Declaration_Instance *, const IR::MAU::AttachedMemory * > DeclarationConversions
Definition extract_maupipe.h:65
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24