P4C
The P4 Compiler
Loading...
Searching...
No Matches
substituteParameters.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/* -*-C++-*- */
9
10#ifndef FRONTENDS_P4_EVALUATOR_SUBSTITUTEPARAMETERS_H_
11#define FRONTENDS_P4_EVALUATOR_SUBSTITUTEPARAMETERS_H_
12
13#include "frontends/common/resolveReferences/resolveReferences.h"
14#include "frontends/p4/parameterSubstitution.h"
15#include "frontends/p4/typeChecking/typeSubstitutionVisitor.h"
16#include "ir/ir.h"
17
18namespace P4 {
19
20class SubstituteParameters : public TypeVariableSubstitutionVisitor, public ResolutionContext {
21 protected:
22 const DeclarationLookup *refMap; // input
23 const ParameterSubstitution *subst; // input
24 public:
25 SubstituteParameters(const DeclarationLookup *refMap, const ParameterSubstitution *subst,
26 const TypeVariableSubstitution *tvs)
27 : TypeVariableSubstitutionVisitor(tvs), refMap(refMap), subst(subst) {
28 CHECK_NULL(subst);
29 CHECK_NULL(tvs);
30 visitDagOnce = true;
31 setName("SubstituteParameters");
32 LOG1("Will substitute " << std::endl << subst << bindings);
33 }
34 using TypeVariableSubstitutionVisitor::postorder;
35 const IR::Node *postorder(IR::PathExpression *expr) override;
36 const IR::Node *postorder(IR::Type_Name *type) override;
37 const IR::Node *postorder(IR::This *t) override;
38};
39
40} // namespace P4
41
42#endif /* FRONTENDS_P4_EVALUATOR_SUBSTITUTEPARAMETERS_H_ */
Definition referenceMap.h:48
Definition node.h:44
Definition parameterSubstitution.h:21
Definition typeSubstitution.h:64
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13