[PATCH][MC/X86_64] Implement Win64 exception handling

Nico Rieck nico.rieck at gmail.com
Thu Nov 21 07:51:19 PST 2013


 >+  case X86::W64ALLOCA:
 >+    // Occurs if alloca()/call to __chkstk is used. Do nothing.
 >+    break;

This is wrong for Microsoft's __chkstk which does not adjust the stack 
pointer, so W64ALLOCA has to emit an alloc unwind instruction.

Your test only checks Mingw's behavior but uses the wrong triple. Please 
check both x86_64-pc-win32 and x86_64-pc-mingw triples.

You already reject a few illegal prologue instructions. IMO this should 
be expanded to reject all illegal instructions with a fatal error. 
Currently these just don't emit unwind instructions. This also means 
replacing those asserts.

Also, LEA instructions to adjust the stack pointer aren't handled.

> A consequence of this patch is that Win64 ABI errors become more serious.
> E.g. because of PR16779 I had to set the test avx-win64-args.ll to XFAIL.

Have you planned to fix PR16779, too?

-Nico



More information about the llvm-commits mailing list