[PATCH] [ms-cxxabi] Add a new calling convention that swaps 'this' and 'sret'

Reid Kleckner rnk at google.com
Thu Jan 30 15:34:08 PST 2014


Hi rafael.espindola,

MSVC always places the 'this' parameter for a method first.  The
implicit 'sret' pointer for methods always comes second.  We already
implement this for __thiscall by putting sret parameters on the stack,
but __cdecl methods require putting both parameters on the stack in
opposite order.

Using a special calling convention allows frontends to keep the sret
parameter first, which avoids breaking lots of assumptions in LLVM and
Clang.

Fixes PR15768 with the corresponding change in Clang.

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

Files:
  include/llvm/IR/CallingConv.h
  lib/AsmParser/LLLexer.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLToken.h
  lib/IR/AsmWriter.cpp
  lib/Target/X86/X86CallingConv.h
  lib/Target/X86/X86CallingConv.td
  test/CodeGen/X86/cdecl-method-return.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2663.1.patch
Type: text/x-patch
Size: 7839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140130/5bd245e0/attachment.bin>


More information about the llvm-commits mailing list