[llvm] [RISCV][GISel] Move G_BRJT expansion to legalization (PR #73711)
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 28 17:28:05 PST 2023
================
@@ -317,6 +318,62 @@ bool RISCVLegalizerInfo::legalizeShlAshrLshr(
return true;
}
+bool RISCVLegalizerInfo::legalizeBRJT(MachineInstr &MI,
+ MachineIRBuilder &MIRBuilder) const {
+ MachineRegisterInfo &MRI = *MIRBuilder.getMRI();
+ auto &MF = *MI.getParent()->getParent();
+ const MachineJumpTableInfo *MJTI = MF.getJumpTableInfo();
+ unsigned EntrySize = MJTI->getEntrySize(MF.getDataLayout());
+
+ Register PtrReg = MI.getOperand(0).getReg();
+ LLT PtrTy = MRI.getType(PtrReg);
+ Register IndexReg = MI.getOperand(2).getReg();
+ LLT IndexTy = MRI.getType(IndexReg);
+
+ MachineInstrBuilder Index;
----------------
michaelmaitland wrote:
Should we change this to `Register Index` and do `Index = MIRBuilder.buildShl(IndexTy, IndexReg, ShiftAmt).getReg(0);` to avoid creating a new MachineInstrBuilder that is discarded by the assignment below? MachineInstrBuilder sounds like it would use more memory than a Register.
https://github.com/llvm/llvm-project/pull/73711
More information about the llvm-commits
mailing list