[PATCH] D84833: Implement indirect branch generation in position independent code for the RISC-V target

msizanoen1 via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 07:09:49 PDT 2020


msizanoen1 updated this revision to Diff 281568.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84833/new/

https://reviews.llvm.org/D84833

Files:
  llvm/lib/Target/RISCV/RISCVInstrInfo.cpp


Index: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -384,7 +384,6 @@
 
   MachineFunction *MF = MBB.getParent();
   MachineRegisterInfo &MRI = MF->getRegInfo();
-  const auto &TM = static_cast<const RISCVTargetMachine &>(MF->getTarget());
 
   if (!isInt<32>(BrOffset))
     report_fatal_error(
@@ -394,11 +393,10 @@
   // scavenger won't work with empty blocks (SIInstrInfo::insertIndirectBranch
   // uses the same workaround).
   Register ScratchReg = MRI.createVirtualRegister(&RISCV::GPRRegClass);
-  auto II = MBB.end();
 
-  MachineInstr &MI = *BuildMI(MBB, II, DL, get(RISCV::PseudoJump))
-    .addMBB(&DestBB)
-    .addReg(ScratchReg, RegState::Define | RegState::Dead);
+  MachineInstr &MI = *BuildMI(MBB, DL, get(RISCV::PseudoJump))
+                          .addReg(ScratchReg, RegState::Define | RegState::Dead)
+                          .addMBB(&DestBB);
 
   RS->enterBasicBlockEnd(MBB);
   unsigned Scav = RS->scavengeRegisterBackwards(RISCV::GPRRegClass,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84833.281568.patch
Type: text/x-patch
Size: 1131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200729/b3d58fde/attachment.bin>


More information about the llvm-commits mailing list