[llvm] [DecoderEmitter] Support for DecodeOrder and `resolve-conflicts-try-all` (PR #157948)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 17:56:16 PDT 2025


jurahul wrote:

I tried the RISCV changes you suggested and they don't work exactly. For example, I see a CM_JT vs CM_JALT failure (for pattern [0x06,0xa0]). The reason is that in the current case, we end up with a filter with just these 2 instructions:

```
    101000........10
    101000________10  CM_JALT
    101000000_____10  CM_JT
```

and then create a variable ID filter for JALT and a fixed one for JT, essentially attempting JT before JALT and that decodes to a CM_JT. If I add other instructions to the mix, the logic for creating best filter does not kick in anymore, so we fall back to trying these in sequential order (which happens to be the enum order). So we attempt to decode this as CM_JALT and fail. The predicates for these 2 instructions are same, and the ordering of fixed before variable is lost when we add more instructions to the mix.

When we have a mix with different decoder namespaces, we attempt a split and then it results in creating a smaller filter which then restores this behavior. So I suggest (if we want to adopt this for RISCV) we first go with simple replacement of decoder namespace with ordering and then potentially work on improving the heuristics here. As an example, if we cannot find the best filter, can we bucket instructions based on predicates for these insts and then filter (assuming that can disambiguate enough).

https://github.com/llvm/llvm-project/pull/157948


More information about the llvm-commits mailing list