| 1 | //===- SISpillUtils.cpp - SI spill helper functions -----------------------===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "SISpillUtils.h" |
| 10 | #include "llvm/ADT/BitVector.h" |
| 11 | #include "llvm/CodeGen/MachineFrameInfo.h" |
| 12 | #include "llvm/CodeGen/MachineFunction.h" |
| 13 | |
| 14 | using namespace llvm; |
| 15 | |
| 16 | void llvm::clearDebugInfoForSpillFIs(MachineFrameInfo &MFI, |
| 17 | MachineBasicBlock &MBB, |
| 18 | const BitVector &SpillFIs) { |
| 19 | // FIXME: The dead frame indices are replaced with a null register from the |
| 20 | // debug value instructions. We should instead update it with the correct |
| 21 | // register value. But not sure the register value alone is adequate to lower |
| 22 | // the DIExpression. It should be worked out later. |
| 23 | for (MachineInstr &MI : MBB) { |
| 24 | if (!MI.isDebugValue()) |
| 25 | continue; |
| 26 | |
| 27 | for (MachineOperand &Op : MI.debug_operands()) { |
| 28 | if (Op.isFI() && !MFI.isFixedObjectIndex(ObjectIdx: Op.getIndex()) && |
| 29 | SpillFIs[Op.getIndex()]) { |
| 30 | Op.ChangeToRegister(Reg: Register(), /*isDef=*/false); |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 |