[llvm] d148881 - [Mips] Correctly report sizes for PATCHABLE_* (#188229)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 05:35:12 PDT 2026


Author: Nikita Popov
Date: 2026-04-01T14:35:07+02:00
New Revision: d14888121db01f9d8f772fa6daaeb4d293085de0

URL: https://github.com/llvm/llvm-project/commit/d14888121db01f9d8f772fa6daaeb4d293085de0
DIFF: https://github.com/llvm/llvm-project/commit/d14888121db01f9d8f772fa6daaeb4d293085de0.diff

LOG: [Mips] Correctly report sizes for PATCHABLE_* (#188229)

Report the size of the xray sled.

This came up while working on
https://github.com/llvm/llvm-project/pull/187703.

Added: 
    

Modified: 
    llvm/lib/Target/Mips/MipsInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Mips/MipsInstrInfo.cpp b/llvm/lib/Target/Mips/MipsInstrInfo.cpp
index c879c46e49dd4..c08c963a33c71 100644
--- a/llvm/lib/Target/Mips/MipsInstrInfo.cpp
+++ b/llvm/lib/Target/Mips/MipsInstrInfo.cpp
@@ -714,6 +714,17 @@ unsigned MipsInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const {
     const char *AsmStr = MI.getOperand(0).getSymbolName();
     return getInlineAsmLength(AsmStr, *MF->getTarget().getMCAsmInfo());
   }
+  case TargetOpcode::PATCHABLE_FUNCTION_ENTER:
+  case TargetOpcode::PATCHABLE_FUNCTION_EXIT:
+  case TargetOpcode::PATCHABLE_TAIL_CALL:
+    // Size of xray sled
+    if (Subtarget.isGP64bit()) {
+      // beq + 15 nops
+      return 16 * 4;
+    } else {
+      // beq + 11 nops + addiu
+      return 13 * 4;
+    }
   case Mips::CONSTPOOL_ENTRY:
     // If this machine instr is a constant pool entry, its size is recorded as
     // operand #2.


        


More information about the llvm-commits mailing list