P4C
The P4 Compiler
Loading...
Searching...
No Matches
check_extern_invocation.h
1
19#ifndef BF_P4C_ARCH_CHECK_EXTERN_INVOCATION_H_
20#define BF_P4C_ARCH_CHECK_EXTERN_INVOCATION_H_
21
22#include "bf-p4c/arch/arch.h"
23#include "frontends/p4/methodInstance.h"
24#include "ir/ir.h"
25#include "ir/visitor.h"
26#include "midend/checkExternInvocationCommon.h"
27
28namespace P4 {
29class ReferenceMap;
30class TypeMap;
31} // namespace P4
32
33namespace BFN {
34
36 protected:
37 int genIndex(gress_t gress, ArchBlock_t block) {
38 return gress * ArchBlock_t::BLOCK_TYPE + block;
39 }
40 cstring getBlockName(int bit) override {
41 static const char *lookup[] = {"parser", "control (MAU)", "deparser"};
42 BUG_CHECK(sizeof(lookup) / sizeof(lookup[0]) == ArchBlock_t::BLOCK_TYPE,
43 "Bad lookup table");
44 return cstring(lookup[bit % ArchBlock_t::BLOCK_TYPE]);
45 }
46 void initCommonPipeConstraints();
47 void checkExtern(const P4::ExternMethod *extMethod,
48 const IR::MethodCallExpression *expr) override;
50 : P4::CheckExternInvocationCommon(typeMap) {}
51};
52
54 void initPipeConstraints() override;
55
56 public:
58 : CheckExternInvocationCommon(refMap, typeMap) {
59 initPipeConstraints();
60 }
61};
62
64 void initPipeConstraints() override;
65
66 public:
68 : CheckExternInvocationCommon(refMap, typeMap) {
69 initPipeConstraints();
70 }
71};
72
73} // namespace BFN
74
75#endif /* BF_P4C_ARCH_CHECK_EXTERN_INVOCATION_H_ */
cstring getBlockName(int bit) override
Get the name of the block which is represented in bit vector (bitvec) by bit with index given by 'bit...
Definition check_extern_invocation.h:40
void checkExtern(const P4::ExternMethod *extMethod, const IR::MethodCallExpression *expr) override
Method for checking constraints of extern method given by parameters.
Definition check_extern_invocation.h:63
Definition check_extern_invocation.h:53
Base class which can be used to prepare classes for checking constraints for invocations of externs (...
Definition checkExternInvocationCommon.h:41
Definition methodInstance.h:168
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition typeMap.h:41
Definition cstring.h:85
The namespace encapsulating Barefoot/Intel-specific stuff.
Definition add_t2na_meta.cpp:21
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24