Omit reserved DXIL ops from OpCode enum#8143
Open
tex3d wants to merge 3 commits intomicrosoft:mainfrom
Open
Conversation
Switching DXIL ops to reserved will become common when they are retired from experimental. This change makes it trivial to do so without depending on or changing other reserved op names or numbers elsewhere.
This change excludes reserved ops from DXIL::OpCode enum, so they don't need a unique name. They should never be referenced, so this makes that using them basically impossible. The reserved values will be listed in a comment at the end of the enum, before NumOpCodes. Catch and reject reserved opcodes during validation. Since the OpCodeProperty table entries corresponding to their opcode must still be occupied due to the way ops are looked up by indexing the table, there's a new single ReservedOpCodeProps value, with opcode set to OpCode::Invalid, supplied for each reserved slot. This way the slot is occupied (reserved), but not valid for use. For instance, for a reserved opcode, now: - DecodeOpCode will return false (for invalid) - IsValidOpCode will return false - IsOverloadLegal will return false - getOpCode on instruction will return OpCode::Invalid - GetDxilOpFuncCallInst on instruction will return OpCode::Invalid - new IsReservedOpCode function will return true Added a validation test. Previously, it would have incorrectly accepted the reserved opcode as valid.
Contributor
|
✅ With the latest revision this PR passed the Python code formatter. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change excludes reserved ops from DXIL::OpCode enum, so they don't need a unique name. They should never be referenced, so this makes using them impossible. The reserved values will be listed in a comment at the end of the enum, before NumOpCodes.
Also fixed the validator to catch and reject reserved opcodes.
Since the OpCodeProperty table entries corresponding to their opcode must still be occupied due to the way ops are looked up by indexing the table, there's a new single ReservedOpCodeProps value, with opcode set to OpCode::Invalid, supplied for each reserved slot. This way the slot is occupied (reserved), but not valid for use.
For instance, for a reserved opcode, now:
Added a validation test. Previously, it would have incorrectly accepted the reserved opcode as valid.
Fixes #8144