46 std::map<const IR::Parameter *, const IR::Parameter *> substitution;
56 int expressionPrecedence;
61 expressionPrecedence(DBPrint::Prec_Low) {
69 this->builder = builder;
72 void substitute(
const IR::Parameter *p,
const IR::Parameter *with);
74 for (
auto s : other->substitution) substitute(s.first, s.second);
77 void useAsPointerVariable(cstring name) { this->asPointerVariables.insert(name); }
79 for (
auto s : other->asPointerVariables) {
80 this->asPointerVariables.insert(s);
85 bool notSupported(
const IR::Expression *expression) {
86 ::P4::error(ErrorType::ERR_UNSUPPORTED,
"%1%: not yet implemented", expression);
90 bool preorder(
const IR::Expression *expression)
override {
return notSupported(expression); }
91 bool preorder(
const IR::Range *expression)
override {
return notSupported(expression); }
92 bool preorder(
const IR::Mask *expression)
override {
return notSupported(expression); }
93 bool preorder(
const IR::Slice *expression)
override
95 return notSupported(expression);
97 bool preorder(
const IR::StringLiteral *expression)
override;
98 bool preorder(
const IR::ListExpression *expression)
override;
99 bool preorder(
const IR::PathExpression *expression)
override;
100 bool preorder(
const IR::Constant *expression)
override;
101 bool preorder(
const IR::Declaration_Variable *decl)
override;
102 bool preorder(
const IR::BoolLiteral *b)
override;
103 bool preorder(
const IR::Cast *c)
override;
104 bool preorder(
const IR::Operation_Binary *b)
override;
105 bool preorder(
const IR::Operation_Unary *u)
override;
106 bool preorder(
const IR::ArrayIndex *a)
override;
107 bool preorder(
const IR::Mux *a)
override;
108 bool preorder(
const IR::Member *e)
override;
109 bool preorder(
const IR::MethodCallExpression *expression)
override;
110 bool comparison(
const IR::Operation_Relation *comp);
111 bool preorder(
const IR::Equ *e)
override {
return comparison(e); }
112 bool preorder(
const IR::Neq *e)
override {
return comparison(e); }
113 bool preorder(
const IR::Path *path)
override;
114 bool preorder(
const IR::StructExpression *expr)
override;
116 bool preorder(
const IR::Type_Typedef *type)
override;
117 bool preorder(
const IR::Type_Enum *type)
override;
118 void emitAssignStatement(
const IR::Type *ltype,
const IR::Expression *lexpr, cstring lpath,
119 const IR::Expression *rexpr);
120 bool preorder(
const IR::AssignmentStatement *s)
override;
121 bool preorder(
const IR::BlockStatement *s)
override;
122 bool preorder(
const IR::MethodCallStatement *s)
override;
123 bool preorder(
const IR::EmptyStatement *s)
override;
124 bool preorder(
const IR::ReturnStatement *s)
override;
125 bool preorder(
const IR::ExitStatement *s)
override;
126 bool preorder(
const IR::IfStatement *s)
override;
128 void widthCheck(
const IR::Node *node)
const;
129 void emitAndConvertByteOrder(
const IR::Expression *expr, cstring byte_order);
130 void emitTCBinaryOperation(
const IR::Operation_Binary *b,
bool isScalar);
131 void emitTCAssignmentEndianessConversion(
const IR::Expression *lexpr,
132 const IR::Expression *rexpr);
static unsigned ebpfTypeWidth(P4::TypeMap *typeMap, const IR::Expression *expr)
return real number of bits required by type
Definition codeGen.cpp:614
static cstring genHexStr(const big_int &value, unsigned width, const IR::Expression *expr)
Generate hex string and prepend it with zeroes when shorter than required width.
Definition codeGen.cpp:633
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
void error(const char *format, Args &&...args)
Report an error with the given message.
Definition lib/error.h:51