================ @@ -22156,3 +22156,25 @@ namespace llvm::RISCVVIntrinsicsTable { #include "RISCVGenSearchableTables.inc" } // namespace llvm::RISCVVIntrinsicsTable + +bool RISCVTargetLowering::hasInlineStackProbe(const MachineFunction &MF) const { + + // If the function specifically requests inline stack probes, emit them. + if (MF.getFunction().hasFnAttribute("probe-stack")) + return MF.getFunction().getFnAttribute("probe-stack").getValueAsString() == + "inline-asm"; + + return false; +} + +unsigned RISCVTargetLowering::getStackProbeSize(const MachineFunction &MF, + unsigned StackAlign) const { + // The default stack probe size is 4096 if the function has no + // stack-probe-size attribute. + const Function &Fn = MF.getFunction(); + unsigned StackProbeSize = + Fn.getFnAttributeAsParsedInteger("stack-probe-size", 4096); + // Round down to the stack alignment. + StackProbeSize &= ~(StackAlign - 1); ---------------- topperc wrote:
Use `alignDown` from MathExtras.h? https://github.com/llvm/llvm-project/pull/117612 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits