mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-16 11:30:51 +00:00
When emitting instructions that define EFLAGS and the EFLAGS value isn't
used, mark the defs as dead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61215 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
34d6ad73e1
commit
bfd23c9961
@ -403,6 +403,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
}
|
||||
}
|
||||
|
||||
// The EFLAGS implicit def is dead.
|
||||
New->getOperand(3).setIsDead();
|
||||
|
||||
// Replace the pseudo instruction with a new instruction...
|
||||
if (New) MBB.insert(I, New);
|
||||
}
|
||||
@ -416,6 +419,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
(Is64Bit ? X86::SUB64ri32 : X86::SUB32ri);
|
||||
MachineInstr *New =
|
||||
BuildMI(MF, TII.get(Opc), StackPtr).addReg(StackPtr).addImm(CalleeAmt);
|
||||
// The EFLAGS implicit def is dead.
|
||||
New->getOperand(3).setIsDead();
|
||||
|
||||
MBB.insert(I, New);
|
||||
}
|
||||
}
|
||||
@ -517,7 +523,10 @@ void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
|
||||
|
||||
while (Offset) {
|
||||
uint64_t ThisVal = (Offset > Chunk) ? Chunk : Offset;
|
||||
MachineInstr *MI =
|
||||
BuildMI(MBB, MBBI, TII.get(Opc), StackPtr).addReg(StackPtr).addImm(ThisVal);
|
||||
// The EFLAGS implicit def is dead.
|
||||
MI->getOperand(3).setIsDead();
|
||||
Offset -= ThisVal;
|
||||
}
|
||||
}
|
||||
@ -713,8 +722,11 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
// applies to tail call optimized functions where the callee argument stack
|
||||
// size is bigger than the callers.
|
||||
if (TailCallReturnAddrDelta < 0) {
|
||||
MachineInstr *MI =
|
||||
BuildMI(MBB, MBBI, TII.get(Is64Bit? X86::SUB64ri32 : X86::SUB32ri),
|
||||
StackPtr).addReg(StackPtr).addImm(-TailCallReturnAddrDelta);
|
||||
// The EFLAGS implicit def is dead.
|
||||
MI->getOperand(3).setIsDead();
|
||||
}
|
||||
|
||||
uint64_t NumBytes = 0;
|
||||
@ -751,10 +763,14 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
I->addLiveIn(FramePtr);
|
||||
|
||||
// Realign stack
|
||||
if (needsStackRealignment(MF))
|
||||
if (needsStackRealignment(MF)) {
|
||||
MachineInstr *MI =
|
||||
BuildMI(MBB, MBBI,
|
||||
TII.get(Is64Bit ? X86::AND64ri32 : X86::AND32ri),
|
||||
StackPtr).addReg(StackPtr).addImm(-MaxAlign);
|
||||
// The EFLAGS implicit def is dead.
|
||||
MI->getOperand(3).setIsDead();
|
||||
}
|
||||
} else
|
||||
NumBytes = StackSize - X86FI->getCalleeSavedFrameSize();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user