P4C
The P4 Compiler
Loading...
Searching...
No Matches
deparser.h
1
/*
2
Copyright 2013-present Barefoot Networks, Inc.
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
17
#ifndef BACKENDS_BMV2_COMMON_DEPARSER_H_
18
#define BACKENDS_BMV2_COMMON_DEPARSER_H_
19
20
#include "backend.h"
21
#include "expression.h"
22
#include "frontends/common/resolveReferences/referenceMap.h"
23
#include "frontends/p4/typeMap.h"
24
#include "ir/ir.h"
25
#include "lib/json.h"
26
27
namespace
P4::BMV2
{
28
29
class
DeparserConverter
:
public
Inspector
{
30
ConversionContext
*ctxt;
31
cstring
name;
32
P4::P4CoreLibrary
&corelib;
33
34
protected
:
35
Util::IJson
*convertDeparser(
const
IR::P4Control *ctrl);
36
void
convertDeparserBody(
const
IR::Vector<IR::StatOrDecl>
*body,
Util::JsonArray
*order,
37
Util::JsonArray
*primitives);
38
39
public
:
40
bool
preorder(
const
IR::P4Control *ctrl)
override
;
41
42
explicit
DeparserConverter
(
ConversionContext
*ctxt,
cstring
name =
"deparser"
_cs)
43
: ctxt(ctxt), name(name), corelib(P4::P4CoreLibrary::instance()) {
44
setName(
"DeparserConverter"
);
45
}
46
};
47
48
}
// namespace P4::BMV2
49
50
#endif
/* BACKENDS_BMV2_COMMON_DEPARSER_H_ */
P4::BMV2::DeparserConverter
Definition
deparser.h:29
P4::IR::Vector
Definition
vector.h:59
P4::Inspector
Definition
visitor.h:400
P4::P4CoreLibrary
Definition
coreLibrary.h:103
P4::Util::IJson
Definition
json.h:40
P4::Util::JsonArray
Definition
json.h:115
P4::cstring
Definition
cstring.h:85
P4::BMV2
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition
action.cpp:21
P4::BMV2::ConversionContext
Definition
bmv2/common/helpers.h:297
backends
bmv2
common
deparser.h
Generated by
1.12.0