[llvm] [X86InstrInfo] support memfold on spillable inline asm (PR #70832)
Nick Desaulniers via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 28 08:44:12 PST 2023
================
@@ -578,28 +578,37 @@ static void foldInlineAsmMemOperand(MachineInstr *MI, unsigned OpNo, int FI,
foldInlineAsmMemOperand(MI, TiedTo, FI, TII);
}
- // Change the operand from a register to a frame index.
- MO.ChangeToFrameIndex(FI, MO.getTargetFlags());
-
- SmallVector<MachineOperand, 4> NewOps;
- TII.getFrameIndexOperands(NewOps);
+ SmallVector<MachineOperand, 5> NewOps;
+ TII.getFrameIndexOperands(NewOps, FI);
----------------
nickdesaulniers wrote:
Yes, and the previous behavior did already call `TargetInstrInfo::getFrameIndexOperands`. Instead of `MachineOperand::ChangeToFrameIndex` + `TargetInstrInfo::getFrameIndexOperands`, this change instead does `TargetInstrInfo::getFrameIndexOperands` (which now creates the MachineOperand we were changing) then `MachineInstr::removeOperand` (to remove the operand we were previously changing).
I have additional child commits locally for supporting other targets. I need to rebase them onto this change, which shouldn't be a problem; basically `getFrameIndexOperands` just needs to set up 3 MachineOperands for most targets but 5 MachineOperands for x86. Even then, I've realized that we only need to support x86 and m68k.
https://github.com/llvm/llvm-project/pull/70832
More information about the llvm-commits
mailing list