================ @@ -1575,6 +1575,26 @@ unsigned RISCVInstrInfo::getInstSizeInBytes(const MachineInstr &MI) const { // No patch bytes means at most a PseudoCall is emitted return std::max(NumBytes, 8U); } + case TargetOpcode::PATCHABLE_FUNCTION_ENTER: + case TargetOpcode::PATCHABLE_FUNCTION_EXIT: + case TargetOpcode::PATCHABLE_TAIL_CALL: { + const MachineFunction &MF = *MI.getParent()->getParent(); + const Function &F = MF.getFunction(); + if (Opcode == TargetOpcode::PATCHABLE_FUNCTION_ENTER && + F.hasFnAttribute("patchable-function-entry")) { + unsigned Num; + if (F.getFnAttribute("patchable-function-entry") + .getValueAsString() + .getAsInteger(10, Num)) + return get(Opcode).getSize(); + + // Number of C.NOP or NOP + return (STI.hasStdExtCOrZca() ? 2 : 4) * Num; + } + // XRay uses C.JAL + 25 or 33 C.NOP for each sled in RV32 and RV64, + // respectively. + return STI.is64Bit() ? 68 : 52; ---------------- topperc wrote:
should 52 be 44? https://github.com/llvm/llvm-project/pull/117368 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits