Enable HFA support for passing arguments on ARM64
authorBrian Sullivan <briansul@microsoft.com>
Tue, 24 May 2016 21:03:49 +0000 (14:03 -0700)
committerBrian Sullivan <briansul@microsoft.com>
Thu, 26 May 2016 04:00:21 +0000 (21:00 -0700)
commit9a31fc473fd06749a34e503f972c516784ff26ad
treeb90d9248c1fb54cd4fef8bc7d02d7c690e79d95c
parentf5f505065c10be3d4fbc7194140f685abe7df3bf
Enable HFA support for passing arguments on ARM64
   Fixes dotnet/coreclr#4946 ARM64: ABI - Passing HFA struct arguments in floating point registers
   We are now passing 24 additional HFA tests and have one test regression

   Previously HFA support was enabled on ARM32 using #ifdef _TARGET_ARM_
   Now HFA support is enabled for both platform using #ifdef FEATURE_HFA
   Note that FEATURE_HFA is a VM defined and enable only for platforms that have HFA support
   The VM is responsible for determining if a stuct is a HFA or not
   The JIT Calls this method CorInfoType CEEInfo::getHFAType(CORINFO_CLASS_HANDLE hClass) to identify HFA types
   Note that when using an AltJit targeting Arm32 or Arm64 we will never see an HFA type

In CodegenArm64.cpp
Method genPutArgStk
   Implement passing of HFA structs on the stack
   Refactored to handle both 16-byte structs and HFA struct
   Track GC types for the 16-byte structs or he floating point types for HFA's
   Use ldp when we have a 16-byte struct with no GC pointers
   Added asserts to check that we never write past the end of the outgoing arg area

In CodegenCommon.cpp
Method genFnPrologCalleRegArgs
   Implement the homing of incoming HDF variables
   These are currently homed into a stack based struct as we did for ARM32
   Use floating point types and registers when handling HFAs
   Added asserts to check that we never write past the end of the stack based struct

Added Dump method for fgArgTabEntry to display how arguments will be passed
Added GetNextSlotNum for fgArgInfo which returns what stack offset we would use for the next stack base argument
Fixed tree dump so that it can print multireg struct arguments

In Morph.cpp
Method ArgsComplete
   We currently chose to spill odd sized structs (11,13,14,15 bytes in size) into a GT_LCL_VAR temp so that we don't
   need to use more than two instructions to pass a GT_OBJ struct.  (Since we cannot read beyond the end of a GT_OBJ struct)
Method fgMorpgArgs
   Handle HFAs for multireg and stack arguments
   In this method 'size' is the number of registers used when passing an argument in registers
   or the number of TARGET_POINTER_SIZE stack slots when passing them on the stack
   For HFA this means that 'size' can change if we can't pass them using registers.
   Use new Dump method to print out how each argument is passed (what register or what stack slot)
Method fgMorphMultiregStuctArg
   Implement the expansion of multireg HFA arguments into GT_LISTs
   Refactored to handle both 16-byte structs and HFA struct
   Track GC types for the 16-byte structs or he floating point types for HFA's

Changes from code review feedback

Commit migrated from https://github.com/dotnet/coreclr/commit/b2efe59bec6e0b70b2ede2dc0301a790d465e6a4
21 files changed:
src/coreclr/src/jit/CMakeLists.txt
src/coreclr/src/jit/ClrJit.PAL.exports [new file with mode: 0644]
src/coreclr/src/jit/codegenarm64.cpp
src/coreclr/src/jit/codegencommon.cpp
src/coreclr/src/jit/codegenlegacy.cpp
src/coreclr/src/jit/compiler.cpp
src/coreclr/src/jit/compiler.h
src/coreclr/src/jit/ee_il_dll.cpp
src/coreclr/src/jit/flowgraph.cpp
src/coreclr/src/jit/gentree.cpp
src/coreclr/src/jit/importer.cpp
src/coreclr/src/jit/lclvars.cpp
src/coreclr/src/jit/lowerarm64.cpp
src/coreclr/src/jit/lsra.cpp
src/coreclr/src/jit/morph.cpp
src/coreclr/src/jit/protojit/CMakeLists.txt
src/coreclr/src/jit/regalloc.cpp
src/coreclr/src/jit/scopeinfo.cpp
src/coreclr/src/jit/standalone/CMakeLists.txt
src/coreclr/src/jit/target.h
src/coreclr/tests/arm64/Tests.lst