-
Notifications
You must be signed in to change notification settings - Fork 457
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
Consistently set & propagate child names #5134
Conversation
Signed-off-by: Anton Korobeynikov <[email protected]>
b2ecd72
to
5eadb9f
Compare
So the This all worked fin until we introduced inline Vectors -- in this case the children were children of the Vectors parent ans so things got messed up. I always wanted to improve the dumper to print the indexes for Vectors, but never came up with a good way of doing it without being too expensive -- we don't want to add overhead to all IR traversals (by, for example, creating dynamic strings to put in Overall this looks good and is definitely an improvement. I'd still like to figure out a way to print indexes so you would end up with something like:
without introducing extra overhead. My thought was to add some extra magic char to the static string that IRDumper could recognize and do something with, but I never got that far. |
Yeah, I wanted something like this as well, but thought that at least name is good enough :) Otherwise things were pretty misleading. Also note that the code in |
Signed-off-by: Anton Korobeynikov <[email protected]>
1ac66d7
to
9daf098
Compare
Signed-off-by: Anton Korobeynikov <[email protected]>
child_name
is only updated on the context if it is non-empty. Looks like it was a ad-hoc approach to propagatechild_name
forVector
/IndexedVector
as these do not have context and visitation of them looks like as we just unroll the vector.However, these caused unwanted side effects in many places (and could be easily seen via e.g. dumper pass). Consider, for example,
P4Parser
:Here the
child_name
insideparserLocals.visit_children(v)
andstates.visit_children(v)
would beconstructorParams
and this is not something we'd want (note multipleconstructorParams
fields):Here we extend
visit_children
to accept a name argument and use to to pass the upper-level field name. Example above becomes: