mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
Simplified logic of this if-then statement to reduce nesting. No functionality
change. llvm-svn: 73143
This commit is contained in:
parent
996a7f7f37
commit
23d6f0b5c7
@ -838,9 +838,9 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
|||||||
if (MBBI != MBB.end())
|
if (MBBI != MBB.end())
|
||||||
DL = MBBI->getDebugLoc();
|
DL = MBBI->getDebugLoc();
|
||||||
|
|
||||||
if (NumBytes) { // adjust stack pointer: ESP -= numbytes
|
// Adjust stack pointer: ESP -= numbytes.
|
||||||
if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) {
|
if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) {
|
||||||
// Check, whether EAX is livein for this function
|
// Check, whether EAX is livein for this function.
|
||||||
bool isEAXAlive = false;
|
bool isEAXAlive = false;
|
||||||
for (MachineRegisterInfo::livein_iterator
|
for (MachineRegisterInfo::livein_iterator
|
||||||
II = MF.getRegInfo().livein_begin(),
|
II = MF.getRegInfo().livein_begin(),
|
||||||
@ -850,10 +850,10 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
|||||||
Reg == X86::AH || Reg == X86::AL);
|
Reg == X86::AH || Reg == X86::AL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function prologue calls _alloca to probe the stack when allocating
|
// Function prologue calls _alloca to probe the stack when allocating more
|
||||||
// more than 4k bytes in one go. Touching the stack at 4K increments is
|
// than 4k bytes in one go. Touching the stack at 4K increments is necessary
|
||||||
// necessary to ensure that the guard pages used by the OS virtual memory
|
// to ensure that the guard pages used by the OS virtual memory manager are
|
||||||
// manager are allocated in correct sequence.
|
// allocated in correct sequence.
|
||||||
if (!isEAXAlive) {
|
if (!isEAXAlive) {
|
||||||
BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX)
|
BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX)
|
||||||
.addImm(NumBytes);
|
.addImm(NumBytes);
|
||||||
@ -863,23 +863,26 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
|||||||
// Save EAX
|
// Save EAX
|
||||||
BuildMI(MBB, MBBI, DL, TII.get(X86::PUSH32r))
|
BuildMI(MBB, MBBI, DL, TII.get(X86::PUSH32r))
|
||||||
.addReg(X86::EAX, RegState::Kill);
|
.addReg(X86::EAX, RegState::Kill);
|
||||||
|
|
||||||
// Allocate NumBytes-4 bytes on stack. We'll also use 4 already
|
// Allocate NumBytes-4 bytes on stack. We'll also use 4 already
|
||||||
// allocated bytes for EAX.
|
// allocated bytes for EAX.
|
||||||
BuildMI(MBB, MBBI, DL,
|
BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX)
|
||||||
TII.get(X86::MOV32ri), X86::EAX).addImm(NumBytes-4);
|
.addImm(NumBytes - 4);
|
||||||
BuildMI(MBB, MBBI, DL, TII.get(X86::CALLpcrel32))
|
BuildMI(MBB, MBBI, DL, TII.get(X86::CALLpcrel32))
|
||||||
.addExternalSymbol("_alloca");
|
.addExternalSymbol("_alloca");
|
||||||
|
|
||||||
// Restore EAX
|
// Restore EAX
|
||||||
MachineInstr *MI = addRegOffset(BuildMI(MF, DL, TII.get(X86::MOV32rm),
|
MachineInstr *MI = addRegOffset(BuildMI(MF, DL, TII.get(X86::MOV32rm),
|
||||||
X86::EAX),
|
X86::EAX),
|
||||||
StackPtr, false, NumBytes-4);
|
StackPtr, false, NumBytes - 4);
|
||||||
MBB.insert(MBBI, MI);
|
MBB.insert(MBBI, MI);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (NumBytes) {
|
||||||
// If there is an SUB32ri of ESP immediately before this instruction,
|
// If there is an SUB32ri of ESP immediately before this instruction, merge
|
||||||
// merge the two. This can be the case when tail call elimination is
|
// the two. This can be the case when tail call elimination is enabled and
|
||||||
// enabled and the callee has more arguments then the caller.
|
// the callee has more arguments then the caller.
|
||||||
NumBytes -= mergeSPUpdates(MBB, MBBI, StackPtr, true);
|
NumBytes -= mergeSPUpdates(MBB, MBBI, StackPtr, true);
|
||||||
|
|
||||||
// If there is an ADD32ri or SUB32ri of ESP immediately after this
|
// If there is an ADD32ri or SUB32ri of ESP immediately after this
|
||||||
// instruction, merge the two instructions.
|
// instruction, merge the two instructions.
|
||||||
mergeSPUpdatesDown(MBB, MBBI, StackPtr, &NumBytes);
|
mergeSPUpdatesDown(MBB, MBBI, StackPtr, &NumBytes);
|
||||||
@ -887,7 +890,6 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
|||||||
if (NumBytes)
|
if (NumBytes)
|
||||||
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit, TII);
|
emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit, TII);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (needsFrameMoves)
|
if (needsFrameMoves)
|
||||||
emitFrameMoves(MF, FrameLabelId, ReadyLabelId);
|
emitFrameMoves(MF, FrameLabelId, ReadyLabelId);
|
||||||
|
Loading…
Reference in New Issue
Block a user