mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
Change stack probing code for MingW.
Since gcc 4.6 the compiler uses ___chkstk_ms which has the same semantics as the MS CRT function __chkstk. This simplifies the prologue generation a bit. Reviewed by Rafael Espíndola. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197205 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -608,14 +608,12 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
// virtual memory manager are allocated in correct sequence.
|
||||
if (NumBytes >= 4096 && STI.isOSWindows() && !STI.isTargetMacho()) {
|
||||
const char *StackProbeSymbol;
|
||||
bool isSPUpdateNeeded = false;
|
||||
|
||||
if (Is64Bit) {
|
||||
if (STI.isTargetCygMing())
|
||||
StackProbeSymbol = "___chkstk";
|
||||
else {
|
||||
if (STI.isTargetCygMing()) {
|
||||
StackProbeSymbol = "___chkstk_ms";
|
||||
} else {
|
||||
StackProbeSymbol = "__chkstk";
|
||||
isSPUpdateNeeded = true;
|
||||
}
|
||||
} else if (STI.isTargetCygMing())
|
||||
StackProbeSymbol = "_alloca";
|
||||
@@ -657,15 +655,15 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
|
||||
.addReg(X86::EFLAGS, RegState::Define | RegState::Implicit)
|
||||
.setMIFlag(MachineInstr::FrameSetup);
|
||||
|
||||
// MSVC x64's __chkstk does not adjust %rsp itself.
|
||||
// It also does not clobber %rax so we can reuse it when adjusting %rsp.
|
||||
if (isSPUpdateNeeded) {
|
||||
if (Is64Bit) {
|
||||
// MSVC x64's __chkstk and cygwin/mingw's ___chkstk_ms do not adjust %rsp
|
||||
// themself. It also does not clobber %rax so we can reuse it when
|
||||
// adjusting %rsp.
|
||||
BuildMI(MBB, MBBI, DL, TII.get(X86::SUB64rr), StackPtr)
|
||||
.addReg(StackPtr)
|
||||
.addReg(X86::RAX)
|
||||
.setMIFlag(MachineInstr::FrameSetup);
|
||||
}
|
||||
|
||||
if (isEAXAlive) {
|
||||
// Restore EAX
|
||||
MachineInstr *MI = addRegOffset(BuildMI(MF, DL, TII.get(X86::MOV32rm),
|
||||
|
||||
Reference in New Issue
Block a user