Uh oh!
There was an error while loading. Please reload this page.
gh-105481: refactor instr flag related code into a new InstructionFlags class - #105950
Conversation
gvanrossum
left a comment
There was a problem hiding this comment.
I like refactoring this, but I'd like to go a little beyond just packaging up the old code in a class.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| format += cache | ||
| cache = "0" | ||
| flags |= instr.flags | ||
| flags.add(instr.instr_flags) |
There was a problem hiding this comment.
At this point, in my optimizer work, I have a need to prevent one flag ("IS_UOP") from being propagated. How would you do that using the new API?
There was a problem hiding this comment.
We can add an arg to this function to tell it which flags to skip?
There was a problem hiding this comment.
Yeah, something like exclude: set[str] | None = None would work.
There was a problem hiding this comment.
Let's add it when we need it. I don't like adding code that is neither used nor tested.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
iritkatriel
commented
Jun 21, 2023
It's doing this now that I removed the hash and eq: |
gvanrossum
commented
Jun 21, 2023
Oh dang. Dataclasses don't generate a hash by default. You can either put the |
iritkatriel
commented
Jun 21, 2023
I changed it to not hash the data class object but the bitmap representation. It's just for an assertion that all the flags of a pseudo-op's targets are the same. |
This will help later when we want to use the flags for things like generating hasarg, etc.