P4C
The P4 Compiler
Loading...
Searching...
No Matches
extract_parser.h
1
19#ifndef BF_P4C_PARDE_EXTRACT_PARSER_H_
20#define BF_P4C_PARDE_EXTRACT_PARSER_H_
21
22#include "backends/tofino/bf-p4c/bf-p4c-options.h"
23#include "backends/tofino/bf-p4c/ir/gress.h"
24#include "backends/tofino/bf-p4c/parde/parde_visitor.h"
25#include "frontends/common/resolveReferences/referenceMap.h"
26#include "frontends/p4/typeMap.h"
27#include "ir/ir.h"
28#include "lib/cstring.h"
29#include "lib/exceptions.h"
30#include "logging/pass_manager.h"
31
32namespace P4 {
33namespace IR {
34
35namespace BFN {
36class Deparser;
37class Parser;
38class Pipe;
39} // namespace BFN
40
41class P4Control;
42class P4Parser;
43
44} // namespace IR
45} // namespace P4
46
47namespace BFN {
48
49using namespace P4;
55 Logging::FileLog *parserLog = nullptr;
56
57 public:
58 explicit ExtractParser(P4::ReferenceMap *refMap, P4::TypeMap *typeMap, IR::BFN::Pipe *rv,
59 ParseTna *arch)
60 : refMap(refMap), typeMap(typeMap), rv(rv), arch(arch) {
61 setName("ExtractParser");
62 }
63 void postorder(const IR::BFN::TnaParser *parser) override;
64 void end_apply() override;
65
66 profile_t init_apply(const IR::Node *root) override {
67 if (BackendOptions().verbose > 0)
68 parserLog = new Logging::FileLog(rv->canon_id(), "parser.log"_cs);
69 return ParserInspector::init_apply(root);
70 }
71
72 private:
73 P4::ReferenceMap *refMap;
74 P4::TypeMap *typeMap;
75 IR::BFN::Pipe *rv;
76 ParseTna *arch;
77};
78
82 public:
83 ProcessParde(const IR::BFN::Pipe *rv, bool useTna);
84};
85
86} // namespace BFN
87
88#endif /* BF_P4C_PARDE_EXTRACT_PARSER_H_ */
Definition extract_parser.h:81
ProcessParde(const IR::BFN::Pipe *rv, bool useTna)
Definition extract_parser.cpp:1852
A FileLog is used to redirect the logging output of a visitor pass to a file.
Definition filelog.h:48
Definition backends/tofino/bf-p4c/logging/pass_manager.h:36
Definition node.h:94
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition typeMap.h:41
Definition arch.h:327
Transforms midend parser IR::BFN::TnaParser into backend parser IR::BFN::Parser.
Definition extract_parser.h:54
Definition parde_visitor.h:66
The namespace encapsulating Barefoot/Intel-specific stuff.
Definition add_t2na_meta.cpp:21
The namespace encapsulating IR node classes.
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24