[PATCH] Add a "probe-stack" attribute
Reid Kleckner
rnk at google.com
Wed Aug 6 11:58:49 PDT 2014
This seems like a reasonable implementation of useful functionality.
================
Comment at: lib/Target/X86/X86FrameLowering.cpp:675-692
@@ -668,4 +674,20 @@
- if (Is64Bit) {
- if (STI.isTargetCygMing()) {
- StackProbeSymbol = "___chkstk_ms";
+ if (NumBytes <= 0x5000) {
+ BuildMI(MBB, MBBI, DL, TII.get(Is64Bit ? X86::SUB64ri32 : X86::SUB32ri),
+ StackPtr)
+ .addReg(StackPtr)
+ .addImm(NumBytes)
+ .setMIFlag(MachineInstr::FrameSetup);
+
+ for (uint64_t i = 0; i < NumBytes / 0x1000; ++i) {
+ BuildMI(MBB, MBBI, DL, TII.get(Is64Bit ? X86::OR64mi8 : X86::OR32mi8))
+ .addReg(StackPtr)
+ .addImm(1)
+ .addReg(0)
+ .addImm(NumBytes - (i + 1) * 0x1000)
+ .addReg(0)
+ .addImm(0)
+ .setMIFlag(MachineInstr::FrameSetup);
+ }
+ } else {
+ const char *StackProbeSymbol;
----------------
This change seems like a separable optimization, correct? I'd like to have a separate patch for it.
================
Comment at: lib/Target/X86/X86FrameLowering.cpp:752
@@ +751,3 @@
+ if (isRegAccAlive) {
+ // Restore RegAcc
+ auto MIB = BuildMI(MF, DL,
----------------
Should be 2 space indentation
http://reviews.llvm.org/D4717
More information about the llvm-commits
mailing list