Skip to content

Commit 5e2ca7f

Browse files
committed
Remove eliminateCallFramePseudoInstr and MIR comment
1 parent 22adc02 commit 5e2ca7f

File tree

5 files changed

+11
-22
lines changed

5 files changed

+11
-22
lines changed

llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ void SystemZAsmPrinter::emitInstruction(const MachineInstr *MI) {
199199
SystemZMCInstLower Lower(MF->getContext(), *this);
200200
MCInst LoweredMI;
201201
switch (MI->getOpcode()) {
202+
case SystemZ::ADJCALLSTACKDOWN:
203+
case SystemZ::ADJCALLSTACKUP:
204+
return;
205+
202206
case SystemZ::Return:
203207
LoweredMI = MCInstBuilder(SystemZ::BR)
204208
.addReg(SystemZ::R14D);

llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,6 @@ SystemZFrameLowering::create(const SystemZSubtarget &STI) {
6666
return std::make_unique<SystemZELFFrameLowering>();
6767
}
6868

69-
MachineBasicBlock::iterator SystemZFrameLowering::eliminateCallFramePseudoInstr(
70-
MachineFunction &MF, MachineBasicBlock &MBB,
71-
MachineBasicBlock::iterator MI) const {
72-
switch (MI->getOpcode()) {
73-
case SystemZ::ADJCALLSTACKDOWN:
74-
case SystemZ::ADJCALLSTACKUP:
75-
assert(hasReservedCallFrame(MF) &&
76-
"ADJSTACKDOWN and ADJSTACKUP should be no-ops");
77-
return MBB.erase(MI);
78-
break;
79-
80-
default:
81-
llvm_unreachable("Unexpected call frame instruction");
82-
}
83-
}
84-
8569
namespace {
8670
struct SZFrameSortingObj {
8771
bool IsValid = false; // True if we care about this Object.

llvm/lib/Target/SystemZ/SystemZFrameLowering.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ class SystemZFrameLowering : public TargetFrameLowering {
4141
}
4242

4343
bool hasReservedCallFrame(const MachineFunction &MF) const override;
44-
MachineBasicBlock::iterator
45-
eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
46-
MachineBasicBlock::iterator MI) const override;
4744
};
4845

4946
class SystemZELFFrameLowering : public SystemZFrameLowering {

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8108,15 +8108,17 @@ SystemZTargetLowering::emitAdjCallStack(MachineInstr &MI,
81088108
// Do the work of MachineFrameInfo::computeMaxCallFrameSize() early and
81098109
// remove these nodes. Given that these nodes start out as a glued sequence
81108110
// it seems best to remove them here after instruction selection and
8111-
// scheduling. NB: MIR testing does not work (yet) for call frames with
8112-
// this.
8111+
// scheduling.
81138112
MachineFrameInfo &MFI = BB->getParent()->getFrameInfo();
81148113
uint32_t NumBytes = MI.getOperand(0).getImm();
81158114
if (NumBytes > MFI.getMaxCallFrameSize())
81168115
MFI.setMaxCallFrameSize(NumBytes);
81178116
MFI.setAdjustsStack(true);
81188117

8119-
MI.eraseFromParent();
8118+
// TODO: MI should be erased. For now, keep it around as it seems to help
8119+
// scheduling around calls slightly in general (fix MachineScheduler).
8120+
MI.getOperand(0).setImm(0);
8121+
81208122
return BB;
81218123
}
81228124

llvm/lib/Target/SystemZ/SystemZLongBranch.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ static unsigned getInstSizeInBytes(const MachineInstr &MI,
218218
// These do not have a size:
219219
MI.isDebugOrPseudoInstr() || MI.isPosition() || MI.isKill() ||
220220
MI.isImplicitDef() || MI.getOpcode() == TargetOpcode::MEMBARRIER ||
221+
MI.getOpcode() == SystemZ::ADJCALLSTACKDOWN ||
222+
MI.getOpcode() == SystemZ::ADJCALLSTACKUP ||
221223
// These have a size that may be zero:
222224
MI.isInlineAsm() || MI.getOpcode() == SystemZ::STACKMAP ||
223225
MI.getOpcode() == SystemZ::PATCHPOINT) &&

0 commit comments

Comments
 (0)