-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-109287: fix overrides in cases generator #110419
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
Conversation
I will be mostly unavailable from Oct 6 to Nov 4; if this isn't merged by Oct 6 reviewers should feel free to edit as needed and merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good riddance to OverriddenInstructionPlaceHolder
!
Two interesting facts:
- If you override an
inst
with anop
, you still get a macro with the same name; but if you override anop
with aninst
you don't. I think that's fine (the latter case is odd anyway). - Overrides are now replacing the original instruction in the output rather than being appended at the end.
Agreed that for debugging, --emit-line-directives
is the way to go.
Yeah I was aware of the second point and think it's fine. I hadn't thought about the first point; we could make it an error but I also think it's fine, the behavior you get is not unreasonable. |
Yeah it’s all fine. |
|
The fix here is based on fully buying into the idea that
inst
is just syntactic sugar for anop
andmacro
, and the principle that one does not ever override a macro, one overrides only the definition of an op;override inst
is equivalent tooverride op
. One can freely override an op (whether originally defined viaop
or implicitly viainst
) that may be part of one or several macros (explicit or implicit), and the override will be reflected in the generated contents of each macro.I think this approach makes sense; since explicitly-defined macros have never supported overrides, it's not clear why we should try to special-case some concept of overriding implicitly-defined macros.
I also think this approach should meet all our actual override needs; if we discover that I'm wrong, we can propose a later PR to generally add support for macro overrides.
This also implies some behavioral changes. The idea of a "placeholder comment" for overrides, or trying to emit the override contents later in the output, no longer makes much sense, since ops do not directly appear in the output, only macros do, and the macro itself is not overridden.
We could add an "// override" comment in some form; I didn't do that here and don't think it's needed. If you are trying to debug why your generated cases look the way they do, you should be enabling
#line
directives, which will give you much clearer provenance details.