[PATCH] D14044: Support for 32-bit mingw-w64 in compiler-rt

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 26 10:01:35 PDT 2015


rnk added a comment.

Here's how I understand the various functions:

- `__chkstk` from msvcrt: takes size in RAX, probes all pages, returns preserving all registers.
- `__chkstk_ms` from mingw: copies `__chkstk` from msvcrt
- `_alloca` / `__chkstk` from mingw: helpers for implementing C `alloca()` with custom conventions. They trash volatile registers (ECX/RCX), update the SP, and return a new object address in RAX.

I'd rather simplify LLVM's X86FrameLowering to always use `__chkstk` / `__chkstk_ms` than add support for `__alloca` and Mingw `__chkstk`. It reduces the amount of assembly in compiler-rt, and simplifies LLVM in one step. The downside is that the compiler generates more code around dynamic allocas, which really doesn't matter.

What do you think?


================
Comment at: lib/builtins/i386/chkstk.S:22
@@ -21,3 +21,3 @@
         sub    $0x1000,%ecx
-        orl    $0,(%ecx)
+        test   %ecx,(%ecx)
         sub    $0x1000,%eax
----------------
I guess MSVC uses test, so this is fine.


Repository:
  rL LLVM

http://reviews.llvm.org/D14044





More information about the llvm-commits mailing list