Skip to content

Update JMP_TBL targets during shortcutting for x86 codegen.

Jump tables are generated from Cmm Code in a few steps:

  1. We start with a CmmSwitch at the end of the Cmm pipeline which gets turned into a JMP_TBL instruction.
  2. During native codegen we generate static jump tables from JMP_TBL. (generateJumpTables)
  3. We shortcut jump targets, for jump tables by updating the static tables. (shortcutBranches). This might update the jump targets with calculated address not represented by a label.

After the third step the targets in the JMP_TBL instruction (which are the original labels) and in the static data can be out of sync.

D4566 went part of the way, updating labels in JMP_TBL. However without tables next to code labels can be updated to non-label jump destinations which I did not consider at the time.

D4595 is intended to fix this.

Trac metadata
Trac field Value
Version 8.5
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (NCG)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information