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

support for varbit types #156

Closed
wants to merge 0 commits into from
Closed

Conversation

ChrisDodd
Copy link
Contributor

This adds support for varbit types when converting P4-14 to P4-16

I had to add a weird (I think incorrect) hack in typeChecker.cpp to make it work which I think is probably a bug elsewhere, but I'm not sure where. See the FIXME.

} else if (auto type = ftype->to<IR::Type_Varbits>()) {
auto field = pushNewArray(fields);
field->append(prefix + f->name.name);
field->append(type->size); // FIXME -- where does length go?
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that BMv2 supports varbit types.

@@ -131,7 +131,10 @@ bool TypeInference::done() const {
const IR::Type* TypeInference::getType(const IR::Node* element) const {
const IR::Type* result = typeMap->getType(element);
if (result == nullptr) {
typeError("Could not find type of %1%", dbp(element));
if (auto field = element->to<IR::StructField>()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Fields should be in the type map.

return vbtype;
}

const IR::StructField *TypeConverter::postorder(IR::StructField *field) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We need a pass to do something with this annotation.

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.

2 participants