Skip to content
This repository was archived by the owner on Dec 17, 2024. It is now read-only.

Commit 8a08e05

Browse files
jackcmaydmakarov
authored andcommitted
[SOL] Bump stack frame size
1 parent 4ad9aeb commit 8a08e05

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

llvm/lib/Target/BPF/BPFISelLowering.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "BPFISelLowering.h"
1515
#include "BPF.h"
16+
#include "BPFRegisterInfo.h"
1617
#include "BPFSubtarget.h"
1718
#include "BPFTargetMachine.h"
1819
#include "llvm/CodeGen/CallingConvLower.h"
@@ -355,7 +356,7 @@ SDValue BPFTargetLowering::LowerFormalArguments(
355356

356357
// Arguments relative to BPF::R5
357358
unsigned reg = MF.addLiveIn(BPF::R5, &BPF::GPRRegClass);
358-
SDValue Const = DAG.getConstant(2047 - VA.getLocMemOffset(), DL, MVT::i64);
359+
SDValue Const = DAG.getConstant(FrameLength - VA.getLocMemOffset(), DL, MVT::i64);
359360
SDValue SDV = DAG.getCopyFromReg(Chain, DL, reg, getPointerTy(MF.getDataLayout()));
360361
SDV = DAG.getNode(ISD::SUB, DL, PtrVT, SDV, Const);
361362
SDV = DAG.getLoad(LocVT, DL, Chain, SDV, MachinePointerInfo(), 0);
@@ -466,7 +467,7 @@ SDValue BPFTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
466467
assert(VA.isMemLoc());
467468

468469
EVT PtrVT = DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout());
469-
SDValue Const = DAG.getConstant(2047 - VA.getLocMemOffset(), CLI.DL, MVT::i64);
470+
SDValue Const = DAG.getConstant(FrameLength - VA.getLocMemOffset(), CLI.DL, MVT::i64);
470471
SDValue PtrOff = DAG.getNode(ISD::SUB, CLI.DL, PtrVT, FramePtr, Const);
471472
Chain = DAG.getStore(Chain, CLI.DL, Arg, PtrOff, MachinePointerInfo());
472473
}

llvm/lib/Target/BPF/BPFRegisterInfo.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ BitVector BPFRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
4343

4444
static void WarnSize(int Offset, MachineFunction &MF, DebugLoc& DL)
4545
{
46-
if (Offset <= -2048) {
47-
const Function &F = MF.getFunction();
48-
DiagnosticInfoUnsupported DiagStackSize(F,
49-
"Looks like the BPF stack limit of 2048 bytes is exceeded. "
50-
"Please move large on stack variables into BPF per-cpu array map.\n",
51-
DL);
52-
F.getContext().diagnose(DiagStackSize);
46+
int MaxOffset = -1 * FrameLength;
47+
if (Offset < MaxOffset) {
48+
dbgs() << "Error: Function " << MF.getFunction().getName() << " Stack offset of " << Offset
49+
<< " exceeded max offset of " << MaxOffset << " by "
50+
<< -(Offset - MaxOffset) << " bytes, please minimize large stack variables\n";
5351
}
5452
}
5553

llvm/lib/Target/BPF/BPFRegisterInfo.h

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#define GET_REGINFO_HEADER
1919
#include "BPFGenRegisterInfo.inc"
2020

21+
static const unsigned FrameLength = 4096;
22+
2123
namespace llvm {
2224

2325
struct BPFRegisterInfo : public BPFGenRegisterInfo {

0 commit comments

Comments
 (0)