P4C
The P4 Compiler
Loading...
Searching...
No Matches
createBuiltins.h
1/*
2Copyright 2013-present Barefoot Networks, Inc.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#ifndef P4_CREATEBUILTINS_H_
18#define P4_CREATEBUILTINS_H_
19
20#include "ir/ir.h"
21#include "ir/visitor.h"
22
23/*
24 * Creates accept and reject states.
25 * Adds parentheses to action invocations in tables:
26 e.g., actions = { a; } becomes actions = { a(); }
27 * Parser states without selects will transition to reject.
28 */
29namespace P4 {
30class CreateBuiltins final : public Transform {
31 bool addNoAction = false;
34 const IR::IDeclaration *globalNoAction;
35
36 void checkGlobalAction();
37
38 public:
40 setName("CreateBuiltins");
41 globalNoAction = nullptr;
42 }
43 const IR::Node *postorder(IR::ParserState *state) override;
44 const IR::Node *postorder(IR::P4Parser *parser) override;
45 const IR::Node *postorder(IR::ActionListElement *element) override;
46 const IR::Node *postorder(IR::ExpressionValue *property) override;
47 const IR::Node *postorder(IR::Entry *property) override;
48 const IR::Node *preorder(IR::P4Table *table) override;
49 const IR::Node *postorder(IR::ActionList *actions) override;
50 const IR::Node *postorder(IR::TableProperties *properties) override;
51 const IR::Node *postorder(IR::Property *property) override;
52 const IR::Node *preorder(IR::P4Program *program) override;
53};
54} // namespace P4
55
56#endif /* P4_CREATEBUILTINS_H_ */
Definition createBuiltins.h:30
The Declaration interface, representing objects with names.
Definition declaration.h:26
Definition node.h:95
Definition visitor.h:424
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24