P4C
The P4 Compiler
Loading...
Searching...
No Matches
p4_refers_to_parser.h
1/*
2 * SPDX-FileCopyrightText: 2022 The P4 Language Consortium
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_P4_REFERS_TO_PARSER_H_
8#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_P4_REFERS_TO_PARSER_H_
9
10#include "backends/p4tools/common/lib/variables.h"
11#include "ir/ir.h"
12#include "ir/visitor.h"
13
15
16class RefersToParser : public Inspector {
17 private:
19 ConstraintsVector restrictionsVector;
20
22 using RefersToBuiltinMap = std::map<cstring, std::map<cstring, IR::SymbolicVariable>>;
23 static const RefersToBuiltinMap REFERS_TO_BUILTIN_MAP;
24
27 static cstring assembleKeyReference(const IR::Vector<IR::AnnotationToken> &annotationList,
28 size_t offset);
29
31 static const IR::SymbolicVariable *lookUpBuiltinKey(
32 const IR::Annotation &refersAnno, const IR::Vector<IR::AnnotationToken> &annotationList);
33
35 static const IR::SymbolicVariable *lookUpKeyInTable(const IR::P4Table &srcTable,
36 cstring keyReference);
37
42 static const IR::SymbolicVariable *getReferencedKey(const IR::P4Control &ctrlContext,
43 const IR::Annotation &refersAnno);
44
45 bool preorder(const IR::P4Table *table) override;
46
47 public:
48 RefersToParser();
49
51 [[nodiscard]] ConstraintsVector getRestrictionsVector() const;
52};
53
54} // namespace P4::P4Tools::P4Testgen::Bmv2
55
56#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_BMV2_P4_REFERS_TO_PARSER_H_ */
Definition ir/vector.h:59
ConstraintsVector getRestrictionsVector() const
Returns the restrictions imposed on the control-plane.
Definition p4_refers_to_parser.cpp:181
Definition cstring.h:85
Inja.
Definition targets/bmv2/cmd_stepper.cpp:37
std::vector< const IR::Expression * > ConstraintsVector
Definition variables.h:23