summaryrefslogtreecommitdiff
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.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/lib/Target/BPF/BPFRegisterInfo.cpp b/llvm/lib/Target/BPF/BPFRegisterInfo.cpp
index 8761e4aa258c..84af6806abb3 100644
--- a/llvm/lib/Target/BPF/BPFRegisterInfo.cpp
+++ b/llvm/lib/Target/BPF/BPFRegisterInfo.cpp
@@ -47,9 +47,17 @@ BitVector BPFRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
return Reserved;
}
-static void WarnSize(int Offset, MachineFunction &MF, DebugLoc& DL)
-{
+static void WarnSize(int Offset, MachineFunction &MF, DebugLoc& DL,
+ MachineBasicBlock& MBB) {
if (Offset <= -BPFStackSizeOption) {
+ if (!DL)
+ /* try harder to get some debug loc */
+ for (auto &I : MBB)
+ if (I.getDebugLoc()) {
+ DL = I.getDebugLoc();
+ break;
+ }
+
const Function &F = MF.getFunction();
DiagnosticInfoUnsupported DiagStackSize(
F,
@@ -73,14 +81,6 @@ bool BPFRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
MachineFunction &MF = *MBB.getParent();
DebugLoc DL = MI.getDebugLoc();
- if (!DL)
- /* try harder to get some debug loc */
- for (auto &I : MBB)
- if (I.getDebugLoc()) {
- DL = I.getDebugLoc();
- break;
- }
-
while (!MI.getOperand(i).isFI()) {
++i;
assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!");
@@ -93,7 +93,7 @@ bool BPFRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
if (MI.getOpcode() == BPF::MOV_rr) {
int Offset = MF.getFrameInfo().getObjectOffset(FrameIndex);
- WarnSize(Offset, MF, DL);
+ WarnSize(Offset, MF, DL, MBB);
MI.getOperand(i).ChangeToRegister(FrameReg, false);
Register reg = MI.getOperand(i - 1).getReg();
BuildMI(MBB, ++II, DL, TII.get(BPF::ADD_ri), reg)
@@ -108,7 +108,7 @@ bool BPFRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
if (!isInt<32>(Offset))
llvm_unreachable("bug in frame offset");
- WarnSize(Offset, MF, DL);
+ WarnSize(Offset, MF, DL, MBB);
if (MI.getOpcode() == BPF::FI_ri) {
// architecture does not really support FI_ri, replace it with