ARM64: ABI - Support for using register x8 as the return buffer argument for structs
authorBrian Sullivan <briansul@microsoft.com>
Mon, 6 Jun 2016 23:25:26 +0000 (16:25 -0700)
committerBrian Sullivan <briansul@microsoft.com>
Tue, 7 Jun 2016 22:55:51 +0000 (15:55 -0700)
commite7abaeb795a6ff8556b871822f7ec092eb50835c
treed71543727a51db58a3989408ebbe04215832f47a
parent9afee7e1da3bb7004e19585fcf2d1f6465888ef8
ARM64: ABI - Support for using register x8 as the return buffer argument for structs

This is feature complete and fixes #4949 but is being checked in disabled as it has dependencies
on some additional work in the VM #4950 (saving and restoring register x8 in thePrestub, etc..)

In target.h
Added defines on ARM64 for the additional argument register used to pass the return buffer
This is register x8 and when it used it is considered the 9th argiment with an arg num of 8 (zero based)
Added new method hasFixedRetBuffReg() that will return true on ARM64 (when this feature is fully enabled)
Added new method theFixedRetBuffReg() that returns register REG_R8 (x8) for ARM64
Added new method theFixedRetBuffArgNum that returns RET_BUFF_ARGNUM (8) for ARM64
Updated isValidIntArgReg to allow for a fixed return buff register

In codegencommon.cpp:
Increase the static size of regArgTab[] by one for the integer registers
This allows us to optionally support having a fixed return buffer registers
We now track the maximum index into regArgTab[] using argMax which is
either the old value of  regState->rsCalleeRegArgCount or thefixedRetBufArgNum()
Corrected the emitAttr size value for 64-bit targets to use EA_PTRSIZE instead of EA_4BYTE

In codegeninterface.cpp: (and other places)
Renamed rsCalleeRegNum to be rsCalleeRegArgCount to better reflect what it represents

In compiler.hpp
Updated genMapIntRegArgNumToRegNum and genMapIntRegNumToRegArgNum to handle
the fixed return buffer register for ARM64

In lclvars.cpp
Updated lvaInitRetBuffArg to handle the fixed return buffer register for ARM64

In morph.cpp
Updated fgMorphArgs to properly handle the fixed return buffer register for ARM64

In regalloc.cpp
Updated the assert check raUpdateRegStateForArg to allow for the fixed return buffer register for ARM64

Updated with changes from code review feedback
src/jit/codegencommon.cpp
src/jit/codegeninterface.h
src/jit/codegenlegacy.cpp
src/jit/compiler.hpp
src/jit/gcencode.cpp
src/jit/lclvars.cpp
src/jit/morph.cpp
src/jit/regalloc.cpp
src/jit/target.h