Enable RyuJIT/x86 PInvoke lowering
authorBruce Forstall <brucefo@microsoft.com>
Thu, 12 May 2016 14:31:13 +0000 (07:31 -0700)
committerBruce Forstall <brucefo@microsoft.com>
Thu, 23 Jun 2016 16:53:48 +0000 (09:53 -0700)
commit23097f59065461b04ec4c343d89075d033481dab
tree8c80587f528829fa5cd276e682e40c9ba676ce96
parent6b2511d9d215cf3f3d5ca9a4c033f0e0194a7098
Enable RyuJIT/x86 PInvoke lowering

Fixes dotnet/coreclr#4181 "NYI_X86: Implement PInvoke frame init inlining for x86"

The main work here is to handle the custom calling convention for the
x86 CORINFO_HELP_INIT_PINVOKE_FRAME helper call: it takes EDI as an argument,
trashes only EAX, and returns the TCB in ESI.

The code changes are as follows:
1. Lowering::InsertPInvokeMethodProlog(): don't pass the "secret stub param" for x86.
Also, don't store the InlinedCallFrame.m_pCallSiteSP in the prolog: for x86 this is done
at the call site, due to the floating stack pointer.
2. LinearScan::getKillSetForNode(): for helper calls, call compHelperCallKillSet() to get the killMask,
to account for non-standard kill sets.
3. Morph.cpp::fgMorphArgs(): set non-standard arguments for CORINFO_HELP_INIT_PINVOKE_FRAME.
4. compHelperCallKillSet(): set the correct kill set for CORINFO_HELP_INIT_PINVOKE_FRAME.
5. codegenxarch.cpp::genCallInstruction(): set the ABI return register for CORINFO_HELP_INIT_PINVOKE_FRAME.
6. lowerxarch.cpp::TreeNodeInfoInit(): set the GT_CALL dstCandidates for CORINFO_HELP_INIT_PINVOKE_FRAME.

5 & 6 are both needed to avoid a copy.

With this change, the dotnet/coreclr#1 NYI with 18415 hits over the tests is gone.
The total number of NYI is now 29516.

Commit migrated from https://github.com/dotnet/coreclr/commit/3c7ecfeea45ba11eb59ae5615ddd5d89ea980ea5
src/coreclr/src/jit/codegencommon.cpp
src/coreclr/src/jit/codegenxarch.cpp
src/coreclr/src/jit/lower.cpp
src/coreclr/src/jit/lowerxarch.cpp
src/coreclr/src/jit/lsra.cpp
src/coreclr/src/jit/morph.cpp
src/coreclr/src/jit/target.h