P4C
The P4 Compiler
Loading...
Searching...
No Matches
desugar_varbit_extract.h
1
100#ifndef BF_P4C_MIDEND_DESUGAR_VARBIT_EXTRACT_H_
101#define BF_P4C_MIDEND_DESUGAR_VARBIT_EXTRACT_H_
102
103#include "backends/tofino/bf-p4c/common/utils.h"
104#include "backends/tofino/bf-p4c/midend/type_checker.h"
105#include "frontends/common/resolveReferences/referenceMap.h"
106#include "frontends/p4/cloner.h"
107#include "ir/annotations.h"
108#include "ir/ir.h"
109
110namespace BFN {
111
116 IR::Node *preorder(IR::ParserState *state) override {
117 for (const auto *component : state->components) {
118 const auto *statement = component->to<IR::MethodCallStatement>();
119 if (!statement) continue;
120 const IR::MethodCallExpression *call = statement->methodCall;
121 if (!call) continue;
122 const auto *method = call->method->to<IR::Member>();
123 if (!method) continue;
124
125 if (method->member == "extract" && call->arguments->size() == 2) {
126 state->addOrReplaceAnnotation("dontmerge"_cs, {});
127 break;
128 }
129 }
130 return state;
131 }
132};
133
143 public:
145};
146
152 public:
153 explicit DesugarVarbitExtract(P4::ReferenceMap *refMap, P4::TypeMap *typeMap);
154};
155
156} // namespace BFN
157
158#endif /* BF_P4C_MIDEND_DESUGAR_VARBIT_EXTRACT_H_ */
Definition node.h:94
Definition ir/pass_manager.h:40
Class used to encode maps from paths to declarations.
Definition referenceMap.h:66
Definition visitor.h:424
Definition typeMap.h:41
Definition desugar_varbit_extract.h:115
Checks that varbit accesses in pipeline are valid.
Definition desugar_varbit_extract.h:142
Top level PassManager that governs the rewrite of varbit usage.
Definition desugar_varbit_extract.h:151
The namespace encapsulating Barefoot/Intel-specific stuff.
Definition add_t2na_meta.cpp:21