Page MenuHomePhabricator

[RISCV] Add support for lowering jumptables
Needs ReviewPublic

Authored by asb on Jun 21 2018, 7:02 AM.

Details

Summary

Previously, the generation of jumptables was disabled. This patch adds the necessary support, as reflected in the updated output in test/CodeGen/RISCV/jumptable.ll.

Diff Detail

Event Timeline

asb created this revision.Jun 21 2018, 7:02 AM
sabuasal edited reviewers, added: sabuasal; removed: sameer.abuasal.Jun 27 2018, 2:50 PM
apazos added inline comments.Jun 27 2018, 6:01 PM
lib/Target/RISCV/RISCVISelLowering.cpp
153

Alex, I see lower performance when creating jump tables. We might need to set a minimum JT entries value to avoid the degradation.

GCC using 5 as threshold to decide using jump table or not for RISC-V and LLVM using 4.

Reference:
GCC: https://github.com/gcc-mirror/gcc/blob/master/gcc/targhooks.c#L1628

  • Note: targetm.have_casesi () return false for RISC-V.

LLVM: https://github.com/llvm-mirror/llvm/blob/master/lib/CodeGen/TargetLoweringBase.cpp#L72

jrtc27 added a subscriber: jrtc27.Dec 7 2018, 8:56 AM
lenary added a subscriber: lenary.Wed, Jul 31, 8:57 AM