-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ebpf/PSA: Support for wide fields in Digest #3877
Conversation
This commits adds support for wide fields in Digest extern. Also small refactor has been done - Digest implementation was placed in a separate file, like any other PSA externs.
|
||
class EBPFDigestPSAValueVisitor : public CodeGenInspector { | ||
protected: | ||
cstring digestMapInstance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't guess what this does based on the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done small refactor and now instance of EBPFDigestPSA
is used to push element to the queue instead of using this variable.
return false; | ||
} | ||
|
||
// handle expression like: "digest.pack(value)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the 'value' part in digest.pack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've clarified this comment and other about these preorder
s
unsigned width = EBPFInitializerUtils::ebpfTypeWidth(typeMap, f->expression); | ||
builder->emitIndent(); | ||
|
||
if (EBPFScalarType::generatesScalar(width)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether this code pattern shouldn't be some utility function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added such function in CodeGenInspector
which is used also in preorder(const IR::AssignmentStatement)
I would like to remind you to merge PR if it is looks good to you. Only Mac OS tests fails, but they were broken at the time PR creation. |
This PR adds support for wide fields in Digest extern.
Also small refactor has been done - Digest implementation was placed in a separate file, like any other PSA externs.
CC: @osinstom