@@ -1166,7 +1166,7 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const {
1166
1166
if (MF.getFunction ()->isVarArg ())
1167
1167
report_fatal_error (" Segmented stacks do not support vararg functions." );
1168
1168
if (!STI.isTargetLinux () && !STI.isTargetDarwin () &&
1169
- !STI.isTargetWin32 () && !STI.isTargetFreeBSD ())
1169
+ !STI.isTargetWin32 () && !STI.isTargetWin64 () && !STI. isTargetFreeBSD ())
1170
1170
report_fatal_error (" Segmented stacks not supported on this platform." );
1171
1171
1172
1172
MachineBasicBlock *allocMBB = MF.CreateMachineBasicBlock ();
@@ -1210,6 +1210,9 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const {
1210
1210
} else if (STI.isTargetDarwin ()) {
1211
1211
TlsReg = X86::GS;
1212
1212
TlsOffset = 0x60 + 90 *8 ; // See pthread_machdep.h. Steal TLS slot 90.
1213
+ } else if (STI.isTargetWin64 ()) {
1214
+ TlsReg = X86::GS;
1215
+ TlsOffset = 0x28 ; // pvArbitrary, reserved for application use
1213
1216
} else if (STI.isTargetFreeBSD ()) {
1214
1217
TlsReg = X86::FS;
1215
1218
TlsOffset = 0x18 ;
@@ -1247,7 +1250,7 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const {
1247
1250
BuildMI (checkMBB, DL, TII.get (X86::LEA32r), ScratchReg).addReg (X86::ESP)
1248
1251
.addImm (1 ).addReg (0 ).addImm (-StackSize).addReg (0 );
1249
1252
1250
- if (STI.isTargetLinux () || STI.isTargetWin32 ()) {
1253
+ if (STI.isTargetLinux () || STI.isTargetWin32 () || STI. isTargetWin64 () ) {
1251
1254
BuildMI (checkMBB, DL, TII.get (X86::CMP32rm)).addReg (ScratchReg)
1252
1255
.addReg (0 ).addImm (0 ).addReg (0 ).addImm (TlsOffset).addReg (TlsReg);
1253
1256
} else if (STI.isTargetDarwin ()) {
0 commit comments