P4C
The P4 Compiler
Loading...
Searching...
No Matches
createBuiltins.h
1/*
2 * SPDX-FileCopyrightText: 2013 Barefoot Networks, Inc.
3 * Copyright 2013-present Barefoot Networks, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef FRONTENDS_P4_CREATEBUILTINS_H_
9#define FRONTENDS_P4_CREATEBUILTINS_H_
10
11#include "ir/ir.h"
12#include "ir/visitor.h"
13
14/*
15 * Creates accept and reject states.
16 * Adds parentheses to action invocations in tables:
17 e.g., actions = { a; } becomes actions = { a(); }
18 * Parser states without selects will transition to reject.
19 */
20namespace P4 {
21class CreateBuiltins final : public Transform {
22 bool addNoAction = false;
25 const IR::IDeclaration *globalNoAction;
26
27 void checkGlobalAction();
28
29 public:
30 CreateBuiltins() {
31 setName("CreateBuiltins");
32 globalNoAction = nullptr;
33 }
34 const IR::Node *postorder(IR::ParserState *state) override;
35 const IR::Node *postorder(IR::P4Parser *parser) override;
36 const IR::Node *postorder(IR::ActionListElement *element) override;
37 const IR::Node *postorder(IR::ExpressionValue *property) override;
38 const IR::Node *postorder(IR::Entry *property) override;
39 const IR::Node *preorder(IR::P4Table *table) override;
40 const IR::Node *postorder(IR::ActionList *actions) override;
41 const IR::Node *postorder(IR::TableProperties *properties) override;
42 const IR::Node *postorder(IR::Property *property) override;
43 const IR::Node *preorder(IR::P4Program *program) override;
44};
45} // namespace P4
46
47#endif /* FRONTENDS_P4_CREATEBUILTINS_H_ */
The Declaration interface, representing objects with names.
Definition declaration.h:17
Definition node.h:44
Definition visitor.h:433
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13