Consistently set & propagate child names#5134
Conversation
Signed-off-by: Anton Korobeynikov <anton@korobeynikov.info>
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 <anton@korobeynikov.info>
1ac66d7 to
9daf098
Compare
child_nameis only updated on the context if it is non-empty. Looks like it was a ad-hoc approach to propagatechild_nameforVector/IndexedVectoras 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_nameinsideparserLocals.visit_children(v)andstates.visit_children(v)would beconstructorParamsand this is not something we'd want (note multipleconstructorParamsfields):Here we extend
visit_childrento accept a name argument and use to to pass the upper-level field name. Example above becomes: