@@ -1425,7 +1425,7 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const {
1425
1425
if (MF.getFunction ()->isVarArg ())
1426
1426
report_fatal_error (" Segmented stacks do not support vararg functions." );
1427
1427
if (!STI.isTargetLinux () && !STI.isTargetDarwin () &&
1428
- !STI.isTargetWin32 () && !STI.isTargetFreeBSD ())
1428
+ !STI.isTargetWin32 () && !STI.isTargetWin64 () && !STI. isTargetFreeBSD ())
1429
1429
report_fatal_error (" Segmented stacks not supported on this platform." );
1430
1430
1431
1431
MachineBasicBlock *allocMBB = MF.CreateMachineBasicBlock ();
@@ -1474,6 +1474,9 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const {
1474
1474
} else if (STI.isTargetDarwin ()) {
1475
1475
TlsReg = X86::GS;
1476
1476
TlsOffset = 0x60 + 90 *8 ; // See pthread_machdep.h. Steal TLS slot 90.
1477
+ } else if (STI.isTargetWin64 ()) {
1478
+ TlsReg = X86::GS;
1479
+ TlsOffset = 0x28 ; // pvArbitrary, reserved for application use
1477
1480
} else if (STI.isTargetFreeBSD ()) {
1478
1481
TlsReg = X86::FS;
1479
1482
TlsOffset = 0x18 ;
@@ -1511,7 +1514,7 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const {
1511
1514
BuildMI (checkMBB, DL, TII.get (X86::LEA32r), ScratchReg).addReg (X86::ESP)
1512
1515
.addImm (1 ).addReg (0 ).addImm (-StackSize).addReg (0 );
1513
1516
1514
- if (STI.isTargetLinux () || STI.isTargetWin32 ()) {
1517
+ if (STI.isTargetLinux () || STI.isTargetWin32 () || STI. isTargetWin64 () ) {
1515
1518
BuildMI (checkMBB, DL, TII.get (X86::CMP32rm)).addReg (ScratchReg)
1516
1519
.addReg (0 ).addImm (0 ).addReg (0 ).addImm (TlsOffset).addReg (TlsReg);
1517
1520
} else if (STI.isTargetDarwin ()) {
0 commit comments