P4C
The P4 Compiler
Loading...
Searching...
No Matches
ebpfPsaRegister.h
1
/*
2
Copyright 2022-present Orange
3
Copyright 2022-present Open Networking Foundation
4
5
Licensed under the Apache License, Version 2.0 (the "License");
6
you may not use this file except in compliance with the License.
7
You may obtain a copy of the License at
8
9
http://www.apache.org/licenses/LICENSE-2.0
10
11
Unless required by applicable law or agreed to in writing, software
12
distributed under the License is distributed on an "AS IS" BASIS,
13
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
See the License for the specific language governing permissions and
15
limitations under the License.
16
*/
17
#ifndef BACKENDS_EBPF_PSA_EXTERNS_EBPFPSAREGISTER_H_
18
#define BACKENDS_EBPF_PSA_EXTERNS_EBPFPSAREGISTER_H_
19
20
#include "backends/ebpf/ebpfTable.h"
21
#include "backends/ebpf/ebpfType.h"
22
23
namespace
P4::EBPF
{
24
25
class
ControlBodyTranslatorPSA;
26
27
class
EBPFRegisterPSA
:
public
EBPFTableBase
{
28
protected
:
29
size_t
size;
32
const
IR::Constant *
initialValue
=
nullptr
;
33
const
IR::Type *keyArg;
34
const
IR::Type *valueArg;
35
EBPFType
*keyType;
36
EBPFType
*valueType;
37
38
bool
shouldUseArrayMap();
39
40
public
:
41
EBPFRegisterPSA
(
const
EBPFProgram
*program,
cstring
instanceName,
42
const
IR::Declaration_Instance *di,
CodeGenInspector
*codeGen);
43
44
void
emitTypes(
CodeBuilder
*builder);
45
void
emitKeyType(
CodeBuilder
*builder);
46
void
emitValueType(
CodeBuilder
*builder);
47
48
void
emitInitializer(
CodeBuilder
*builder);
49
void
emitInstance(
CodeBuilder
*builder);
50
void
emitRegisterRead(
CodeBuilder
*builder,
const
P4::ExternMethod
*method,
51
ControlBodyTranslatorPSA
*translator,
52
const
IR::Expression *leftExpression);
53
void
emitRegisterWrite(
CodeBuilder
*builder,
const
P4::ExternMethod
*method,
54
ControlBodyTranslatorPSA
*translator);
55
};
56
57
}
// namespace P4::EBPF
58
59
#endif
// BACKENDS_EBPF_PSA_EXTERNS_EBPFPSAREGISTER_H_
P4::EBPF::CodeBuilder
Definition
ebpf/codeGen.h:33
P4::EBPF::CodeGenInspector
Definition
ebpf/codeGen.h:41
P4::EBPF::ControlBodyTranslatorPSA
Definition
ebpfPsaControl.h:30
P4::EBPF::EBPFProgram
Definition
ebpfProgram.h:39
P4::EBPF::EBPFRegisterPSA
Definition
ebpfPsaRegister.h:27
P4::EBPF::EBPFRegisterPSA::initialValue
const IR::Constant * initialValue
Definition
ebpfPsaRegister.h:32
P4::EBPF::EBPFTableBase
Also used to represent counters.
Definition
ebpfTable.h:49
P4::EBPF::EBPFType
Base class for EBPF types.
Definition
ebpfType.h:29
P4::ExternMethod
Definition
methodInstance.h:168
P4::cstring
Definition
cstring.h:85
P4::EBPF
Definition
codeGen.cpp:25
backends
ebpf
psa
externs
ebpfPsaRegister.h
Generated by
1.12.0