Skip to content
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

Specify key names generated for keys with masks #1141

Merged
merged 4 commits into from
Dec 5, 2022
Merged

Specify key names generated for keys with masks #1141

merged 4 commits into from
Dec 5, 2022

Conversation

mihaibudiu
Copy link
Contributor

Signed-off-by: Mihai Budiu mbudiu@vmware.com
Fixes #1138
This has been supported by the compiler for at least 5 years.

@apinski-cavium
Copy link
Contributor

I assume you double checked that there was no other expressions missing from that table the compiler supports too?
Note I am only getting to the table and control plane parts of the specifications for my compiler so I am happy for this change, I just want to make sure I don't miss any others here.

@mihaibudiu
Copy link
Contributor Author

mihaibudiu commented Sep 7, 2022

This is the signature of the corresponding pass:

class KeyNameGenerator : public Inspector {
    void postorder(const IR::Expression* expression) override;
    void postorder(const IR::PathExpression* expression) override;
    void postorder(const IR::Member* expression) override;
    void postorder(const IR::ArrayIndex* expression) override;
    void postorder(const IR::Constant* expression) override;
    void postorder(const IR::Slice* expression) override;
    void postorder(const IR::BAnd* expression) override;
    void postorder(const IR::MethodCallExpression* expression) override;
};

MethodCallExpression is for isValid.

@mihaibudiu
Copy link
Contributor Author

We should verify what various implementations do.
What is the authoritative name? The p4info file?

@mihaibudiu
Copy link
Contributor Author

@vgurevich will post comments.

p4-16/spec/P4-16-spec.mdk Outdated Show resolved Hide resolved
@mihaibudiu
Copy link
Contributor Author

The Barefoot compiler does not use these rules for masks and slices.

All other kinds of expressions **must** be annotated with a `@name`
annotation (Section [#sec-control-plane-api-annotations]), as in the
following example.
If a compiler cannot generate a name for a key is **requires** the key
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is -> it?

Copy link
Collaborator

@jafingerhut jafingerhut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me.

Mihai Budiu added 3 commits November 4, 2022 10:23
Signed-off-by: Mihai Budiu <mbudiu@vmware.com>
Signed-off-by: Mihai Budiu <mbudiu@vmware.com>
Signed-off-by: Mihai Budiu <mbudiu@vmware.com>
Copy link
Collaborator

@jafingerhut jafingerhut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Key names for keys with masks
3 participants