P4C
The P4 Compiler
Loading...
Searching...
No Matches
p4RuntimeAnnotations.h
1/*
2 * SPDX-FileCopyrightText: 2018 Barefoot Networks, Inc.
3 * Copyright 2018-present Barefoot Networks, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef CONTROL_PLANE_P4RUNTIMEANNOTATIONS_H_
9#define CONTROL_PLANE_P4RUNTIMEANNOTATIONS_H_
10
11#include "frontends/p4/parseAnnotations.h"
12#include "ir/ir.h"
13
14namespace P4 {
15
16namespace ControlPlaneAPI {
17
19class ParseP4RuntimeAnnotations : public ParseAnnotations {
20 public:
21 ParseP4RuntimeAnnotations()
23 "P4Runtime", false,
24 {
25 PARSE("controller_header"_cs, StringLiteral),
26 PARSE_EMPTY("hidden"_cs),
27 PARSE("id"_cs, Constant),
28 PARSE("brief"_cs, StringLiteral),
29 PARSE("description"_cs, StringLiteral),
30 PARSE_KV_LIST("platform_property"_cs),
31 // These annotations are architecture-specific in theory, but
32 // given that they are "reserved" by the P4Runtime
33 // specification, I don't really have any qualms about adding
34 // them here. I don't think it is possible to just run a
35 // different ParseAnnotations pass in the constructor of the
36 // architecture-specific P4RuntimeArchHandlerIface
37 // implementation, since ParseAnnotations modifies the
38 // program. I don't really like the possible alternatives
39 // either: 1) modify the P4RuntimeArchHandlerIface interface
40 // so that each implementation can provide a custom
41 // ParseAnnotations instance, or 2) run a ParseAnnotations
42 // pass "locally" (in this case on action profile instances
43 // since these annotations are for them).
44 PARSE("max_group_size"_cs, Constant),
45 PARSE("selector_size_semantics"_cs, StringLiteral),
46 PARSE("max_member_weight"_cs, Constant),
47 {"p4runtime_translation"_cs, &ParseAnnotations::parseP4rtTranslationAnnotation},
48 }) {}
49};
50
51} // namespace ControlPlaneAPI
52
53} // namespace P4
54
55#endif // CONTROL_PLANE_P4RUNTIMEANNOTATIONS_H_
ParseAnnotations(bool warn=false)
Produces a pass that rewrites the spec-defined annotations.
Definition parseAnnotations.h:123
TODO(antonin): High level goals of the generator go here!!
Definition dpdk/control-plane/bfruntime_arch_handler.h:44
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13