aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/BPF/BPFRegisterInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/BPF/BPFRegisterInfo.cpp')
-rw-r--r--llvm/lib/Target/BPF/BPFRegisterInfo.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/llvm/lib/Target/BPF/BPFRegisterInfo.cpp b/llvm/lib/Target/BPF/BPFRegisterInfo.cpp
index 9bd39fd285a0..8761e4aa258c 100644
--- a/llvm/lib/Target/BPF/BPFRegisterInfo.cpp
+++ b/llvm/lib/Target/BPF/BPFRegisterInfo.cpp
@@ -20,12 +20,18 @@
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#define GET_REGINFO_TARGET_DESC
#include "BPFGenRegisterInfo.inc"
using namespace llvm;
+static cl::opt<int>
+ BPFStackSizeOption("bpf-stack-size",
+ cl::desc("Specify the BPF stack size limit"),
+ cl::init(512));
+
BPFRegisterInfo::BPFRegisterInfo()
: BPFGenRegisterInfo(BPF::R0) {}
@@ -43,13 +49,16 @@ BitVector BPFRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
static void WarnSize(int Offset, MachineFunction &MF, DebugLoc& DL)
{
- if (Offset <= -512) {
- const Function &F = MF.getFunction();
- DiagnosticInfoUnsupported DiagStackSize(F,
- "Looks like the BPF stack limit of 512 bytes is exceeded. "
- "Please move large on stack variables into BPF per-cpu array map.\n",
- DL);
- F.getContext().diagnose(DiagStackSize);
+ if (Offset <= -BPFStackSizeOption) {
+ const Function &F = MF.getFunction();
+ DiagnosticInfoUnsupported DiagStackSize(
+ F,
+ "Looks like the BPF stack limit is exceeded. "
+ "Please move large on stack variables into BPF per-cpu array map. For "
+ "non-kernel uses, the stack can be increased using -mllvm "
+ "-bpf-stack-size.\n",
+ DL);
+ F.getContext().diagnose(DiagStackSize);
}
}