[RISCV] Add way to mark CompressPats that should only be used for compressing.
authorCraig Topper <craig.topper@sifive.com>
Wed, 20 Jan 2021 17:19:57 +0000 (09:19 -0800)
committerCraig Topper <craig.topper@sifive.com>
Wed, 20 Jan 2021 17:20:15 +0000 (09:20 -0800)
commitb11b6ab3e09464e88e57b69ff4a8fc8e1c00cc5b
tree4668072a7279f1186f87e536202f143ee8bf6d72
parent7dd198852b4db52ae22242dfeda4eccda83aa8b2
[RISCV] Add way to mark CompressPats that should only be used for compressing.

There can be muliple patterns that map to the same compressed
instruction. Reversing those leads to multiple ways to uncompress
an instruction, but its not easily controllable which one will
be chosen by the tablegen backend.

This patch adds a flag to mark patterns that should only be used
for compressing. This allows us to leave one canonical pattern
for uncompressing.

The obvious benefit of this is getting c.mv to uncompress to
the addi patern that is aliased to the mv pseudoinstruction. For
the add/and/or/xor/li patterns it just removes some unreachable
code from the generated code.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D94894
llvm/lib/Target/RISCV/RISCVInstrInfoC.td
llvm/test/MC/RISCV/compress-rv32i.s
llvm/test/MC/RISCV/option-rvc.s
llvm/test/TableGen/AsmPredicateCombiningRISCV.td
llvm/utils/TableGen/RISCVCompressInstEmitter.cpp