[PATCH] ARM: support stack probe emission for Windows on ARM

Saleem Abdulrasool abdulras at fb.com
Wed Apr 2 08:48:06 PDT 2014



================
Comment at: lib/Target/ARM/ARMFrameLowering.cpp:321
@@ +320,3 @@
+          .addReg(ARM::R12, RegState::Kill)
+          .addReg(ARM::R4, RegState::Implicit);
+        break;
----------------
Renato Golin wrote:
> I don't know much about the Windows ABI, but are those registers fixed by it? Or are them just the "next available GPRs on either side"?
The R4 is definitely fixed.  I use R12 as it is intra-procedural scratch, and this usage is in the stack setup.

The interface for __chkstk on WoA is as follows:

R4 = 32-bit *words* to be allocated
call __chkstk
Adjust SP by value in R4 (now containing bytes)

This is what the ABI/API is and we have no choice in the matter unfortunately.

================
Comment at: lib/Target/ARM/ARMFrameLowering.cpp:290
@@ +289,3 @@
+  if (STI.isTargetWindows()) {
+    if (NumBytes >= 4080 /* 4096 */) {
+      uint32_t NumWords = NumBytes >> 2;
----------------
Renato Golin wrote:
> Maybe make it a constant, name it appropriately and comment on the constant?
I think I want to split it out into a function and base it on whether SSP is enabled or not.  But, we can extract it now rather than later.

================
Comment at: lib/Target/ARM/ARMFrameLowering.cpp:192
@@ -190,1 +191,3 @@
+  if (!AFI->hasStackFrame() &&
+      !(NumBytes >= 4080 /* 4096 */ && STI.isTargetWindows())) {
     if (NumBytes - ArgRegsSaveSize != 0) {
----------------
Renato Golin wrote:
> A better comment here would be good
Fair enough.


http://llvm-reviews.chandlerc.com/D3255



More information about the llvm-commits mailing list