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

Fix for issue #583 #587

Closed
wants to merge 4 commits into from
Closed

Fix for issue #583 #587

wants to merge 4 commits into from

Conversation

mihaibudiu
Copy link
Contributor

Also, slightly improved comments and debugging output in the p4-14 typecheck file.

/// - link header/metadata instances to the Type
/// - replace named references to global header or metadata instances with ConcreteHeaderRef
/// expressions that link directly to them.
/// - set type for Member and HeaderStackItemRefs
class TypeCheck::AssignInitialTypes : public Transform {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any particular reason you're using nested classes rather than namespaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have only changed the comments here. This code was written by @ChrisDodd.

Copy link
Contributor

Choose a reason for hiding this comment

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

I generally define nested visitors for a PassManager subclass as nested classes in the PassManager subclass; seems cleaner to me that defining a separate namespace in addition to the class.

if (it.first->layout) {
auto type = types.get(it.first->layout);
if (type->is<IR::Type_Header>())
createType(type, true, &converted);
Copy link
Contributor

Choose a reason for hiding this comment

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

Register layouts should always be treated as structs, not headers (should not have valid bits), They're only declared as header_types in P4_14, because that is the only way to define structs in P4_14 -- whether something is a header or metadata is determined by the instance declaration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then let's not yet merge this yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may be that the best place to do the conversion to a struct is somewhere earlier, in the P4-14 typechecker. I will try to figure it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the layout is just a string, so that solution won't work.

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.

3 participants