gh-105481: refactor instr flag related code into a new InstructionFlags class#105950
gh-105481: refactor instr flag related code into a new InstructionFlags class#105950iritkatriel merged 5 commits intopython:mainfrom
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.
| 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.
There was a problem hiding this comment.
I can add it after I merge your code into gh-105924.
|
It's doing this now that I removed the hash and eq: |
Oh dang. Dataclasses don't generate a hash by default. You can either put the |
|
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.