[PATCH] D107400: [RISCV] Introduce a RISCV CondCode enum instead of using ISD:SET* in MIR. NFC

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 3 13:23:12 PDT 2021


craig.topper created this revision.
craig.topper added reviewers: asb, luismarques, frasercrmck, jrtc27, evandro.
Herald added subscribers: StephenFan, vkmr, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

Previously we converted ISD condition codes to integers and stored
them directly in our MIR instructions. The ISD enum kind of belongs
to SelectionDAG so that seems like incorrect layering.

This patch instead uses the CondCode node on RISCV::SELECT_CC until
isel and then converts it from ISD encoding to a RISCV specific value.
This value can be converted to/from the RISCV branch opcodes. We
can't use the branch opcode encodings directly as that would make the
MIR printed values change when new instructions are added.

My larger motivation is to possibly implement something like this patch
from gcc https://patchwork.ozlabs.org/project/gcc/patch/20190430234741.8120-1-jimw@sifive.com/#2163277
This will require a new pseudo instruction for select that needs to
carry a branch condition and live probably until RISCVExpandPseudos.
Using an ISD encoding in RISCVExpandPseudos doesn't seem like correct
layering.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107400

Files:
  llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
  llvm/lib/Target/RISCV/RISCVInstrInfo.h
  llvm/lib/Target/RISCV/RISCVInstrInfo.td
  llvm/test/CodeGen/RISCV/select-optimize-multiple.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107400.363866.patch
Type: text/x-patch
Size: 13470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210803/f100cedb/attachment.bin>


More information about the llvm-commits mailing list