8#ifndef BACKENDS_UBPF_UBPFDEPARSER_H_
9#define BACKENDS_UBPF_UBPFDEPARSER_H_
11#include "backends/ebpf/ebpfObject.h"
13#include "ubpfHelpers.h"
14#include "ubpfProgram.h"
25 explicit UBPFDeparserTranslationVisitor(
const UBPFDeparser *deparser);
27 virtual void compileEmitField(
const IR::Expression *expr,
cstring field,
unsigned alignment,
31 bool notSupported(
const IR::Expression *expression) {
32 ::P4::error(ErrorType::ERR_UNSUPPORTED_ON_TARGET,
"%1%: not supported in Deparser",
37 bool notSupported(
const IR::StatOrDecl *statOrDecl) {
38 ::P4::error(ErrorType::ERR_UNSUPPORTED_ON_TARGET,
"%1%: not supported in Deparser",
43 bool preorder(
const IR::MethodCallExpression *expression)
override;
44 bool preorder(
const IR::BaseAssignmentStatement *a)
override {
return notSupported(a); };
45 bool preorder(
const IR::ExitStatement *s)
override {
return notSupported(s); };
46 bool preorder(UNUSED
const IR::BlockStatement *s)
override {
return true; };
47 bool preorder(
const IR::ReturnStatement *s)
override {
return notSupported(s); };
48 bool preorder(
const IR::IfStatement *statement)
override {
return notSupported(statement); };
49 bool preorder(
const IR::SwitchStatement *statement)
override {
50 return notSupported(statement);
52 bool preorder(
const IR::Operation_Binary *b)
override {
return notSupported(b); };
58 const IR::ControlBlock *controlBlock;
59 const IR::Parameter *packet_out;
60 const IR::Parameter *headers;
61 const IR::Parameter *parserHeaders;
65 UBPFDeparser(
const UBPFProgram *program,
const IR::ControlBlock *block,
66 const IR::Parameter *parserHeaders)
67 : program(program), controlBlock(block), headers(
nullptr), parserHeaders(parserHeaders) {}
Definition ebpf/codeGen.h:33
Definition ebpf/codeGen.h:41
Base class for EBPF objects.
Definition ebpfObject.h:31
Base class for EBPF types.
Definition ebpfType.h:29
Definition ir/vector.h:59
Definition coreLibrary.h:103
Definition ubpfDeparser.h:55
Definition ubpfDeparser.h:20
Definition ubpfProgram.h:28
void error(const char *format, Args &&...args)
Report an error with the given message.
Definition lib/error.h:58