[clang] [llvm] [LoongArch] Add options for annotate tablejump (PR #102411)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 15 06:03:10 PDT 2024
================
@@ -601,6 +612,44 @@ bool LoongArchPreRAExpandPseudo::expandFunctionCALL(
return true;
}
+void LoongArchPreRAExpandPseudo::annotateTableJump(
+ MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) {
+ MachineFunction *MF = MBB.getParent();
+ MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo();
+
+ bool IsFinded = false;
+
+ std::function<void(MachineInstr *, int)> FindJTIMI = [&](MachineInstr *MInst,
+ int FindDepth) {
+ if (FindDepth < 0)
+ return;
+ for (auto &MO : MInst->all_uses()) {
+ if (IsFinded)
+ return;
+ Register Reg = MO.getReg();
+ if (!Reg.isVirtual())
+ continue;
+ MachineInstr *DefMI = MRI.getVRegDef(Reg);
+ if (!DefMI)
+ continue;
+ for (unsigned Idx = 0; Idx < DefMI->getNumOperands(); ++Idx) {
+ if (DefMI->getOperand(Idx).isJTI()) {
+ MBBI->setPreInstrSymbol(
+ *MF, MF->getContext().createNamedTempSymbol("jrtb_"));
+ MF->getInfo<LoongArchMachineFunctionInfo>()->setJumpInfo(&*MBBI,
+ DefMI);
----------------
wangleiat wrote:
Thanks.
https://github.com/llvm/llvm-project/pull/102411
More information about the cfe-commits
mailing list