P4C
The P4 Compiler
Loading...
Searching...
No Matches
globals.h
1/*
2 * Copyright 2017 VMware, Inc.
3 * SPDX-FileCopyrightText: 2017 VMware, Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef BACKENDS_BMV2_COMMON_GLOBALS_H_
9#define BACKENDS_BMV2_COMMON_GLOBALS_H_
10
11#include "backend.h"
12#include "ir/ir.h"
13
14namespace P4::BMV2 {
15
16class ConvertGlobals : public Inspector {
18 const bool emitExterns;
19
20 public:
21 explicit ConvertGlobals(ConversionContext *ctxt, const bool &emitExterns_)
22 : ctxt(ctxt), emitExterns(emitExterns_) {
23 setName("ConvertGlobals");
24 }
25
26 bool preorder(const IR::ExternBlock *block) override;
27 bool preorder(const IR::ToplevelBlock *block) override {
29 for (auto it : block->constantValue) {
30 if (it.second->is<IR::Block>()) visit(it.second->getNode());
31 }
32 return false;
33 }
34};
35
36} // namespace P4::BMV2
37
38#endif /* BACKENDS_BMV2_COMMON_GLOBALS_H_ */
bool preorder(const IR::ToplevelBlock *block) override
Definition globals.h:27
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition action.cpp:9
Definition bmv2/common/helpers.h:288