P4C
The P4 Compiler
Loading...
Searching...
No Matches
typeUnification.h
1/*
2Copyright 2013-present Barefoot Networks, Inc.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#ifndef TYPECHECKING_TYPEUNIFICATION_H_
18#define TYPECHECKING_TYPEUNIFICATION_H_
19
20#include "frontends/p4/typeMap.h"
21#include "ir/ir.h"
22
23namespace P4 {
24
25class TypeConstraints;
26class BinaryConstraint;
27
39class TypeUnification final {
40 TypeConstraints *constraints;
41 const TypeMap *typeMap;
42
43 static bool containsDots(const IR::Type_StructLike *type);
44 static bool containsDots(const IR::Type_BaseList *type);
45 bool unifyCall(const BinaryConstraint *constraint);
46 bool unifyFunctions(const BinaryConstraint *constraint, bool skipReturnValues = false);
47 bool unifyBlocks(const BinaryConstraint *constraint);
48
49 public:
50 TypeUnification(TypeConstraints *constraints, const P4::TypeMap *typeMap)
51 : constraints(constraints), typeMap(typeMap) {}
58 bool unify(const BinaryConstraint *constraint);
59};
60
61} // namespace P4
62
63#endif /* TYPECHECKING_TYPEUNIFICATION_H_ */
Base class for EqualityConstraint and CanBeImplicitlyCastConstraint.
Definition typeConstraints.h:107
Definition typeConstraints.h:180
Definition typeMap.h:41
Definition typeUnification.h:39
bool unify(const BinaryConstraint *constraint)
Definition typeUnification.cpp:245
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24