P4C
The P4 Compiler
Loading...
Searching...
No Matches
checkTableEntries.h
1/*
2 * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef MIDEND_CHECKTABLEENTRIES_H_
19#define MIDEND_CHECKTABLEENTRIES_H_
20
21#include "ir/ir.h"
22#include "ir/visitor.h"
23
24namespace P4 {
25
26class CheckTableEntries : public Inspector {
27 bool genError; // if true, generate errors for duplicates rather than just warnings
28 bool preorder(const IR::P4Table *);
29 bool preorder(const IR::P4Parser *) { return false; }
30 bool preorder(const IR::Statement *) { return false; }
31 void get_mask_val(const IR::Expression *, big_int &mask, big_int &val);
32 bool ternary_covers(const IR::Expression *k1, const IR::Expression *k2);
33
34 public:
35 explicit CheckTableEntries(bool err = false) : genError(err) {}
36};
37
38} // namespace P4
39
40#endif /* MIDEND_CHECKTABLEENTRIES_H_ */
Definition visitor.h:413
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24