P4C
The P4 Compiler
Loading...
Searching...
No Matches
tofino/map_direct_externs.h
1/*******************************************************************************
2 * Copyright (C) 2024 Intel Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing,
11 * software distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions
14 * and limitations under the License.
15 *
16 *
17 * SPDX-License-Identifier: Apache-2.0
18 ******************************************************************************/
19
20#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_MAP_DIRECT_EXTERNS_H_
21#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_MAP_DIRECT_EXTERNS_H_
22
23#include <map>
24
25#include "ir/ir.h"
26#include "ir/visitor.h"
27
28namespace P4::P4Tools::P4Testgen::Tofino {
29
34using DirectExternMap = std::map<cstring, const IR::P4Table *>;
35
39class MapDirectExterns : public Inspector {
40 private:
42 std::map<cstring, const IR::Declaration_Instance *> declaredExterns;
43
45 DirectExternMap directExternMap;
46
47 public:
48 bool preorder(const IR::Declaration_Instance *declInstance) override;
49
50 bool preorder(const IR::P4Table *table) override;
51
53 const DirectExternMap &getDirectExternMap();
54};
55
56} // namespace P4::P4Tools::P4Testgen::Tofino
57
58#endif /*BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_TOFINO_MAP_DIRECT_EXTERNS_H_*/
Definition tofino/map_direct_externs.h:39
const DirectExternMap & getDirectExternMap()
Definition tofino/map_direct_externs.cpp:60